Skip to content

Commit df5ac61

Browse files
committed
Add set -e and improve Travis config
1 parent 2b4e9ae commit df5ac61

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

.travis.yml

+30-26
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@ install:
3535
--git https://github.com/rust-lang/rustfmt \
3636
--bin rustfmt
3737
fi
38-
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
38+
if [[ "$TRAVIS_OS_NAME" == linux ]]; then
3939
. $HOME/.nvm/nvm.sh
4040
nvm install stable
4141
nvm use stable
4242
npm install remark-cli remark-lint
43-
fi
44-
if [ "$TRAVIS_OS_NAME" == "windows" ]; then
43+
elif [[ "$TRAVIS_OS_NAME" == windows ]]; then
4544
choco install windows-sdk-10.1
4645
fi
4746
fi
@@ -105,39 +104,44 @@ matrix:
105104

106105
script:
107106
- |
108-
if [ "$TRAVIS_BRANCH" == "auto" ] || [ "$TRAVIS_BRANCH" == "try" ]; then
109-
pr=$(echo $TRAVIS_COMMIT_MESSAGE | grep -o "#[0-9]*" | head -1 | sed 's/^#//g')
110-
output=$(curl -H "Authorization: token $GITHUB_API_TOKEN" -s "https://github.com/api/repos/rust-lang/rust-clippy/pulls/$pr" | \
111-
python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
112-
grep "^changelog: " | \
113-
sed "s/changelog: //g")
114-
if [ -z "$output" ]; then
107+
if [[ "$TRAVIS_BRANCH" == "auto" ]] || [[ "$TRAVIS_BRANCH" == "try" ]]; then
108+
PR=$(echo $TRAVIS_COMMIT_MESSAGE | grep -o "#[0-9]*" | head -1 | sed 's/^#//g')
109+
output=$(curl -H "Authorization: token $GITHUB_API_TOKEN" -s "https://github.com/api/repos/rust-lang/rust-clippy/pulls/$PR" \
110+
| python -c "import sys, json; print(json.load(sys.stdin)['body'])" \
111+
| grep "^changelog: " \
112+
| sed "s/changelog: //g")
113+
if [[ -z "$output" ]]; then
115114
echo "ERROR: PR body must contain 'changelog: ...'"
116115
exit 1
117-
elif [ "$output" = "none" ]; then
116+
elif [[ "$output" = "none" ]]; then
118117
echo "WARNING: changelog is 'none'"
119118
fi
120119
fi
121120
- |
122-
rm rust-toolchain
123-
./setup-toolchain.sh
124-
if [ "$TRAVIS_OS_NAME" == "windows" ]; then
125-
export PATH=$PATH:$(rustc --print sysroot)/bin
126-
else
127-
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
128-
fi
121+
set -e
122+
rm rust-toolchain
123+
./setup-toolchain.sh
124+
if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
125+
export PATH=$PATH:$(rustc --print sysroot)/bin
126+
else
127+
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
128+
fi
129+
set +e
129130
- |
130-
if [ -z ${INTEGRATION} ]; then
131+
if [[ -z ${INTEGRATION} ]]; then
131132
travis_wait 30 ./ci/base-tests.sh && sleep 5
132133
else
133134
./ci/integration-tests.sh && sleep 5
134135
fi
135136
136-
after_success: |
137-
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
138-
if [ -z ${INTEGRATION} ]; then
139-
./.github/deploy.sh
140-
else
141-
echo "Not deploying, because we're in an integration test run"
137+
after_success:
138+
- |
139+
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
140+
if [[ -z ${INTEGRATION} ]]; then
141+
set -e
142+
./.github/deploy.sh
143+
set +e
144+
else
145+
echo "Not deploying, because we're in an integration test run"
146+
fi
142147
fi
143-
fi

0 commit comments

Comments
 (0)