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