From f24956d4413d1611a329990f33b5c9d7e8a5984c Mon Sep 17 00:00:00 2001 From: Micah Elizabeth Scott Date: Thu, 3 Aug 2023 09:49:07 -0700 Subject: [PATCH] Add maint/check_all_lockfiles Looks for any checked-in Cargo.lock files, and checks the lockfile quickly by running `cargo tree --locked` there. --- .gitlab-ci.yml | 1 + maint/check_all_lockfiles | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 maint/check_all_lockfiles diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 466eb1b7d..e79910a44 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,6 +69,7 @@ rust-checks: - ./maint/check_licenses - ./maint/cargo_sort - ./maint/check_tree + - ./maint/check_all_lockfiles cache: paths: - cargo-sort diff --git a/maint/check_all_lockfiles b/maint/check_all_lockfiles new file mode 100755 index 000000000..ae75423ab --- /dev/null +++ b/maint/check_all_lockfiles @@ -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