From d9bea92ac9ca7ecbbc17a80f34baf2de8b5dbcdb Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Wed, 5 Feb 2025 10:09:32 +0100 Subject: [PATCH] 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. --- .github/workflows/ci.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c516648..5047728 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,6 +81,29 @@ jobs: with: tool: wasm-bindgen-cli + - name: Install nightly rust to generate `-Zminimal-versions` lockfile (for MSRV) + if: matrix.rust_version == '1.71.0' + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2024-10-01 + + - name: Pin deps that break MSRV + if: matrix.rust_version == '1.71.0' + # By downgrading all our dependency versions, we ensure that our minimum + # version bounds are actually adequate (i.e. users can build `softbuffer` + # with minimal versions themselves) and opt-out of any unexpected MSRV + # bumps in semver-compatible releases of downstream crates. + run: | + cargo -Zminimal-versions generate-lockfile + # Bump `regex` - only used by our `dev-dependencies` `criterion` dependency - to fix: + # https://github.com/rust-lang/regex/issues/931 + # Can be removed on the next `criterion` upgrade: https://github.com/bheisler/criterion.rs/pull/821 + cargo update -p regex --precise 1.5.1 + cargo update -p num-traits --precise 0.2.16 # Unconditional i128 support used by image + 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 + 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 + cargo update -p same-file --precise 1.0.5 # First release with `unknown` support for wasm32 + - uses: hecrj/setup-rust-action@v2 with: rust-version: ${{ matrix.rust_version }}${{ matrix.platform.host }} @@ -95,11 +118,6 @@ jobs: if: (matrix.platform.os == 'ubuntu-latest') && contains(matrix.platform.target, 'i686') run: sudo apt-get install gcc-multilib - - name: Pin deps that break MSRV - if: matrix.rust_version == '1.71.0' - run: | - cargo update -p bumpalo --precise 3.14.0 - - name: Build crate shell: bash run: cargo $CMD build --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES