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)"
|
|
|
|
source "${CI_DIR}/common.sh"
|
|
|
|
|
|
|
|
set +e
|
|
|
|
|
2016-02-19 08:00:59 +00:00
|
|
|
make coverage
|
2016-02-19 17:39:05 +00:00
|
|
|
pushd koreader-*/koreader
|
|
|
|
luajit $(which luacov-coveralls) -v
|
|
|
|
popd
|
|
|
|
|
2016-02-22 01:46:19 +00:00
|
|
|
if [ ${TRAVIS_PULL_REQUEST} = false ] && [ ${TRAVIS_BRANCH} = 'master' ]; then
|
2016-02-19 17:39:05 +00:00
|
|
|
travis_retry luarocks --local install ldoc
|
|
|
|
# get deploy key for doc repo
|
|
|
|
openssl aes-256-cbc -k $doc_build_secret -in .ci/koreader_doc.enc -out ~/.ssh/koreader_doc -d
|
|
|
|
chmod 600 ~/.ssh/koreader_doc # make agent happy
|
|
|
|
eval "$(ssh-agent)" > /dev/null
|
|
|
|
ssh-add ~/.ssh/koreader_doc > /dev/null
|
|
|
|
echo -e "\n${ANSI_GREEN}Check out koreader/doc for update."
|
|
|
|
git clone git@github.com:koreader/doc.git koreader_doc
|
|
|
|
|
|
|
|
# push doc update
|
|
|
|
pushd doc
|
|
|
|
luajit $(which ldoc) . 2> /dev/null
|
|
|
|
if [ ! -d html ]; then
|
|
|
|
echo "Failed to generate documents..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
cp -r doc/html/* koreader_doc/
|
|
|
|
pushd koreader_doc
|
|
|
|
|
2016-03-10 20:48:49 +00:00
|
|
|
git add -A
|
2016-02-19 17:39:05 +00:00
|
|
|
echo -e "\n${ANSI_GREEN}Pusing 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.'
|
|
|
|
git push -f --quiet origin gh-pages > /dev/null
|
|
|
|
echo -e "\n${ANSI_GREEN}Document update pushed."
|
2016-02-22 01:46:19 +00:00
|
|
|
else
|
|
|
|
echo -e "\n${ANSI_GREEN}Not on official master branch, skip document update."
|
2016-02-19 17:39:05 +00:00
|
|
|
fi
|