Fix Travis-CI when using rebase.

* The $TRAVIS_COMMIT_RANGE could be not existed, because the git history
  can be changed and rebased. Here we alway run Travis-CI when `git diff`
  cannot return the modified files.
* Also do not push docs update if is not PaddlePaddle/Paddle.
avx_docs
Yu Yang 8 years ago
parent 0cdfa8cd6b
commit 2a5a8e79e5

@ -42,12 +42,15 @@ addons:
before_install:
- |
if [ ${JOB} == "BUILD_AND_TEST" ]; then
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(\.rst$)|(\.jpg$)|(\.png$)'
local change_list=`git diff --name-only $TRAVIS_COMMIT_RANGE`
if [ $? -eq 0 ]; then # if git diff return no zero, then rerun unit test.
if ! echo ${change_list} | grep -qvE '(\.md$)|(\.rst$)|(\.jpg$)|(\.png$)'
then
echo "Only markdown docs were updated, stopping build process."
exit
fi
fi
fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo paddle/scripts/travis/before_install.linux.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then paddle/scripts/travis/before_install.osx.sh; fi
- pip install wheel protobuf sphinx breathe recommonmark virtualenv numpy sphinx_rtd_theme

@ -47,6 +47,7 @@ if [ $? -eq 0 ]; then
fi
set -e
if [ -n $SSL_KEY ]; then # Only push updated docs for github.com/PaddlePaddle/Paddle.
# Commit
git add .
git config user.name "Travis CI"
@ -61,3 +62,5 @@ ssh-add deploy_key
# Push
git push $SSH_REPO $TARGET_BRANCH
fi

Loading…
Cancel
Save