Skip to content

Commit 1a12399

Browse files
Add MSRV Cargo-minimal.lock and Cargo-recent.lock files
Without commited lock files, CI dependency resolution can pull in transitive dependencies that require a newer compiler than the project's MSRV. The triggering issue was that bindgen v0.72 depends on rustc-hash v2.x, and the recent release of rustc-hash v2.1.2 introduced a rustc 1.77.0 requirement, breaking the MSRV build against rustc 1.71.0. Cargo-minimal.lock pins dependencies to their oldest MSRV-compatible versions. Cargo-recent.lock pins to the latest patch versions compatible with the MSRV compiler. The CI msrv-check job now runs twice as a matrix, once with each lock file, similar to the approach used by rust-bitcoin. Both lockfiles pin rustc-hash below 2.1.2 to avoid the incompatible release, to 2.1.0 in the minimal lockfile and 2.1.1 in the recent lockfile. tempdir is bumped to >=0.3.6 in dev-dependencies to prevent it from resolving to an older version that depends on an incompatible rand release under minimal-versions. See also: #147
1 parent 3184f6f commit 1a12399

5 files changed

Lines changed: 1554 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ env:
99

1010
jobs:
1111
msrv-check:
12-
name: Build with MSRV
12+
name: Build with MSRV - ${{ matrix.dep }} deps
1313
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
dep: [minimal, recent]
1418
steps:
1519
- uses: actions/checkout@v3
1620

@@ -28,15 +32,18 @@ jobs:
2832
- name: Cache dependencies
2933
uses: Swatinem/rust-cache@v2
3034

35+
- name: Set Cargo.lock
36+
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
37+
3138
- name: Build with MSRV
3239
run: |
3340
# Ensure we're using the right version
3441
rustc --version
3542
# Build the project
36-
cargo build --all-features
43+
cargo build --all-features --locked
3744
3845
- name: Run tests with MSRV
39-
run: cargo test --all-features
46+
run: cargo test --all-features --locked
4047

4148
build:
4249
name: Build and Test

0 commit comments

Comments
 (0)