Add maint/check_all_lockfiles

Looks for any checked-in Cargo.lock files, and checks the lockfile
quickly by running `cargo tree --locked` there.
This commit is contained in:
Micah Elizabeth Scott 2023-08-03 09:49:07 -07:00
parent 5353a02138
commit f24956d441
2 changed files with 20 additions and 0 deletions

View File

@ -69,6 +69,7 @@ rust-checks:
- ./maint/check_licenses
- ./maint/cargo_sort
- ./maint/check_tree
- ./maint/check_all_lockfiles
cache:
paths:
- cargo-sort

19
maint/check_all_lockfiles Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
#
# Everywhere we have a Cargo.lock checked into git, check that it's usable.
#
# This avoids doing a full `cargo check` which actually compiles the crates.
# Our needs are closer to `cargo verify-project`, but we do want to check
# the entire dependency tree without compiling anything.
#
# The approach we use now is to run `cargo tree --locked`, which catches
# missing dependencies relatively quickly.
#
set -eu
for subdir in $(git ls-files | sed -n 's/^/.\//;s/Cargo.lock$//p'); do
echo
echo "---- Checking $subdir"
(cd "$subdir" && cargo tree --locked > /dev/null)
done