Skip to content

Commit 66249a3

Browse files
committed
Auto merge of #1655 - jtgeibel:manually-trigger-clean-on-ci, r=jtgeibel
Add a manual trigger to clean the cache on CI When we bump a low-level dependency, such as `libc`, a large number of crates are rebuilt and this can grow our cache to the point where caching hits a timeout (and is not persisted). By changing the value of `manual_stamp` in the script, the cache can be cleared without waiting for the next compiler release.
2 parents 7ca518d + cfe6d51 commit 66249a3

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

script/ci/cargo-clean-on-new-rustc-version.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
set -e
44

5+
manual_stamp_file=target/ci_manual_stamp
6+
manual_stamp=0 # Change this to force a clean build on CI
7+
8+
if [ -f $manual_stamp_file ]; then
9+
if echo "$manual_stamp" | cmp -s $manual_stamp_file -; then
10+
: # Do nothing, fall through to version check below
11+
else
12+
echo "A clean build has been requested, running cargo clean"
13+
cargo clean
14+
# The target/ directory is now gone, and the messages below will not be printed
15+
fi
16+
fi
17+
518
stamp_file=target/rustc_version_stamp
619
current_version=$(rustc --version)
720

@@ -13,10 +26,9 @@ if [ -f $stamp_file ]; then
1326
echo "The version of rustc has changed, running cargo clean"
1427
cargo clean
1528
fi
16-
else
17-
echo "There is no existing version stamp, keeping the cache intact"
1829
fi
1930

20-
# Save the version stamp for next time
31+
# Save the version stamps for next time
2132
mkdir -p target/
2233
echo $current_version > $stamp_file
34+
echo $manual_stamp > $manual_stamp_file

0 commit comments

Comments
 (0)