Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 <jtgeibel@gmail.com>
  • Loading branch information
bors-voyager[bot] and jtgeibel committed Dec 22, 2018
2 parents 363b9e0 + e37a650 commit f7fbc01
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
10 changes: 3 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ 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:
global:
Expand All @@ -27,7 +26,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:
Expand All @@ -53,22 +52,19 @@ matrix:
- rust: stable
before_install:
- nvm install 10
- npm ci
- rustup component add rustfmt-preview
- rustup component add clippy-preview
script:
- cargo fmt -- --check
- cargo clippy --all-targets --all-features --all
- cargo build
- cargo test
- npm install
- npm test
- rust: beta
script:
- cargo build
- cargo test
- rust: nightly
script:
- cargo build
- cargo test

notifications:
Expand Down
File renamed without changes.
29 changes: 29 additions & 0 deletions script/ci/prune-cache.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f7fbc01

Please sign in to comment.