]> git.lizzy.rs Git - rust.git/blob - .travis.yml
Auto merge of #4543 - xiongmao86:issue4503, 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   - |
30     case "$TRAVIS_OS_NAME" in
31       linux ) HOST=x86_64-unknown-linux-gnu;;
32       osx ) HOST=x86_64-apple-darwin;;
33       windows ) HOST=x86_64-pc-windows-msvc;;
34     esac
35   - curl -sSL https://sh.rustup.rs | sh -s -- -y --default-host="$HOST" --default-toolchain=nightly --profile=minimal
36   - export PATH="$HOME/.cargo/bin:$PATH"
37 install:
38   - |
39     if [[ -z ${INTEGRATION} ]]; then
40       if ! rustup component add rustfmt; then
41         TARGET=$(rustc -Vv | awk '/host/{print $2}')
42         NIGHTLY=$(curl -s "https://rust-lang.github.io/rustup-components-history/${TARGET}/rustfmt")
43         curl -sSL "https://static.rust-lang.org/dist/${NIGHTLY}/rustfmt-nightly-${TARGET}.tar.xz" | \
44         tar -xJf - --strip-components=3 -C ~/.cargo/bin
45         rm -rf ~/.cargo/bin/doc
46       fi
47       if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
48         . $HOME/.nvm/nvm.sh
49         nvm install stable
50         nvm use stable
51         npm install remark-cli remark-lint
52       elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
53         choco install windows-sdk-10.1
54       fi
55     fi
56
57 # disabling the integration tests in forks should be done with
58 # if: fork = false
59 # but this is currently buggy travis-ci/travis-ci#9118
60 matrix:
61   fast_finish: true
62   include:
63     # Builds that are executed for every PR
64     - os: linux
65     # i686 toolchain could run on x86_64 system.
66     - os: linux
67       env: HOST_TOOLCHAIN=i686-unknown-linux-gnu
68       addons:
69         apt:
70           packages:
71             - gcc-multilib
72             - libssl-dev:i386     # openssl dev in Cargo.toml
73       if: branch IN (auto, try)
74     - os: windows
75       env: CARGO_INCREMENTAL=0 OS_WINDOWS=true
76
77     # Builds that are only executed when a PR is r+ed or a try build is started
78     # We don't want to run these always because they go towards
79     # the build limit within the Travis rust-lang account.
80     # The jobs are approximately sorted by execution time
81     - os: osx
82       if: branch IN (auto, try)
83     - env: INTEGRATION=rust-lang/rls
84       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
85     - env: INTEGRATION=rust-lang/cargo
86       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
87     - env: INTEGRATION=rust-lang/chalk
88       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
89     - env: INTEGRATION=Geal/nom
90       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
91     - env: INTEGRATION=rust-lang/rustfmt
92       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
93     - env: INTEGRATION=hyperium/hyper
94       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
95     - env: INTEGRATION=rust-itertools/itertools
96       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
97     # FIXME: rustc ICE on `serde_test_suite`
98     # - env: INTEGRATION=serde-rs/serde
99     #   if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
100     - env: INTEGRATION=rust-lang/stdarch
101       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
102     - env: INTEGRATION=rust-random/rand
103       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
104     - env: INTEGRATION=rust-lang/futures-rs
105       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
106     - env: INTEGRATION=Marwes/combine
107       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
108     - env: INTEGRATION=rust-lang-nursery/failure
109       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
110     - env: INTEGRATION=rust-lang/log
111       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
112     - env: INTEGRATION=chronotope/chrono
113       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
114   allow_failures:
115     - os: windows
116       env: CARGO_INCREMENTAL=0 OS_WINDOWS=true
117
118 before_script:
119   - |
120     if [[ "$TRAVIS_BRANCH" == "auto" ]] || [[ "$TRAVIS_BRANCH" == "try" ]]; then
121       PR=$(echo "$TRAVIS_COMMIT_MESSAGE" | grep -o "#[0-9]*" | head -1 | sed 's/^#//g')
122       output=$(curl -H "Authorization: token $GITHUB_API_TOKEN" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
123         python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
124         grep "^changelog: " | \
125         sed "s/changelog: //g")
126       if [[ -z "$output" ]]; then
127         echo "ERROR: PR body must contain 'changelog: ...'"
128         exit 1
129       elif [[ "$output" = "none" ]]; then
130         echo "WARNING: changelog is 'none'"
131       fi
132     fi
133   - |
134     rm rust-toolchain
135     ./setup-toolchain.sh
136   - |
137     SYSROOT=$(rustc --print sysroot)
138     case "$TRAVIS_OS_NAME" in
139       windows ) export PATH="${SYSROOT}/bin:${PATH}" ;;
140       linux ) export LD_LIBRARY_PATH="${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" ;;
141       osx )
142         # See <https://github.com/nteract/nteract/issues/1523#issuecomment-301623519>
143         sudo mkdir -p /usr/local/lib
144         sudo find "$SYSROOT/lib" -maxdepth 1 -name '*.dylib' -exec ln -s {} /usr/local/lib \;
145         ;;
146     esac
147
148 script:
149   - |
150     if [[ -n ${INTEGRATION} ]]; then
151       cargo test --test integration --features integration && sleep 5
152     else
153       ./ci/base-tests.sh && sleep 5
154     fi
155
156 after_success:
157   - |
158     if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
159       set -e
160       if [[ -z ${INTEGRATION} ]]; then
161         ./.github/deploy.sh
162       else
163         echo "Not deploying, because we're in an integration test run"
164       fi
165       set +e
166     fi