|
1 | 1 | sudo: false |
2 | 2 | dist: trusty |
| 3 | + |
3 | 4 | language: rust |
4 | 5 | cache: cargo |
5 | | -rust: |
6 | | - - stable |
7 | | - - nightly-2018-01-20 |
8 | 6 |
|
9 | 7 | env: |
10 | 8 | global: |
11 | | - # Versions known to work with pinned nightly. |
12 | | - - CLIPPY_VERSION=0.0.180 |
13 | | - - RUSTFMT_VERSION=0.3.6 |
14 | | - |
15 | | -before_script: |
16 | | - - export PATH=$HOME/.cargo/bin:$PATH |
17 | | - - | |
18 | | - if ! type -p cargo-install-update; then |
19 | | - cargo install --force cargo-update |
20 | | - else |
21 | | - cargo install-update -i cargo-update |
22 | | - fi |
23 | | - - | |
24 | | - if [[ $TRAVIS_RUST_VERSION =~ nightly-* ]]; then |
25 | | - cargo install-update -i "clippy:$CLIPPY_VERSION" |
26 | | - cargo install-update -i "rustfmt-nightly:$RUSTFMT_VERSION" |
27 | | - fi |
28 | | -script: |
29 | | - - | |
30 | | - RUSTFLAGS=-Dwarnings cargo build && |
31 | | - cargo test |
32 | | - - | |
33 | | - [[ ! $TRAVIS_RUST_VERSION =~ nightly-* ]] || RUSTFLAGS=-Dwarnings cargo fmt -- --write-mode diff |
34 | | - - | |
35 | | - [[ ! $TRAVIS_RUST_VERSION =~ nightly-* ]] || RUSTFLAGS=-Dwarnings cargo clippy |
| 9 | + - RUSTFLAGS=-Dwarnings |
| 10 | + |
| 11 | + # Versions known to work with pinned nightly for lints. |
| 12 | + - CLIPPY_VERSION=0.0.187 |
| 13 | + |
| 14 | +matrix: |
| 15 | + include: |
| 16 | + # Tests on all the channels |
| 17 | + - env: TASK=test |
| 18 | + rust: stable |
| 19 | + - env: TASK=test |
| 20 | + rust: beta |
| 21 | + - env: TASK=test |
| 22 | + rust: nightly |
| 23 | + |
| 24 | + # Execute lints with the pinned nightly we know works. |
| 25 | + - env: TASK=lint |
| 26 | + rust: nightly-2018-03-07 |
| 27 | + |
| 28 | + # Don't block CI if a nightly is faulty |
| 29 | + fast_finish: true |
| 30 | + allow_failures: |
| 31 | + - rust: nightly |
| 32 | + |
| 33 | +before_script: | |
| 34 | + if [[ $TASK = "lint" ]]; then |
| 35 | + if ! type -p cargo-install-update; then |
| 36 | + cargo install --force cargo-update |
| 37 | + else |
| 38 | + cargo install-update -i cargo-update |
| 39 | + fi |
| 40 | +
|
| 41 | + rustup component add rustfmt-preview |
| 42 | + cargo install-update -i "clippy:$CLIPPY_VERSION" |
| 43 | + fi |
| 44 | +
|
| 45 | +script: | |
| 46 | + if [[ $TASK = "lint" ]]; then |
| 47 | + cargo fmt -- --write-mode diff |
| 48 | + cargo clippy |
| 49 | + elif [[ $TASK = "test" ]]; then |
| 50 | + cargo build && cargo test |
| 51 | + fi |
0 commit comments