Skip to content

Commit b3f0fa6

Browse files
committed
Add set -e and improve Travis config
1 parent 2439a87 commit b3f0fa6

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

.travis.yml

Lines changed: 9 additions & 10 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,32 +101,32 @@ matrix:
102101

103102
before_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
- |
119118
rm rust-toolchain
120119
./setup-toolchain.sh
121120
- |
122-
if [ "$TRAVIS_OS_NAME" == "windows" ]; then
121+
if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
123122
export PATH=$PATH:$(rustc --print sysroot)/bin
124123
else
125124
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
126125
fi
127126
128127
script:
129128
- |
130-
if [ -z ${INTEGRATION} ]; then
129+
if [[ -z ${INTEGRATION} ]]; then
131130
travis_wait 30 ./ci/base-tests.sh && sleep 5
132131
else
133132
./ci/integration-tests.sh && sleep 5

0 commit comments

Comments
 (0)