Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prune some build artifacts on CI to speed up caching #1580

Merged
merged 5 commits into from
Dec 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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