Skip to content

Commit f1afb8f

Browse files
committed
Only install diesel on CI if the binary isn't cached
The CI build cache is currently updated with every build, even if there are no changes. This is because running `cargo install` will update the index causing some files under `$HOME/.cargo` to be updated, invalidating the cache. The drawback is that if we bump the diesel version, then the CLI will not be automatically updated. However, even an old version of the CLI application is expected to be able to run our migrations on CI and the cache can always be cleared if a new version is needed.
1 parent 3e852e2 commit f1afb8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ env:
1313
- JOBS=1 # See https://git.io/vdao3 for details.
1414
- DATABASE_URL=postgres://postgres:@localhost/cargo_registry_test
1515
- TEST_DATABASE_URL=postgres://postgres:@localhost/cargo_registry_test
16-
- CARGO_TARGET_DIR=target
1716
- CARGO_INCREMENTAL=0
1817
- PERCY_PARALLEL_TOTAL=2
1918
# Percy secrets are included here to enable Percy's GitHub integration
2019
# on community-submitted PRs
2120
- PERCY_TOKEN=0d8707a02b19aebbec79bb0bf302b8d2fa95edb33169cfe41b084289596670b1
2221
- PERCY_PROJECT=crates-io/crates.io
2322
- PGPORT=5433
23+
- PATH=$HOME/.cargo/bin:$PATH
2424

2525
install:
2626
- sudo cp /etc/postgresql/10/main/pg_hba.conf /etc/postgresql/11/main/pg_hba.conf
2727
- sudo systemctl restart postgresql@11-main
2828
- script/ci/cargo-clean-on-new-rustc-version.sh
29-
- cargo install --force diesel_cli --vers `cat .diesel_version` --no-default-features --features postgres && export PATH=$HOME/.cargo/bin:$PATH
29+
- which diesel || cargo install diesel_cli --vers `cat .diesel_version` --no-default-features --features postgres
3030

3131
before_script:
3232
- diesel database setup --locked-schema

0 commit comments

Comments
 (0)