diff --git a/.travis.yml b/.travis.yml index 7c3734887c4d..9baa394834dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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