Skip to content

Commit dcc624c

Browse files
committed
Make CI handle missing rustfmt in the nightly
1 parent 4ce0eb1 commit dcc624c

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

.travis.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ rust:
2323
- stable
2424

2525
before_script:
26+
# Travis installs rust with a non-default "minimal" profile, and advises us
27+
# to add clippy manually:
28+
- rustup component add clippy
29+
# Unfortunately, this method often breaks on the nightly channel, where the
30+
# most recent build might not have all the optional components.
31+
# We explicitly specify `--profile default` to obtain the most recent nightly
32+
# that has rustfmt (we don't care if it's a week old, as we need it only for
33+
# an experimental flag):
34+
- rustup toolchain install nightly --profile default
35+
2636
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
2737
- export PATH=$HOME/.cargo/bin:$PATH
2838
# `cargo install` fails if the specified binary is already installed, and
@@ -33,13 +43,9 @@ before_script:
3343
# rebuilds from scratch, ignoring the cache entirely.
3444
#
3545
# [0]: https://github.com/rust-lang/cargo/issues/2082
36-
- cargo install cargo-update || echo "cargo-update already installed"
37-
- cargo install cargo-travis || echo "cargo-travis already installed"
46+
- cargo install cargo-update || echo "cargo-update already installed" # for `cargo install-update`
47+
- cargo install cargo-travis || echo "cargo-travis already installed" # for `cargo coveralls`
3848
- cargo install-update -a # updates cargo-travis, if the cached version is outdated
39-
- rustup component add clippy
40-
# The license_template_path setting we use to verify copyright headers is
41-
# only available on the nightly rustfmt.
42-
- rustup toolchain install nightly && rustup component add --toolchain nightly rustfmt
4349

4450
script:
4551
# Clippy must be run first, as its lints are only triggered during
@@ -50,6 +56,8 @@ script:
5056
- travis-cargo build
5157
- travis-cargo test
5258
- travis-cargo test -- all-features
59+
# The license_template_path setting we use to verify copyright headers is
60+
# only available on the nightly rustfmt.
5361
- cargo +nightly fmt -- --check --config-path <(echo 'license_template_path = "HEADER"')
5462

5563
after_success:

0 commit comments

Comments
 (0)