From 3e852e2356179f92d1bac183df2eaa5d25ac4ccc Mon Sep 17 00:00:00 2001 From: Justin Geibel Date: Sat, 16 Nov 2019 14:14:11 -0500 Subject: [PATCH 1/4] Disable incremental compilation on CI For some reason, incremental files are changing on CI even when no code changes. Turning off incremental compilation should help avoid uploading a new cache with every single build. This commit also removes `target/.rustc_info.json` from the CI cache --- .travis.yml | 1 + script/ci/prune-cache.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 390390317d..0606c6149a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ env: - DATABASE_URL=postgres://postgres:@localhost/cargo_registry_test - TEST_DATABASE_URL=postgres://postgres:@localhost/cargo_registry_test - CARGO_TARGET_DIR=target + - CARGO_INCREMENTAL=0 - PERCY_PARALLEL_TOTAL=2 # Percy secrets are included here to enable Percy's GitHub integration # on community-submitted PRs diff --git a/script/ci/prune-cache.sh b/script/ci/prune-cache.sh index 6e04ef7010..79a349e91f 100755 --- a/script/ci/prune-cache.sh +++ b/script/ci/prune-cache.sh @@ -25,5 +25,7 @@ for name in $bin_names; do rm -v target/debug/deps/$normalized-* done +rm -v target/.rustc_info.json + echo "Final cache size:" du -hs target/debug From f1afb8f95b563f2b47793158ec0d7202096bb03e Mon Sep 17 00:00:00 2001 From: Justin Geibel Date: Sun, 17 Nov 2019 01:11:22 -0500 Subject: [PATCH 2/4] 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. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0606c6149a..77ecda7831 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,6 @@ env: - JOBS=1 # See https://git.io/vdao3 for details. - DATABASE_URL=postgres://postgres:@localhost/cargo_registry_test - TEST_DATABASE_URL=postgres://postgres:@localhost/cargo_registry_test - - CARGO_TARGET_DIR=target - CARGO_INCREMENTAL=0 - PERCY_PARALLEL_TOTAL=2 # Percy secrets are included here to enable Percy's GitHub integration @@ -21,12 +20,13 @@ env: - PERCY_TOKEN=0d8707a02b19aebbec79bb0bf302b8d2fa95edb33169cfe41b084289596670b1 - PERCY_PROJECT=crates-io/crates.io - PGPORT=5433 + - PATH=$HOME/.cargo/bin:$PATH install: - sudo cp /etc/postgresql/10/main/pg_hba.conf /etc/postgresql/11/main/pg_hba.conf - sudo systemctl restart postgresql@11-main - script/ci/cargo-clean-on-new-rustc-version.sh - - cargo install --force diesel_cli --vers `cat .diesel_version` --no-default-features --features postgres && export PATH=$HOME/.cargo/bin:$PATH + - which diesel || cargo install diesel_cli --vers `cat .diesel_version` --no-default-features --features postgres before_script: - diesel database setup --locked-schema From 5e86f7b372afed4e4393633b3ed8022ba044a645 Mon Sep 17 00:00:00 2001 From: Justin Geibel Date: Sun, 17 Nov 2019 01:21:48 -0500 Subject: [PATCH 3/4] Disable debug info on CI This is an attempt to further decrease the cache size on CI. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 77ecda7831..e1ced372fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ env: - PERCY_PROJECT=crates-io/crates.io - PGPORT=5433 - PATH=$HOME/.cargo/bin:$PATH + - RUSTFLAGS="-C debuginfo=0" install: - sudo cp /etc/postgresql/10/main/pg_hba.conf /etc/postgresql/11/main/pg_hba.conf From 45675ec599a27686a9ebbb4bffc76d5662be639c Mon Sep 17 00:00:00 2001 From: Justin Geibel Date: Sun, 17 Nov 2019 01:28:40 -0500 Subject: [PATCH 4/4] Run `cargo clean` on CI The change to `RUSTFLAGS` changes build hashes, so wiping the target directory and doing a full rebuild. --- script/ci/cargo-clean-on-new-rustc-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/ci/cargo-clean-on-new-rustc-version.sh b/script/ci/cargo-clean-on-new-rustc-version.sh index 8cbda26267..af510fdf26 100755 --- a/script/ci/cargo-clean-on-new-rustc-version.sh +++ b/script/ci/cargo-clean-on-new-rustc-version.sh @@ -3,7 +3,7 @@ set -e manual_stamp_file=target/ci_manual_stamp -manual_stamp=7 # Change this to force a clean build on CI +manual_stamp=8 # Change this to force a clean build on CI if [ -f $manual_stamp_file ]; then if echo "$manual_stamp" | cmp -s $manual_stamp_file -; then