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 14, 2019
1 parent e27d378 commit 7fffad3
Showing 1 changed file with 27 additions and 23 deletions.
50 changes: 27 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ install:
if ! rustup component add rustfmt; then
cargo install -Z install-upgrade --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 @@ -102,39 +101,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" | \
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 [[ -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 7fffad3

Please sign in to comment.