Skip to content

Commit 336815a

Browse files
committed
Auto merge of #12654 - epage:msrv, r=weihanglo
Set and verify all MSRVs in CI ### What does this PR try to resolve? Allow us to advertise an MSRV for all public packages, unblocking #12432. Packages are broken down into two MSRV policies - Internal packages: `rust-version=stable` - Public packages: `rust-version=stable-2` To support this - RenovateBot will automatically update all MSRVs - CI will verify all packages build according to their MSRV Since this takes the "single workspace" approach, the downside is that common dependencies are subject to each package's MSRV. We also can't rely on `-Zmsrv-policy` to help us generate a lockfile because it breaks down when trying to support multiple MSRVs in a workspace ### How should we test and review this PR? Per commit ### Additional information #12381 skipped setting some MSRVs because we weren't sure how to handle it. For `cargo-credential`, we needed to do something and did one-off verification (#12623). `cargo-hack` recently gained the ability to automatically select MSRVs for each package allowing us to scale this up to the entire workspace. I don't know if we consciously chose an MSRV policy for `cargo-credential` but it looked like N-2 so that is what I stuck with and propagated out. - Without an aggressive sliding MSRV, we discourage people from using newer features because they will feel like they need permission which means it needs to be justified - Without an aggressive sliding MSRV, if the MSRV at one point in time works for someone, they tend to assume it will always work, leading to frustration at unmet expectations. I switched the MSRV check to `cargo check` from `cargo test` because I didn't want to deal with the out-of-diskspace issues and `check` will catch 99% of MSRV issues. Potential future improvements to `cargo-hack` - Allow `--version-range ..stable` so we can verify all MSRVs that aren't stable which would bypass the diskspace issues and allow us to more easily use `cargo test` again - Verify on a `cargo package` version of a crate (taiki-e/cargo-hack#216)
2 parents 637ade0 + 9864b35 commit 336815a

File tree

11 files changed

+61
-24
lines changed

11 files changed

+61
-24
lines changed

.github/renovate.json5

