Skip to content

Commit 501c3ee

Browse files
authored
check that declared msrv is minimal (#733)
* check that declared msrv is minimal * use double quotes in echo messages * specify real msrv
1 parent e738502 commit 501c3ee

File tree

2 files changed

+21
-24
lines changed

2 files changed

+21
-24
lines changed

.github/workflows/check.yml

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
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
1010
permissions:
@@ -47,8 +47,6 @@ jobs:
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:
@@ -69,8 +67,6 @@ jobs:
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:
@@ -92,8 +88,6 @@ jobs:
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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "imageproc"
33
version = "0.26.0"
44
authors = ["theotherphil"]
5-
rust-version = "1.85.0"
5+
rust-version = "1.82.0"
66
edition = "2021"
77
license = "MIT"
88
description = "Image processing operations"

0 commit comments

Comments
 (0)