Skip to content

Commit 8341c0c

Browse files
ci: Change MSRV job to read MSRV from cargo
Delete msrv_toolchain.toml, and instead read the MSRV from cargo and copy it to rust-toolchain.toml. This ensures the job is checking the same MSRV set in Cargo.toml, and reduces the number of places that the MSRV needs to be manually updated when we change it.
1 parent 5602b1b commit 8341c0c

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.github/workflows/msrv_toolchain.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/rust.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,20 @@ jobs:
120120
- name: Checkout sources
121121
uses: actions/checkout@v4
122122
- name: Set toolchain
123-
run: cp .github/workflows/msrv_toolchain.toml rust-toolchain.toml
123+
run: |
124+
# Extract the MSRV using cargo.
125+
msrv=$(cargo metadata --no-deps --format-version=1 | jq --raw-output '.packages[] | select(.name == "uefi") | .rust_version')
126+
echo "MSRV: ${msrv}"
127+
# Set the MSRV in the toolchain config.
128+
sed -i "s:stable:${msrv}:" rust-toolchain.toml
124129
- uses: Swatinem/rust-cache@v2
125130
- name: Build
126131
# Build uefi-test-runner since its dependency tree includes all the
127132
# library packages. Note that xtask isn't used or built here; since it's
128133
# just a dev tool we don't care about the MSRV for that package.
129-
run: cargo build --target x86_64-unknown-uefi -p uefi-test-runner
134+
run: |
135+
cargo --version
136+
cargo build --target x86_64-unknown-uefi -p uefi-test-runner
130137
# This job requires the nightly channel, but keep it as a separate job from
131138
# `nightly_channel` because it takes a while to run.
132139
build_feature_permutations:

0 commit comments

Comments
 (0)