Commit 654a8fa
committed
Use
This makes the `rust-version` in the manifest file for the `gix`
crate the single source of truth for the MSRV. CI checks use this
rather than relying on a separate copy of the MSRV. The MSRV badge
still hard-codes the MSRV (in four places in its SVG code), but a
recipe is added to regenerate it based on the MSRV, and a CI check
is added to verify that it agrees with the MSRV.
Specifically, the changes are:
1. Add an `msrv` recipe to the `justfile` that extracts the MSRV
from the value of `rust-version` in the `gix` package, using
`cargo metadata` and `jq`, and that formats it in the X.Y.Z
form (since that form is slightly more widely usable than the
X.Y form even when Z is 0).
2. Remove the hard-coded MSRV in `msrv.yml` (in `env.RUST_VERSION`)
and instead have the `check-msrv` job in `msrv.yml` get it from
the `gix` manifest by callig `just msrv`. This fixes the problem
that it was possible to forget to update the MSRV in the
workflow.
3. Replace the `ci-check-msrv` recipe in the `justfile` with a
`check-rust-version` recipe taking a `rust-version` argument.
Instead of implicitly using the current default toolchain and
relying on that being the MSRV, this explicitly runs its `rustc`
and `cargo` commands with the specified `rust-version`. The
`check-msrv` CI job now calls this, passing the MSRV.
The reason to have a `check-rust-version` recipe instead of a
`check-msrv` recipe (or both recipes with the latter delegating
to the former) is that CI usage, as well as other anticipated
usage, involves performing additional operations between finding
out the MSRV and attempting to build with it:
- At least on CI, it is clearer to install the needed toolchains
before using them, even though specifying them explicitly in
`rustc` or `cargo` commands will try to install them.
- More importantly, on CI and locally, the `check-rust-version`
recipe is not currently expected to work with the MSRV when
the committed version of `Cargo.lock` is used, because some
locked dependencies may have later MSRVs.
Depending on precisely what one is testing, one could
temporarily remove `Cargo.lock` and regenerate it using the
MSRV toolchain, or (as done on CI) temporarily
downgrade the versions in `Cargo.lock`.
4. Add an `msrv-badge` recipe to the `justfile` that regenerates
the MSRV badge `etc/msrv-badge.yml` based on the MSRV from the
`gix` manifest, as obtained via `just msrv`.
This uses a template file, added alongside the badge, where each
place where the MSRV should appear has a literal placeholder
`{MSRV}` instead. `just msrv-badge` copies the template, with
the actual MSRV value subtituted for the placeholders, to the
badge, overwriting whatever is there.
5. Add a `check-msrv-badge` job to `msrv.yml` that checks out the
code, runs `just msrv-badge`, and checks if there are any
changes. If so, the committed badge is out of date.
6. Add an `msrv-pass` job to `msrv.yml` that depends on the
`check-msrv` and `check-msrv-badge` jobs. This is analogous to
the `tests-pass` job in `ci.yml`. It is so that, if having the
MSRV badge out of date should block PR auto-merge, then that
can be achieved without `msrv.yml` having to contribute more
than one required check to the branch protection rules.
(This also temporarily adds a `check-msrv` job for `macos-15`, but
that is just to verify that recent `justfile` changes are portable.
It will be removed shortly.)gix manifest rust-version in all MSRV checks1 parent a8476e1 commit 654a8fa
File tree
5 files changed
+95
-23
lines changed- .github/workflows
- etc
- gix
5 files changed
+95
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
490 | | - | |
| 490 | + | |
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
507 | | - | |
| 507 | + | |
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
49 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
| 191 | + | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
| |||
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
253 | 270 | | |
254 | 271 | | |
255 | 272 | | |
| |||
0 commit comments