diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a55e80c820..8728d06747f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -433,7 +433,8 @@ jobs: defaults: run: - shell: bash # Use bash even on Windows, if we ever reenable windows-latest for testing. + # Use `bash` even on Windows, if we ever reenable `windows-latest` for testing. + shell: bash steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml index 9d96b3db67c..2d7043d113a 100644 --- a/.github/workflows/msrv.yml +++ b/.github/workflows/msrv.yml @@ -29,15 +29,21 @@ jobs: runs-on: ${{ matrix.os }} env: - # dictated by `firefox` to support the `helix` editor, but now probably effectively be controlled by `jiff`, which also aligns with `regex`. - # IMPORTANT: adjust etc/msrv-badge.svg as well - rust_version: 1.75.0 + # This is dictated by `firefox` to support the `helix` editor, but now probably effectively + # be controlled by `jiff`, which also aligns with `regex`. + # IMPORTANT: When adjusting, change all occurrences in `etc/msrv-badge.svg` as well. + RUST_VERSION: 1.75.0 steps: - uses: actions/checkout@v4 - uses: extractions/setup-just@v3 - - run: | - rustup toolchain install ${{ env.rust_version }} nightly --profile minimal --no-self-update - rustup default ${{ env.rust_version }} + - name: Set up ${{ env.RUST_VERSION }} (MSRV) and nightly toolchains + run: rustup toolchain install ${{ env.RUST_VERSION }} nightly --profile minimal --no-self-update + - name: Set ${{ env.RUST_VERSION }} (MSRV) as default + run: rustup default ${{ env.RUST_VERSION }} + - name: Downgrade locked dependencies to lowest allowed versions + run: | + # TODO(msrv): Use `cargo update --minimal-versions` when `--minimal-versions` is available. cargo +nightly update -Zminimal-versions - - run: just ci-check-msrv + - name: Run some `cargo build` commands on `gix` + run: just ci-check-msrv diff --git a/Makefile b/Makefile index fea4c7229ec..431c041979d 100644 --- a/Makefile +++ b/Makefile @@ -126,8 +126,8 @@ bench-gix-config: check-msrv-on-ci: ## Check the minimal support rust version for currently installed Rust version rustc --version - cargo check --package gix - cargo check --package gix --no-default-features --features async-network-client,max-performance + cargo build --locked --package gix + cargo build --locked --package gix --no-default-features --features async-network-client,max-performance ##@ Maintenance diff --git a/etc/msrv-badge.svg b/etc/msrv-badge.svg index 184a0688c61..3d42373fe68 100644 --- a/etc/msrv-badge.svg +++ b/etc/msrv-badge.svg @@ -1,4 +1,4 @@ - + rustc: 1.75.0+ diff --git a/justfile b/justfile index 2a9255e07f0..7f5c71dd24a 100755 --- a/justfile +++ b/justfile @@ -238,11 +238,16 @@ cross-test-android: (cross-test 'armv7-linux-androideabi' '--no-default-features check-size: etc/check-package-size.sh -# Check the minimal support Rust version, with the currently installed Rust version +# This assumes the current default toolchain is the Minimal Supported Rust Version and checks +# against it. This is run on CI in `msrv.yml`, after the MSRV toolchain is installed and set as +# default, and after dependencies in `Cargo.lock` are downgraded to the latest MSRV-compatible +# versions. Only if those or similar steps are done first does this work to validate the MSRV. +# +# Check the MSRV, *if* the toolchain is set and `Cargo.lock` is downgraded (used on CI) ci-check-msrv: rustc --version - cargo check -p gix - cargo check -p gix --no-default-features --features async-network-client,max-performance + cargo build --locked -p gix + cargo build --locked -p gix --no-default-features --features async-network-client,max-performance # Enter a nix-shell able to build on macOS nix-shell-macos: