Skip to content

Add a manual trigger to clean the cache on CI #1655

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

Merged
merged 1 commit into from
Mar 10, 2019
Merged
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
18 changes: 15 additions & 3 deletions script/ci/cargo-clean-on-new-rustc-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

set -e

manual_stamp_file=target/ci_manual_stamp
manual_stamp=0 # Change this to force a clean build on CI

if [ -f $manual_stamp_file ]; then
if echo "$manual_stamp" | cmp -s $manual_stamp_file -; then
: # Do nothing, fall through to version check below
else
echo "A clean build has been requested, running cargo clean"
cargo clean
# The target/ directory is now gone, and the messages below will not be printed
fi
fi

stamp_file=target/rustc_version_stamp
current_version=$(rustc --version)

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

# Save the version stamp for next time
# Save the version stamps for next time
mkdir -p target/
echo $current_version > $stamp_file
echo $manual_stamp > $manual_stamp_file