summaryrefslogtreecommitdiffstats
path: root/src/rapidjson/travis-doxygen.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/rapidjson/travis-doxygen.sh
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/rapidjson/travis-doxygen.sh')
-rwxr-xr-xsrc/rapidjson/travis-doxygen.sh122
1 files changed, 122 insertions, 0 deletions
diff --git a/src/rapidjson/travis-doxygen.sh b/src/rapidjson/travis-doxygen.sh
new file mode 100755
index 00000000..31a50cfa
--- /dev/null
+++ b/src/rapidjson/travis-doxygen.sh
@@ -0,0 +1,122 @@
+#!/bin/bash
+# Update Doxygen documentation after push to 'master'.
+# Author: @pah
+
+set -e
+
+DOXYGEN_VER=doxygen-1.8.7
+DOXYGEN_TAR=${DOXYGEN_VER}.linux.bin.tar.gz
+DOXYGEN_URL="http://ftp.stack.nl/pub/users/dimitri/${DOXYGEN_TAR}"
+DOXYGEN_BIN="/usr/local/bin/doxygen"
+
+: ${GITHUB_REPO:="miloyip/rapidjson"}
+GITHUB_HOST="github.com"
+GITHUB_CLONE="git://${GITHUB_HOST}/${GITHUB_REPO}"
+GITHUB_URL="https://${GITHUB_HOST}/${GITHUB_PUSH-${GITHUB_REPO}}"
+
+# if not set, ignore password
+#GIT_ASKPASS="${TRAVIS_BUILD_DIR}/gh_ignore_askpass.sh"
+
+skip() {
+ echo "$@" 1>&2
+ echo "Exiting..." 1>&2
+ exit 0
+}
+
+abort() {
+ echo "Error: $@" 1>&2
+ echo "Exiting..." 1>&2
+ exit 1
+}
+
+# TRAVIS_BUILD_DIR not set, exiting
+[ -d "${TRAVIS_BUILD_DIR-/nonexistent}" ] || \
+ abort '${TRAVIS_BUILD_DIR} not set or nonexistent.'
+
+# check for pull-requests
+[ "${TRAVIS_PULL_REQUEST}" = "false" ] || \
+ skip "Not running Doxygen for pull-requests."
+
+# check for branch name
+[ "${TRAVIS_BRANCH}" = "master" ] || \
+ skip "Running Doxygen only for updates on 'master' branch (current: ${TRAVIS_BRANCH})."
+
+# check for job number
+# [ "${TRAVIS_JOB_NUMBER}" = "${TRAVIS_BUILD_NUMBER}.1" ] || \
+# skip "Running Doxygen only on first job of build ${TRAVIS_BUILD_NUMBER} (current: ${TRAVIS_JOB_NUMBER})."
+
+# install doxygen binary distribution
+doxygen_install()
+{
+ wget -O - "${DOXYGEN_URL}" | \
+ tar xz -C ${TMPDIR-/tmp} ${DOXYGEN_VER}/bin/doxygen
+ export PATH="${TMPDIR-/tmp}/${DOXYGEN_VER}/bin:$PATH"
+}
+
+doxygen_run()
+{
+ cd "${TRAVIS_BUILD_DIR}";
+ doxygen ${TRAVIS_BUILD_DIR}/build/doc/Doxyfile;
+ doxygen ${TRAVIS_BUILD_DIR}/build/doc/Doxyfile.zh-cn;
+}
+
+gh_pages_prepare()
+{
+ cd "${TRAVIS_BUILD_DIR}/build/doc";
+ [ ! -d "html" ] || \
+ abort "Doxygen target directory already exists."
+ git --version
+ git clone -b gh-pages "${GITHUB_CLONE}" html
+ cd html
+ # setup git config (with defaults)
+ git config user.name "${GIT_NAME-travis}"
+ git config user.email "${GIT_EMAIL-"travis@localhost"}"
+ # clean working dir
+ rm -f .git/index
+ git clean -df
+}
+
+gh_pages_commit() {
+ cd "${TRAVIS_BUILD_DIR}/build/doc/html";
+ echo "rapidjson.org" > CNAME
+ git add --all;
+ git diff-index --quiet HEAD || git commit -m "Automatic doxygen build";
+}
+
+gh_setup_askpass() {
+ cat > ${GIT_ASKPASS} <<EOF
+#!/bin/bash
+echo
+exit 0
+EOF
+ chmod a+x "$GIT_ASKPASS"
+}
+
+gh_pages_push() {
+ # check for secure variables
+ [ "${TRAVIS_SECURE_ENV_VARS}" = "true" ] || \
+ skip "Secure variables not available, not updating GitHub pages."
+ # check for GitHub access token
+ [ "${GH_TOKEN+set}" = set ] || \
+ skip "GitHub access token not available, not updating GitHub pages."
+ [ "${#GH_TOKEN}" -eq 40 ] || \
+ abort "GitHub token invalid: found ${#GH_TOKEN} characters, expected 40."
+
+ cd "${TRAVIS_BUILD_DIR}/build/doc/html";
+ # setup credentials (hide in "set -x" mode)
+ git remote set-url --push origin "${GITHUB_URL}"
+ git config credential.helper 'store'
+ # ( set +x ; git config credential.username "${GH_TOKEN}" )
+ ( set +x ; [ -f ${HOME}/.git-credentials ] || \
+ ( echo "https://${GH_TOKEN}:@${GITHUB_HOST}" > ${HOME}/.git-credentials ; \
+ chmod go-rw ${HOME}/.git-credentials ) )
+ # push to GitHub
+ git push origin gh-pages
+}
+
+doxygen_install
+gh_pages_prepare
+doxygen_run
+gh_pages_commit
+gh_pages_push
+