Skip to content

Commit 610d6f8

Browse files
committed
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.
1 parent e753bd4 commit 610d6f8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.travis.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,18 @@ rust:
2424

2525
before_script:
2626
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
27-
- cargo install --force cargo-travis && export PATH=$HOME/.cargo/bin:$PATH
27+
- export PATH=$HOME/.cargo/bin:$PATH
28+
# `cargo install` fails if the specified binary is already installed, and
29+
# doesn't yet support a `--if-not-installed` option [0], so for now assume
30+
# failures mean the package is already installed. If installation truly
31+
# failed, the build will fail later anyway, when we try to use the installed
32+
# binary. Note that `cargo install --force` is not a solution, as it always
33+
# rebuilds from scratch, ignoring the cache entirely.
34+
#
35+
# [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"
38+
- cargo install-update -a # updates cargo-travis, if the cached version is outdated
2839
- rustup component add clippy rustfmt
2940

3041
script:

0 commit comments

Comments
 (0)