2016-02-19 08:00:59 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2016-02-19 17:39:05 +00:00
|
|
|
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
2017-04-09 08:42:16 +00:00
|
|
|
# shellcheck source=/dev/null
|
2016-02-19 17:39:05 +00:00
|
|
|
source "${CI_DIR}/common.sh"
|
|
|
|
|
|
|
|
set +e
|
|
|
|
|
2017-10-11 06:38:30 +00:00
|
|
|
if [ -z "${CIRCLE_PULL_REQUEST}" ] && [ "${CIRCLE_BRANCH}" = 'master' ]; then
|
|
|
|
echo "CIRCLE_NODE_INDEX: ${CIRCLE_NODE_INDEX}"
|
2020-02-02 19:35:21 +00:00
|
|
|
if [ "${CIRCLE_NODE_INDEX}" = 1 ]; then
|
2019-12-31 14:39:15 +00:00
|
|
|
echo -e "\\n${ANSI_GREEN}Updating translation source file."
|
|
|
|
make pot
|
|
|
|
pushd l10n && {
|
|
|
|
git checkout master
|
2020-01-02 21:05:09 +00:00
|
|
|
# If only one line was added and removed, it was just the timestamp.
|
|
|
|
git diff --numstat | grep "1[[:space:]]1[[:space:]]templates/koreader.pot" && echo -e "\\n${ANSI_GREEN}No updated translations found." || {
|
|
|
|
git -c user.name="KOReader build bot" -c user.email="non-reply@koreader.rocks" \
|
|
|
|
commit templates/koreader.pot -m "Updated translation source file"
|
|
|
|
git push --quiet "https://${TRANSLATIONS_GITHUB_TOKEN}@github.com/koreader/koreader-translations.git" master
|
|
|
|
echo -e "\\n${ANSI_GREEN}Translation update pushed."
|
|
|
|
}
|
2019-12-31 14:39:15 +00:00
|
|
|
} && popd || exit
|
|
|
|
|
2017-10-11 06:38:30 +00:00
|
|
|
echo -e "\\n${ANSI_GREEN}Checking out koreader/doc for update."
|
|
|
|
git clone git@github.com:koreader/doc.git koreader_doc
|
2016-02-19 17:39:05 +00:00
|
|
|
|
2017-10-11 06:38:30 +00:00
|
|
|
# push doc update
|
|
|
|
pushd doc && {
|
2020-02-02 19:35:21 +00:00
|
|
|
luajit "$(command -v ldoc)" . 2>/dev/null
|
2017-10-11 06:38:30 +00:00
|
|
|
if [ ! -d html ]; then
|
|
|
|
echo "Failed to generate documents..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
} && popd || exit
|
2017-10-10 14:18:53 +00:00
|
|
|
|
2017-10-11 06:38:30 +00:00
|
|
|
cp -r doc/html/* koreader_doc/
|
|
|
|
pushd koreader_doc && {
|
|
|
|
git add -A
|
|
|
|
echo -e "\\n${ANSI_GREEN}Pushing document update..."
|
|
|
|
git -c user.name="KOReader build bot" -c user.email="non-reply@koreader.rocks" \
|
|
|
|
commit -a --amend -m 'Automated documentation build from travis-ci.'
|
2019-08-22 16:01:04 +00:00
|
|
|
git push -f --quiet "https://${DOCS_GITHUB_TOKEN}@github.com/koreader/doc.git" gh-pages >/dev/null
|
2017-10-11 06:38:30 +00:00
|
|
|
echo -e "\\n${ANSI_GREEN}Documentation update pushed."
|
|
|
|
} && popd || exit
|
2017-04-11 09:23:42 +00:00
|
|
|
|
2017-10-11 06:38:30 +00:00
|
|
|
echo -e "\\n${ANSI_GREEN}Running make testfront for timings."
|
|
|
|
make testfront BUSTED_OVERRIDES="--output=junit -Xoutput junit-test-results.xml"
|
|
|
|
fi
|
|
|
|
|
2020-02-02 19:35:21 +00:00
|
|
|
if [ "${CIRCLE_NODE_INDEX}" = 0 ]; then
|
2017-10-11 06:38:30 +00:00
|
|
|
travis_retry make coverage
|
|
|
|
pushd koreader-*/koreader && {
|
|
|
|
# see https://github.com/codecov/example-lua
|
|
|
|
bash <(curl -s https://codecov.io/bash)
|
|
|
|
} && popd || exit
|
|
|
|
fi
|
2016-02-22 01:46:19 +00:00
|
|
|
else
|
2017-10-10 14:18:53 +00:00
|
|
|
echo -e "\\n${ANSI_GREEN}Not on official master branch. Skipping documentation update and coverage."
|
2016-02-19 17:39:05 +00:00
|
|
|
fi
|