+35-5
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,59 @@
1212
{
1313
customType: 'regex',
1414
fileMatch: [
15-
'^Cargo.toml$',
15+
'Cargo.toml$',
1616
],
1717
matchStrings: [
18-
'rust-version.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)',
18+
'\bMSRV:1\b.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)',
19+
'(?<currentValue>\\d+\\.\\d+(\\.\\d+)?).*?\bMSRV:1\b',
1920
],
20-
depNameTemplate: 'latest-msrv',
21+
depNameTemplate: 'MSRV:1', // Support 1 version of rustc
22+
packageNameTemplate: 'rust-lang/rust',
23+
datasourceTemplate: 'github-releases',
24+
},
25+
{
26+
customType: 'regex',
27+
fileMatch: [
28+
'Cargo.toml$',
29+
],
30+
matchStrings: [
31+
'\bMSRV:3\b.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)',
32+
'(?<currentValue>\\d+\\.\\d+(\\.\\d+)?).*?\bMSRV:3\b',
33+
],
34+
depNameTemplate: 'MSRV:3', // Support 3 versions of rustc
2135
packageNameTemplate: 'rust-lang/rust',
2236
datasourceTemplate: 'github-releases',
2337
},
2438
],
2539
packageRules: [
2640
{
27-
commitMessageTopic: 'Latest MSRV',
41+
commitMessageTopic: 'MSRV (1 version)',
42+
matchManagers: [
43+
'regex',
44+
],
45+
matchPackageNames: [
46+
'MSRV:1',
47+
],
48+
schedule: [
49+
'* * * * *',
50+
],
51+
groupName: 'msrv',
52+
},
53+
{
54+
commitMessageTopic: 'MSRV (3 versions)',
2855
matchManagers: [
2956
'regex',
3057
],
3158
matchPackageNames: [
32-
'latest-msrv',
59+
'MSRV:3',
3360
],
3461
"extractVersion": "^(?<version>\\d+\\.\\d+)", // Drop the patch version
3562
schedule: [
3663
'* * * * *',
3764
],
65+
minimumReleaseAge: '85 days', // 2 releases back * 6 weeks per release * 7 days per week + 1
66+
internalChecksFilter: 'strict',
67+
groupName: 'msrv',
3868
},
3969
// Goals:
4070
// - Rollup safe upgrades to reduce CI runner load

.github/workflows/main.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
needs:
2121
- build_std
2222
- clippy
23-
- credential_msrv
23+
- msrv
2424
- docs
2525
- lockfile
2626
- resolver
@@ -38,7 +38,7 @@ jobs:
3838
needs:
3939
- build_std
4040
- clippy
41-
- credential_msrv
41+
- msrv
4242
- docs
4343
- lockfile
4444
- resolver
@@ -249,9 +249,9 @@ jobs:
249249
curl -sSLO https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
250250
sh linkcheck.sh --all --path ../src/doc cargo
251251
252-
credential_msrv:
252+
msrv:
253253
runs-on: ubuntu-latest
254254
steps:
255255
- uses: actions/checkout@v4
256256
- uses: taiki-e/install-action@cargo-hack
257-
- run: cargo hack check --all-targets --rust-version -p cargo-credential
257+
- run: cargo hack check --all-targets --rust-version --workspace --ignore-private

Cargo.lock

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exclude = [
1111
]
1212

1313
[workspace.package]
14-
rust-version = "1.73"
14+
rust-version = "1.73" # MSRV:1
1515
edition = "2021"
1616
license = "MIT OR Apache-2.0"
1717

@@ -108,6 +108,7 @@ name = "cargo"
108108
version = "0.76.0"
109109
edition.workspace = true
110110
license.workspace = true
111+
rust-version.workspace = true
111112
homepage = "https://crates.io"
112113
repository = "https://github.com/rust-lang/cargo"
113114
documentation = "https://docs.rs/cargo"

crates/cargo-platform/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
[package]
22
name = "cargo-platform"
3-
version = "0.1.5"
3+
version = "0.1.6"
44
edition.workspace = true
55
license.workspace = true
6+
rust-version = "1.70.0" # MSRV:3
67
homepage = "https://github.com/rust-lang/cargo"
78
repository = "https://github.com/rust-lang/cargo"
89
documentation = "https://docs.rs/cargo-platform"

crates/home/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "home"
33
version = "0.5.8"
44
authors = ["Brian Anderson <[email protected]>"]
5+
rust-version = "1.70.0" # MSRV:3
56
documentation = "https://docs.rs/home"
67
edition.workspace = true
78
include = [

credential/cargo-credential-1password/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
[package]
22
name = "cargo-credential-1password"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
edition.workspace = true
55
license.workspace = true
6+
rust-version = "1.70.0" # MSRV:3
67
repository = "https://github.com/rust-lang/cargo"
78
description = "A Cargo credential process that stores tokens in a 1password vault."
89

credential/cargo-credential-libsecret/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
[package]
22
name = "cargo-credential-libsecret"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
edition.workspace = true
55
license.workspace = true
6+
rust-version.workspace = true
67
repository = "https://github.com/rust-lang/cargo"
78
description = "A Cargo credential process that stores tokens with GNOME libsecret."
89

credential/cargo-credential-macos-keychain/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
[package]
22
name = "cargo-credential-macos-keychain"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
edition.workspace = true
55
license.workspace = true
6+
rust-version.workspace = true
67
repository = "https://github.com/rust-lang/cargo"
78
description = "A Cargo credential process that stores tokens in a macOS keychain."
89

credential/cargo-credential-wincred/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
[package]
22
name = "cargo-credential-wincred"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
edition.workspace = true
55
license.workspace = true
6+
rust-version.workspace = true
67
repository = "https://github.com/rust-lang/cargo"
78
description = "A Cargo credential process that stores tokens with Windows Credential Manager."
89

credential/cargo-credential/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "cargo-credential"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
edition.workspace = true
55
license.workspace = true
6-
rust-version = "1.70.0"
6+
rust-version = "1.70.0" # MSRV:3
77
repository = "https://github.com/rust-lang/cargo"
88
description = "A library to assist writing Cargo credential helpers."
99

0 commit comments

Comments
 (0)