44# - clippy: checks that the code does not contain any clippy warnings
55# - doc: checks that the code can be documented without errors
66# - hack: check combinations of feature flags
7- # - msrv: check that the msrv specified in the crate is correct
7+ # - msrv: check that the msrv specified in the crate is correct and minimal
88# - wasm: check wasm target
99# - semver: check API changes for semver violations
1010permissions :
4747 name : ${{ matrix.toolchain }} / fmt
4848 steps :
4949 - uses : actions/checkout@v4
50- with :
51- submodules : true
5250 - name : Install ${{ matrix.toolchain }}
5351 uses : dtolnay/rust-toolchain@master
5452 with :
6967 toolchain : ["${{ needs.vars.outputs.nightly }}"]
7068 steps :
7169 - uses : actions/checkout@v4
72- with :
73- submodules : true
7470 - name : Install ${{ matrix.toolchain }}
7571 uses : dtolnay/rust-toolchain@master
7672 with :
9288 name : ${{ matrix.toolchain }} / doc
9389 steps :
9490 - uses : actions/checkout@v4
95- with :
96- submodules : true
9791 - name : Install ${{ matrix.toolchain }}
9892 uses : dtolnay/rust-toolchain@master
9993 with :
@@ -113,8 +107,6 @@ jobs:
113107 name : ubuntu / ${{ matrix.toolchain }} / features
114108 steps :
115109 - uses : actions/checkout@v4
116- with :
117- submodules : true
118110 - name : Install ${{ matrix.toolchain }}
119111 uses : dtolnay/rust-toolchain@master
120112 with :
@@ -128,28 +120,33 @@ jobs:
128120 msrv :
129121 needs : vars
130122 runs-on : ubuntu-latest
131- strategy :
132- matrix :
133- msrv : ["${{ needs.vars.outputs.msrv }}"]
134- name : ubuntu / ${{ matrix.msrv }}
123+ name : ubuntu / msrv / ${{ needs.vars.outputs.msrv }}
135124 steps :
136125 - uses : actions/checkout@v4
137- with :
138- submodules : true
139126 - name : Install ${{ needs.vars.outputs.nightly }}
140127 uses : dtolnay/rust-toolchain@master
141128 with :
142129 toolchain : ${{ needs.vars.outputs.nightly }}
143- # Generate Cargo.lock with minimal versions
144- - name : Update dependencies to minimal versions
130+ - name : Generate Cargo.lock with minimal versions
145131 run : cargo +nightly update -Zdirect-minimal-versions
146- - name : Install ${{ matrix.msrv }}
147- uses : dtolnay/rust-toolchain@master
132+ - uses : taiki-e/install-action@v2.62.41
148133 with :
149- toolchain : ${{ matrix.msrv }}
150- - run : cargo +${{ matrix.msrv }} check --locked
151- env :
152- RUSTFLAGS : -D warnings
134+ tool : cargo-msrv@0.18.4
135+ - name : Verify MSRV
136+ run : |
137+ computed_msrv=$(cargo msrv find --output-format minimal -- cargo check --ignore-rust-version)
138+
139+ # The MSRV explicitly declared in Cargo.toml
140+ declared_msrv="${{ needs.vars.outputs.msrv }}"
141+
142+ if [ "$computed_msrv" != "$declared_msrv" ]; then
143+ echo "The MSRV computed by cargo msrv (\"$computed_msrv\") does not match the version declared in Cargo.toml (\"$declared_msrv\")."
144+ echo "Please update the \"rust-version\" in Cargo.toml to \"$computed_msrv\"."
145+ exit 1
146+ else
147+ echo "MSRV consistency check passed."
148+ echo "Computed MSRV \"$computed_msrv\" matches declared MSRV \"$declared_msrv\"."
149+ fi
153150 wasm :
154151 needs : vars
155152 runs-on : ubuntu-latest
0 commit comments