Skip to content

Commit f66196a

Browse files
authored
Merge pull request #826 from reyoung/feature/fix_travis_build_when_rebase
Fix Travis-CI when using rebase.
2 parents 6e131b7 + 2a5a8e7 commit f66196a

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

.travis.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ addons:
4242
before_install:
4343
- |
4444
if [ ${JOB} == "BUILD_AND_TEST" ]; then
45-
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(\.rst$)|(\.jpg$)|(\.png$)'
46-
then
47-
echo "Only markdown docs were updated, stopping build process."
48-
exit
45+
local change_list=`git diff --name-only $TRAVIS_COMMIT_RANGE`
46+
if [ $? -eq 0 ]; then # if git diff return no zero, then rerun unit test.
47+
if ! echo ${change_list} | grep -qvE '(\.md$)|(\.rst$)|(\.jpg$)|(\.png$)'
48+
then
49+
echo "Only markdown docs were updated, stopping build process."
50+
exit
51+
fi
4952
fi
5053
fi
5154
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo paddle/scripts/travis/before_install.linux.sh; fi

paddle/scripts/travis/docs.sh

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,20 @@ if [ $? -eq 0 ]; then
4747
fi
4848
set -e
4949

50-
# Commit
51-
git add .
52-
git config user.name "Travis CI"
53-
git config user.email "[email protected]"
54-
git commit -m "Deploy to GitHub Pages: ${SHA}"
55-
56-
# Set ssh private key
57-
openssl aes-256-cbc -K $SSL_KEY -iv $SSL_IV -in ../../paddle/scripts/travis/deploy_key.enc -out deploy_key -d
58-
chmod 600 deploy_key
59-
eval `ssh-agent -s`
60-
ssh-add deploy_key
61-
62-
# Push
63-
git push $SSH_REPO $TARGET_BRANCH
50+
if [ -n $SSL_KEY ]; then # Only push updated docs for github.com/PaddlePaddle/Paddle.
51+
# Commit
52+
git add .
53+
git config user.name "Travis CI"
54+
git config user.email "[email protected]"
55+
git commit -m "Deploy to GitHub Pages: ${SHA}"
56+
57+
# Set ssh private key
58+
openssl aes-256-cbc -K $SSL_KEY -iv $SSL_IV -in ../../paddle/scripts/travis/deploy_key.enc -out deploy_key -d
59+
chmod 600 deploy_key
60+
eval `ssh-agent -s`
61+
ssh-add deploy_key
62+
63+
# Push
64+
git push $SSH_REPO $TARGET_BRANCH
65+
66+
fi

0 commit comments

Comments
 (0)