Skip to content

Commit 7fffad3

Browse files
committed
Add set -e and improve Travis config
1 parent e27d378 commit 7fffad3

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

.travis.yml

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ install:
3232
if ! rustup component add rustfmt; then
3333
cargo install -Z install-upgrade --git https://github.com/rust-lang/rustfmt --bin rustfmt
3434
fi
35-
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
35+
if [[ "$TRAVIS_OS_NAME" == linux ]]; then
3636
. $HOME/.nvm/nvm.sh
3737
nvm install stable
3838
nvm use stable
3939
npm install remark-cli remark-lint
40-
fi
41-
if [ "$TRAVIS_OS_NAME" == "windows" ]; then
40+
elif [[ "$TRAVIS_OS_NAME" == windows ]]; then
4241
choco install windows-sdk-10.1
4342
fi
4443
fi
@@ -102,39 +101,44 @@ matrix:
102101

103102
script:
104103
- |
105-
if [ "$TRAVIS_BRANCH" == "auto" ] || [ "$TRAVIS_BRANCH" == "try" ]; then
106-
pr=$(echo $TRAVIS_COMMIT_MESSAGE | grep -o "#[0-9]*" | head -1 | sed 's/^#//g')
107-
output=$(curl -H "Authorization: token $GITHUB_API_TOKEN" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$pr" | \
104+
if [[ "$TRAVIS_BRANCH" == "auto" ]] || [[ "$TRAVIS_BRANCH" == "try" ]]; then
105+
PR=$(echo "$TRAVIS_COMMIT_MESSAGE" | grep -o "#[0-9]*" | head -1 | sed 's/^#//g')
106+
output=$(curl -H "Authorization: token $GITHUB_API_TOKEN" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
108107
python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
109108
grep "^changelog: " | \
110109
sed "s/changelog: //g")
111-
if [ -z "$output" ]; then
110+
if [[ -z "$output" ]]; then
112111
echo "ERROR: PR body must contain 'changelog: ...'"
113112
exit 1
114-
elif [ "$output" = "none" ]; then
113+
elif [[ "$output" = "none" ]]; then
115114
echo "WARNING: changelog is 'none'"
116115
fi
117116
fi
118117
- |
119-
rm rust-toolchain
120-
./setup-toolchain.sh
121-
if [ "$TRAVIS_OS_NAME" == "windows" ]; then
122-
export PATH=$PATH:$(rustc --print sysroot)/bin
123-
else
124-
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
125-
fi
118+
set -e
119+
rm rust-toolchain
120+
./setup-toolchain.sh
121+
if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
122+
export PATH=$PATH:$(rustc --print sysroot)/bin
123+
else
124+
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
125+
fi
126+
set +e
126127
- |
127-
if [ -z ${INTEGRATION} ]; then
128+
if [[ -z ${INTEGRATION} ]]; then
128129
travis_wait 30 ./ci/base-tests.sh && sleep 5
129130
else
130131
./ci/integration-tests.sh && sleep 5
131132
fi
132133
133-
after_success: |
134-
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
135-
if [ -z ${INTEGRATION} ]; then
136-
./.github/deploy.sh
137-
else
138-
echo "Not deploying, because we're in an integration test run"
134+
after_success:
135+
- |
136+
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
137+
if [[ -z ${INTEGRATION} ]]; then
138+
set -e
139+
./.github/deploy.sh
140+
set +e
141+
else
142+
echo "Not deploying, because we're in an integration test run"
143+
fi
139144
fi
140-
fi

0 commit comments

Comments
 (0)