Skip to content

Commit f7fbc01

Browse files
Merge #1580
1580: Prune some build artifacts on CI to speed up caching r=jtgeibel a=jtgeibel 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. Co-authored-by: Justin Geibel <[email protected]>
2 parents 363b9e0 + e37a650 commit f7fbc01

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

.travis.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ cache:
1111
cargo: true
1212
directories:
1313
- $HOME/.npm
14-
# Set timeout to 6 minutes (double the default of 3 minutes)
15-
timeout: 360
14+
before_cache: script/ci/prune-cache.sh
1615

1716
env:
1817
global:
@@ -27,7 +26,7 @@ env:
2726
- PERCY_PROJECT=crates-io/crates.io
2827

2928
install:
30-
- script/cargo-clean-on-new-rustc-version.sh
29+
- script/ci/cargo-clean-on-new-rustc-version.sh
3130
- cargo install --force diesel_cli --vers `cat .diesel_version` --no-default-features --features postgres && export PATH=$HOME/.cargo/bin:$PATH
3231

3332
before_script:
@@ -53,22 +52,19 @@ matrix:
5352
- rust: stable
5453
before_install:
5554
- nvm install 10
55+
- npm ci
5656
- rustup component add rustfmt-preview
5757
- rustup component add clippy-preview
5858
script:
5959
- cargo fmt -- --check
6060
- cargo clippy --all-targets --all-features --all
61-
- cargo build
6261
- cargo test
63-
- npm install
6462
- npm test
6563
- rust: beta
6664
script:
67-
- cargo build
6865
- cargo test
6966
- rust: nightly
7067
script:
71-
- cargo build
7268
- cargo test
7369

7470
notifications:

script/ci/prune-cache.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo "Initial cache size:"
6+
du -hs target/debug
7+
8+
crate_name="cargo-registry"
9+
test_name="all"
10+
bin_names="delete-crate delete-version populate render-readmes server test-pagerduty transfer-crates update-downloads"
11+
12+
normalized_crate_name=${crate_name//-/_}
13+
rm -v target/debug/$normalized_crate_name-*
14+
rm -v target/debug/deps/$normalized_crate_name-*
15+
rm -v target/debug/deps/lib$normalized_crate_name-*
16+
17+
normalized_test_name=${test_name//-/_}
18+
rm -v target/debug/$normalized_test_name-*
19+
rm -v target/debug/deps/$normalized_test_name-*
20+
21+
for name in $bin_names; do
22+
rm -v target/debug/$name
23+
normalized=${name//-/_}
24+
rm -v target/debug/$normalized-*
25+
rm -v target/debug/deps/$normalized-*
26+
done
27+
28+
echo "Final cache size:"
29+
du -hs target/debug

0 commit comments

Comments
 (0)