Skip to content

Commit 19e830b

Browse files
committed
CI: Use --locked when calling cargo public-api
Copy the `Cargo-recent.lock` file into place in CI and in the script use `--locked` on all invocations of `cargo` that need it.
1 parent e1d874d commit 19e830b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.github/workflows/rust.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ jobs:
311311
runs-on: ubuntu-24.04
312312
strategy:
313313
fail-fast: false
314+
matrix:
315+
dep: [recent]
314316
steps:
315317
- name: "Checkout repo"
316318
uses: actions/checkout@v5
@@ -320,6 +322,8 @@ jobs:
320322
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
321323
- name: "Install cargo-public-api"
322324
run: cargo install --locked cargo-public-api --version 0.49.0
325+
- name: "Set dependencies"
326+
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
323327
- name: "Run API checker script"
324328
run: ./contrib/check-for-api-changes.sh
325329

contrib/check-for-api-changes.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ check_for_changes() {
6565

6666
# Run cargo when --all-features is not used.
6767
run_cargo() {
68-
RUSTDOCFLAGS="$RUSTDOCFLAGS" cargo +"$NIGHTLY" public-api --simplified "$@"
68+
RUSTDOCFLAGS="$RUSTDOCFLAGS" cargo +"$NIGHTLY" --locked public-api --simplified "$@"
6969
}
7070

7171
# Run cargo with all features enabled.
7272
run_cargo_all_features() {
73-
cargo +"$NIGHTLY" public-api --simplified --all-features
73+
cargo +"$NIGHTLY" --locked public-api --simplified --all-features
7474
}
7575

7676
need_nightly() {

0 commit comments

Comments
 (0)