Improve CI caching

We weren't making very effective use of the cache before, leading to
10m+ builds, as `cargo install --force` always busts the cache.
This commit is contained in:
Nikhil Benesch 2019-06-03 12:27:47 -04:00
parent e753bd4f90
commit 610d6f8304
No known key found for this signature in database
GPG key ID: FCF98542083C5A69

View file

@ -24,7 +24,18 @@ rust:
before_script:
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
- cargo install --force cargo-travis && export PATH=$HOME/.cargo/bin:$PATH
- export PATH=$HOME/.cargo/bin:$PATH
# `cargo install` fails if the specified binary is already installed, and
# doesn't yet support a `--if-not-installed` option [0], so for now assume
# failures mean the package is already installed. If installation truly
# failed, the build will fail later anyway, when we try to use the installed
# binary. Note that `cargo install --force` is not a solution, as it always
# rebuilds from scratch, ignoring the cache entirely.
#
# [0]: https://github.com/rust-lang/cargo/issues/2082
- cargo install cargo-update || echo "cargo-update already installed"
- cargo install cargo-travis || echo "cargo-travis already installed"
- cargo install-update -a # updates cargo-travis, if the cached version is outdated
- rustup component add clippy rustfmt
script: