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