Skip to content

Commit

Permalink
Add set -e and improve Travis config
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Oct 13, 2019
1 parent 2b4e9ae commit df5ac61
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ install:
--git https://github.com/rust-lang/rustfmt \
--bin rustfmt
fi
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
if [[ "$TRAVIS_OS_NAME" == linux ]]; then
. $HOME/.nvm/nvm.sh
nvm install stable
nvm use stable
npm install remark-cli remark-lint
fi
if [ "$TRAVIS_OS_NAME" == "windows" ]; then
elif [[ "$TRAVIS_OS_NAME" == windows ]]; then
choco install windows-sdk-10.1
fi
fi
Expand Down Expand Up @@ -105,39 +104,44 @@ matrix:

script:
- |
if [ "$TRAVIS_BRANCH" == "auto" ] || [ "$TRAVIS_BRANCH" == "try" ]; then
pr=$(echo $TRAVIS_COMMIT_MESSAGE | grep -o "#[0-9]*" | head -1 | sed 's/^#//g')
output=$(curl -H "Authorization: token $GITHUB_API_TOKEN" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$pr" | \
python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
grep "^changelog: " | \
sed "s/changelog: //g")
if [ -z "$output" ]; then
if [[ "$TRAVIS_BRANCH" == "auto" ]] || [[ "$TRAVIS_BRANCH" == "try" ]]; then
PR=$(echo $TRAVIS_COMMIT_MESSAGE | grep -o "#[0-9]*" | head -1 | sed 's/^#//g')
output=$(curl -H "Authorization: token $GITHUB_API_TOKEN" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" \
| python -c "import sys, json; print(json.load(sys.stdin)['body'])" \
| grep "^changelog: " \
| sed "s/changelog: //g")
if [[ -z "$output" ]]; then
echo "ERROR: PR body must contain 'changelog: ...'"
exit 1
elif [ "$output" = "none" ]; then
elif [[ "$output" = "none" ]]; then
echo "WARNING: changelog is 'none'"
fi
fi
- |
rm rust-toolchain
./setup-toolchain.sh
if [ "$TRAVIS_OS_NAME" == "windows" ]; then
export PATH=$PATH:$(rustc --print sysroot)/bin
else
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
fi
set -e
rm rust-toolchain
./setup-toolchain.sh
if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
export PATH=$PATH:$(rustc --print sysroot)/bin
else
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
fi
set +e
- |
if [ -z ${INTEGRATION} ]; then
if [[ -z ${INTEGRATION} ]]; then
travis_wait 30 ./ci/base-tests.sh && sleep 5
else
./ci/integration-tests.sh && sleep 5
fi
after_success: |
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
if [ -z ${INTEGRATION} ]; then
./.github/deploy.sh
else
echo "Not deploying, because we're in an integration test run"
after_success:
- |
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
if [[ -z ${INTEGRATION} ]]; then
set -e
./.github/deploy.sh
set +e
else
echo "Not deploying, because we're in an integration test run"
fi
fi
fi

0 comments on commit df5ac61

Please sign in to comment.