]> git.lizzy.rs Git - rust.git/blob - .travis.yml
Auto merge of #4659 - lzutao:caching, r=phansch
[rust.git] / .travis.yml
1 dist: xenial
2 language: minimal
3
4 os:
5   - linux
6   - osx
7   - windows
8
9 branches:
10   # Don't build these branches
11   except:
12     # Used by bors
13     - trying.tmp
14     - staging.tmp
15
16 cache:
17   directories:
18     - $HOME/.cargo
19 before_cache:
20   - cargo install -Z install-upgrade cargo-cache --debug
21   - cargo cache --autoclean
22
23 env:
24  global:
25    - RUST_BACKTRACE=1
26    - secure: "OKulfkA5OGd/d1IhvBKzRkHQwMcWjzrzbimo7+5NhkUkWxndAzl+719TB3wWvIh1i2wXXrEXsyZkXM5FtRrHm55v1VKQ5ibjEvFg1w3NIg81iDyoLq186fLqywvxGkOAFPrsePPsBj5USd5xvhwwbrjO6L7/RK6Z8shBwOSc41s="
27
28 before_install:
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 -Z install-upgrade --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       fi
43       if [ "$TRAVIS_OS_NAME" == "windows" ]; then
44         choco install windows-sdk-10.1
45       fi
46     fi
47
48 # disabling the integration tests in forks should be done with
49 # if: fork = false
50 # but this is currently buggy travis-ci/travis-ci#9118
51 matrix:
52   fast_finish: true
53   include:
54     # Builds that are executed for every PR
55     - os: osx # run base tests on both platforms
56       env: BASE_TESTS=true
57     - os: linux
58       env: BASE_TESTS=true
59     - os: windows
60       env: CARGO_INCREMENTAL=0 BASE_TESTS=true OS_WINDOWS=true
61
62     # Builds that are only executed when a PR is r+ed or a try build is started
63     # We don't want to run these always because they go towards
64     # the build limit within the Travis rust-lang account.
65     # The jobs are approximately sorted by execution time
66     - env: INTEGRATION=rust-lang/cargo
67       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
68     - env: INTEGRATION=rust-lang-nursery/chalk
69       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
70     - env: INTEGRATION=rust-lang/rls
71       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
72     - env: INTEGRATION=Geal/nom
73       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
74     - env: INTEGRATION=rust-lang/rustfmt
75       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
76     - env: INTEGRATION=hyperium/hyper
77       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
78     - env: INTEGRATION=bluss/rust-itertools
79       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
80     - env: INTEGRATION=serde-rs/serde
81       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
82     - env: INTEGRATION=rust-lang-nursery/stdsimd
83       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
84     - env: INTEGRATION=rust-random/rand
85       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
86     - env: INTEGRATION=rust-lang-nursery/futures-rs
87       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
88     - env: INTEGRATION=Marwes/combine
89       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
90     - env: INTEGRATION=rust-lang-nursery/failure
91       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
92     - env: INTEGRATION=rust-lang-nursery/log
93       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
94     - env: INTEGRATION=chronotope/chrono
95       if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
96   allow_failures:
97     - os: windows
98       env: CARGO_INCREMENTAL=0 BASE_TESTS=true OS_WINDOWS=true
99   # prevent these jobs with default env vars
100   exclude:
101     - os: linux
102     - os: osx
103     - os: windows
104
105 before_script:
106   - |
107     if [ "$TRAVIS_BRANCH" == "auto" ] || [ "$TRAVIS_BRANCH" == "try" ]; then
108       pr=$(echo $TRAVIS_COMMIT_MESSAGE | grep -o "#[0-9]*" | head -1 | sed 's/^#//g')
109       output=$(curl -H "Authorization: token $GITHUB_API_TOKEN" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$pr" | \
110         python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
111         grep "^changelog: " | \
112         sed "s/changelog: //g")
113       if [ -z "$output" ]; then
114         echo "ERROR: PR body must contain 'changelog: ...'"
115         exit 1
116       elif [ "$output" = "none" ]; then
117         echo "WARNING: changelog is 'none'"
118       fi
119     fi
120   - |
121     rm rust-toolchain
122     ./setup-toolchain.sh
123   - |
124     if [ "$TRAVIS_OS_NAME" == "windows" ]; then
125       export PATH=$PATH:$(rustc --print sysroot)/bin
126     else
127       export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
128     fi
129
130 script:
131   - |
132     if [ -z ${INTEGRATION} ]; then
133       travis_wait 30 ./ci/base-tests.sh && sleep 5
134     else
135       ./ci/integration-tests.sh && sleep 5
136     fi
137
138 after_success:
139   - |
140     if [ "$TRAVIS_OS_NAME" == "linux" ]; then
141       set -e
142       if [ -z ${INTEGRATION} ]; then
143         ./.github/deploy.sh
144       else
145         echo "Not deploying, because we're in an integration test run"
146       fi
147       set +e
148     fi