Skip to content

Commit e8c42a7

Browse files
committed
Use recent lock file when checking API files
Recently we added `--locked` to all the `cargo` invocations in the script to check API text files. But if one has an updated lock file (newer than recent) then this achieves nothing. I.e., if one has run `cargo` _without_ `--locked` then the local lock file will have deps that are too new (*cough* serde I'm looking at you). Copy the recent lock file into place when the script is run locally but preserve the lock file state once the script is finished running.
1 parent e81a4c2 commit e8c42a7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

contrib/check-for-api-changes.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,18 @@ main() {
2424
need_nightly
2525
need_cargo_public_api
2626

27+
# If script is running in CI the recent lock file is copied into place
28+
# already by the github action job. Locally be kind to the environment.
29+
if [ "${GITHUB_ACTIONS:-}" != "true" ]; then
30+
[ -f "Cargo.lock" ] && mv Cargo.lock Cargo.lock.tmp
31+
cp Cargo-recent.lock Cargo.lock
32+
fi
33+
2734
# Just check crates that are stabilising.
2835
generate_api_files "units"
2936

37+
[ -f "Cargo.lock.tmp" ] && mv Cargo.lock.tmp Cargo.lock
38+
3039
check_for_changes
3140
}
3241

0 commit comments

Comments
 (0)