Skip to content

Commit d9bea92

Browse files
committed
CI: Generate minimal-versions when build-testing MSRV
Lots of crates bump their MSRV in simple semver releases, causing us to constantly have to hold back "transitive" dependencies when testing our own MSRV. The opposite way of doing this is by immediately selecting the minimum compatible version per `Cargo.toml` semver selection using `-Zminimal-versions`, with the added benefit of validating our minimal dependency constraints in CI. Unfortunately, even more crates than that don't validate their minimum version dependencies (barring minor improvements for "new" targets), resulting in many compilation failures and many transitive dependencies needing manual update. Strangely, in for example the `image` crate a newer `num-traits 0.2.14` is being used but `num-bigint 0.4.0` fails to compile.
1 parent 438a8cc commit d9bea92

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,29 @@ jobs:
8181
with:
8282
tool: wasm-bindgen-cli
8383

84+
- name: Install nightly rust to generate `-Zminimal-versions` lockfile (for MSRV)
85+
if: matrix.rust_version == '1.71.0'
86+
uses: dtolnay/rust-toolchain@master
87+
with:
88+
toolchain: nightly-2024-10-01
89+
90+
- name: Pin deps that break MSRV
91+
if: matrix.rust_version == '1.71.0'
92+
# By downgrading all our dependency versions, we ensure that our minimum
93+
# version bounds are actually adequate (i.e. users can build `softbuffer`
94+
# with minimal versions themselves) and opt-out of any unexpected MSRV
95+
# bumps in semver-compatible releases of downstream crates.
96+
run: |
97+
cargo -Zminimal-versions generate-lockfile
98+
# Bump `regex` - only used by our `dev-dependencies` `criterion` dependency - to fix:
99+
# https://github.com/rust-lang/regex/issues/931
100+
# Can be removed on the next `criterion` upgrade: https://github.com/bheisler/criterion.rs/pull/821
101+
cargo update -p regex --precise 1.5.1
102+
cargo update -p num-traits --precise 0.2.16 # Unconditional i128 support used by image
103+
cargo update -p anyhow --precise 1.0.19 # walrus needs bail!() string support from 1.0.1, wasm-bindgen-cli-support requires format_err from 1.0.19
104+
cargo update -p foreign-types-macros --precise 0.2.2 # `core-graphics 0.23.1` from `winit 0.30` fails to compile on 0.2.1
105+
cargo update -p same-file --precise 1.0.5 # First release with `unknown` support for wasm32
106+
84107
- uses: hecrj/setup-rust-action@v2
85108
with:
86109
rust-version: ${{ matrix.rust_version }}${{ matrix.platform.host }}
@@ -95,11 +118,6 @@ jobs:
95118
if: (matrix.platform.os == 'ubuntu-latest') && contains(matrix.platform.target, 'i686')
96119
run: sudo apt-get install gcc-multilib
97120

98-
- name: Pin deps that break MSRV
99-
if: matrix.rust_version == '1.71.0'
100-
run: |
101-
cargo update -p bumpalo --precise 3.14.0
102-
103121
- name: Build crate
104122
shell: bash
105123
run: cargo $CMD build --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES

0 commit comments

Comments
 (0)