]> git.lizzy.rs Git - rust.git/blob - .travis.yml
Auto merge of #4690 - lzutao:fix-test-on-non-amd64, r=flip1995
[rust.git] / .travis.yml
1 dist: xenial
2 language: bash
3 git:
4   depth: 1
5   quiet: true
6
7 branches:
8   # Don't build these branches
9   except:
10     # Used by bors
11     - trying.tmp
12     - staging.tmp
13
14 cache:
15   directories:
16     - $HOME/.cargo
17 before_cache:
18   - cargo install cargo-cache --debug
19   - find $HOME/.cargo/bin/ ! -type d -exec strip {} \;
20   - cargo cache --autoclean
21
22 env:
23  global:
24    - RUST_BACKTRACE=1
25    - secure: "OKulfkA5OGd/d1IhvBKzRkHQwMcWjzrzbimo7+5NhkUkWxndAzl+719TB3wWvIh1i2wXXrEXsyZkXM5FtRrHm55v1VKQ5ibjEvFg1w3NIg81iDyoLq186fLqywvxGkOAFPrsePPsBj5USd5xvhwwbrjO6L7/RK6Z8shBwOSc41s="
26
27 before_install:
28   - export CARGO_TARGET_DIR="$TRAVIS_BUILD_DIR/target"
29   - curl -sSL https://sh.rustup.rs | sh -s -- -y --default-toolchain=nightly --profile=minimal
30   - export PATH="$HOME/.cargo/bin:$PATH"
31 install:
32   - |
33     if [[ -z ${INTEGRATION} ]]; then
34       if ! rustup component add rustfmt; then
35         cargo install --git https://github.com/rust-lang/rustfmt --bin rustfmt
36       fi
37       if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
38         . $HOME/.nvm/nvm.sh
39         nvm install stable
40         nvm use stable
41         npm install remark-cli remark-lint
42       elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
43         choco install windows-sdk-10.1
44       fi
45     fi
46
47 # disabling the integration tests in forks should be done with
48 # if: fork = false
49 # but this is currently buggy travis-ci/travis-ci#9118
50 matrix:
51   fast_finish: true
52   include:
53     # Builds that are executed for every PR
54     - os: linux
55     # i686 toolchain could run on x86_64 system.
56     - os: linux
57       env: HOST_TOOLCHAIN=i686-unknown-linux-gnu
58       addons:
59         apt:
60           packages:
61             - gcc-multilib
62             - libssl-dev:i386     # openssl dev in Cargo.toml
63       if: branch IN (auto, try)
64     - os: windows
65       env: CARGO_INCREMENTAL=0 OS_WINDOWS=true
66
67     # Builds that are only executed when a PR is r+ed or a try build is started
68     # We don't want to run these always because they go towards
69     # the build limit within the Travis rust-lang account.
70     # The jobs are approximately sorted by execution time
71     - os: osx
72       if: branch IN (auto, try)
73     - env: INTEGRATION=rust-lang/rls
74       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
75     - env: INTEGRATION=rust-lang/cargo
76       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
77     - env: INTEGRATION=rust-lang/chalk
78       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
79     - env: INTEGRATION=Geal/nom
80       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
81     - env: INTEGRATION=rust-lang/rustfmt
82       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
83     - env: INTEGRATION=hyperium/hyper
84       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
85     - env: INTEGRATION=bluss/rust-itertools
86       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
87     # FIXME: rustc ICE on `serde_test_suite`
88     # - env: INTEGRATION=serde-rs/serde
89     #   if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
90     - env: INTEGRATION=rust-lang-nursery/stdsimd
91       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
92     - env: INTEGRATION=rust-random/rand
93       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
94     - env: INTEGRATION=rust-lang-nursery/futures-rs
95       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
96     - env: INTEGRATION=Marwes/combine
97       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
98     - env: INTEGRATION=rust-lang-nursery/failure
99       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
100     - env: INTEGRATION=rust-lang-nursery/log
101       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
102     - env: INTEGRATION=chronotope/chrono
103       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
104   allow_failures:
105     - os: windows
106       env: CARGO_INCREMENTAL=0 OS_WINDOWS=true
107
108 before_script:
109   - |
110     if [[ "$TRAVIS_BRANCH" == "auto" ]] || [[ "$TRAVIS_BRANCH" == "try" ]]; then
111       PR=$(echo "$TRAVIS_COMMIT_MESSAGE" | grep -o "#[0-9]*" | head -1 | sed 's/^#//g')
112       output=$(curl -H "Authorization: token $GITHUB_API_TOKEN" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
113         python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
114         grep "^changelog: " | \
115         sed "s/changelog: //g")
116       if [[ -z "$output" ]]; then
117         echo "ERROR: PR body must contain 'changelog: ...'"
118         exit 1
119       elif [[ "$output" = "none" ]]; then
120         echo "WARNING: changelog is 'none'"
121       fi
122     fi
123   - |
124     rm rust-toolchain
125     ./setup-toolchain.sh
126   - |
127     SYSROOT=$(rustc --print sysroot)
128     case "$TRAVIS_OS_NAME" in
129       windows ) export PATH="${SYSROOT}/bin:${PATH}" ;;
130       linux ) export LD_LIBRARY_PATH="${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" ;;
131       osx )
132         # See <https://github.com/nteract/nteract/issues/1523#issuecomment-301623519>
133         sudo mkdir -p /usr/local/lib
134         sudo find "$SYSROOT/lib" -maxdepth 1 -name '*.dylib' -exec ln -s {} /usr/local/lib \;
135         ;;
136     esac
137
138 script:
139   - |
140     if [[ -n ${INTEGRATION} ]]; then
141       cargo test --test integration --features integration && sleep 5
142     else
143       ./ci/base-tests.sh && sleep 5
144     fi
145
146 after_success:
147   - |
148     if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
149       set -e
150       if [[ -z ${INTEGRATION} ]]; then
151         ./.github/deploy.sh
152       else
153         echo "Not deploying, because we're in an integration test run"
154       fi
155       set +e
156     fi