Skip to content
Draft
Show file tree
Hide file tree
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
91 changes: 91 additions & 0 deletions .github/workflows/lockfile-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Lockfile Consistency Checks

on:
push:
branches-ignore:
- "gh-readonly-queue/**"
pull_request:
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
discover-lockfiles:
name: Discover Cargo.lock Files
runs-on: ubuntu-latest
outputs:
lockfiles: ${{ steps.find-lockfiles.outputs.lockfiles }}
steps:
- name: Checkout Repository
uses: actions/checkout@v5

- name: List tracked Cargo.lock files
id: find-lockfiles
shell: bash
run: |
set -u

mapfile -t lockfiles < <(git ls-files '**/Cargo.lock')

if [ "${#lockfiles[@]}" -eq 0 ]; then
echo "No Cargo.lock files found."
echo "lockfiles=[]" >> "$GITHUB_OUTPUT"
exit 0
fi

printf 'Discovered %s Cargo.lock file(s):\n' "${#lockfiles[@]}"
printf ' - %s\n' "${lockfiles[@]}"

json=$(printf '%s\n' "${lockfiles[@]}" | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "lockfiles=$json" >> "$GITHUB_OUTPUT"

check-lockfiles:
name: Verify Cargo.lock works with --locked
needs: discover-lockfiles
runs-on: ubuntu-latest
if: ${{ needs.discover-lockfiles.outputs.lockfiles != '[]' }}
strategy:
fail-fast: false
matrix:
lockfile: ${{ fromJSON(needs.discover-lockfiles.outputs.lockfiles) }}
steps:
- name: Checkout Repository
uses: actions/checkout@v5

- name: Run cargo update --workspace --locked
shell: bash
run: |
set -u

lockfile='${{ matrix.lockfile }}'
dir=$(dirname "$lockfile")

echo "Running cargo update --workspace --locked for $lockfile"
pushd "$dir" > /dev/null
cargo update --workspace --locked
popd > /dev/null
Comment on lines +57 to +68
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cargo command is being executed without installing a Rust toolchain first. The job needs to install Rust (using an action like dtolnay/rust-toolchain) before running cargo commands. Without this step, the cargo command will fail because cargo won't be available in the runner environment.

Copilot uses AI. Check for mistakes.

summarize-lockfile-results:
name: Summarize Lockfile Checks
needs:
- discover-lockfiles
- check-lockfiles
runs-on: ubuntu-latest
if: always()
steps:
- name: Ensure all lockfile checks succeeded
shell: bash
run: |
set -u

result='${{ needs.check-lockfiles.result }}'

if [ "$result" = "success" ] || [ "$result" = "skipped" ]; then
echo "Lockfile checks completed with result: $result"
exit 0
fi

echo "::error::Lockfile checks completed with result: $result"
exit 1
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub extern "system" fn driver_entry(
::core::panicking::panic_fmt(
format_args!(
"internal error: entered unreachable code: {0}",
format_args!("Option should never be None")
format_args!("Option should never be None"),
),
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub extern "system" fn driver_entry(
::core::panicking::panic_fmt(
format_args!(
"internal error: entered unreachable code: {0}",
format_args!("Option should never be None")
format_args!("Option should never be None"),
),
);
};
Expand Down
Loading