From 6a0834867f079771b8605fa8049c7d06007af149 Mon Sep 17 00:00:00 2001 From: Justin Geibel Date: Tue, 18 Dec 2018 21:03:15 -0500 Subject: [PATCH 1/5] Prune some build artifacts on CI to speed up caching This script deletes final build artifacts, which are often large and cannot be reused if any backend code has changed. Dependencies and incremental artifacts are left in place. --- .travis.yml | 1 + script/ci/prune-cache.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 script/ci/prune-cache.sh diff --git a/.travis.yml b/.travis.yml index 037ab49de21..89d0f8b2ae9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ cache: - $HOME/.npm # Set timeout to 6 minutes (double the default of 3 minutes) timeout: 360 +before_cache: script/ci/prune-cache.sh env: global: diff --git a/script/ci/prune-cache.sh b/script/ci/prune-cache.sh new file mode 100755 index 00000000000..852f9a01050 --- /dev/null +++ b/script/ci/prune-cache.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -e + +echo "Initial cache size:" +du -hs target/debug + +crate_name="cargo-registry" +test_name="all" +bin_names="delete-crate delete-version populate render-readmes server test-pagerduty transfer-crates update-downloads" + +normalized_crate_name=${crate_name//-/_} +rm -v target/debug/$normalized_crate_name-* +rm -v target/debug/deps/$normalized_crate_name-* +rm -v target/debug/deps/lib$normalized_crate_name-* + +normalized_test_name=${test_name//-/_} +rm -v target/debug/$normalized_test_name-* +rm -v target/debug/deps/$normalized_test_name-* + +for name in $bin_names; do + rm -v target/debug/$name + normalized=${name//-/_} + rm -v target/debug/$normalized-* + rm -v target/debug/deps/$normalized-* +done + +echo "Final cache size:" +du -hs target/debug From 8f14a14f789d8ec3759bf02f3440ee7456ec70aa Mon Sep 17 00:00:00 2001 From: Justin Geibel Date: Tue, 18 Dec 2018 22:10:23 -0500 Subject: [PATCH 2/5] Move the other CI script to `script/ci/` --- .travis.yml | 2 +- script/{ => ci}/cargo-clean-on-new-rustc-version.sh | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename script/{ => ci}/cargo-clean-on-new-rustc-version.sh (100%) diff --git a/.travis.yml b/.travis.yml index 89d0f8b2ae9..edb8f445d64 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ env: - PERCY_PROJECT=crates-io/crates.io install: - - script/cargo-clean-on-new-rustc-version.sh + - 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 before_script: diff --git a/script/cargo-clean-on-new-rustc-version.sh b/script/ci/cargo-clean-on-new-rustc-version.sh similarity index 100% rename from script/cargo-clean-on-new-rustc-version.sh rename to script/ci/cargo-clean-on-new-rustc-version.sh From 404c1e67210ba714493f988886f9551c7f86f7f1 Mon Sep 17 00:00:00 2001 From: Justin Geibel Date: Thu, 20 Dec 2018 00:03:01 -0500 Subject: [PATCH 3/5] Switch to `npm ci` as the install command --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index edb8f445d64..e563cae716e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,6 +54,7 @@ matrix: - rust: stable before_install: - nvm install 10 + - npm ci - rustup component add rustfmt-preview - rustup component add clippy-preview script: @@ -61,7 +62,6 @@ matrix: - cargo clippy --all-targets --all-features --all - cargo build - cargo test - - npm install - npm test - rust: beta script: From 4451a659ee1456a49d81a14a0353184ae24cba14 Mon Sep 17 00:00:00 2001 From: Justin Geibel Date: Fri, 21 Dec 2018 19:35:10 -0500 Subject: [PATCH 4/5] Skip explicit run of `cargo build` on CI Running `cargo test` produces a set of normal build artifacts in addition to test versions of each. (That is, running `cargo build` after `cargo test` is a no-op.) By removing the explicit `cargo build` invocation the test dependencies can begin building in parallel a bit sooner. --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e563cae716e..88cd9447eca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,16 +60,13 @@ matrix: script: - cargo fmt -- --check - cargo clippy --all-targets --all-features --all - - cargo build - cargo test - npm test - rust: beta script: - - cargo build - cargo test - rust: nightly script: - - cargo build - cargo test notifications: From e37a6502b5623f37c416cdb7f0ac59bf7bc11b0d Mon Sep 17 00:00:00 2001 From: Justin Geibel Date: Fri, 21 Dec 2018 20:12:52 -0500 Subject: [PATCH 5/5] Drop back down to the default timeout for caching on CI Building and uploading the cache now takes about 130 seconds on the stable channel. On beta and nightly it takes around 90 seconds. The cache on stable is larger because of additional clippy and npm files. The caching behavior seems to be consistent enough to switch back to the default setting of 180 seconds. --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 88cd9447eca..c929ca3dccd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,6 @@ cache: cargo: true directories: - $HOME/.npm - # Set timeout to 6 minutes (double the default of 3 minutes) - timeout: 360 before_cache: script/ci/prune-cache.sh env: