From a9c729a1978ee6c3f43704eeef879acbce2f3d73 Mon Sep 17 00:00:00 2001 From: rzvxa <3788964+rzvxa@users.noreply.github.com> Date: Tue, 13 Aug 2024 17:17:28 +0330 Subject: [PATCH] chore(ci): enforce `msrv` in parts of our CI. (#4879) closes #4874 ![image](https://github.com/user-attachments/assets/98c2650d-54dd-45d9-82ee-0516339ae1f8) --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99cce7804..d4d73c0ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,12 @@ jobs: RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup shell: bash run: | - sed -i -e 's/profile = "default"/profile = "minimal"/g' rust-toolchain.toml + # This `awk` command will find the value of our Minimum Supported Rust Version and store it as `MSRV`. + # NOTE: this will fail if there are any other items named `rust-version`. We assume there is only one in our `Cargo.toml`. + MSRV=$(awk -F'=' '/rust-version/ {gsub(/[" ]/, "", $2); printf "%s", ($2 + "")}' Cargo.toml) + # Set profile to minimal and channel to our Minimum Supported Rust Version. + # Running our tests on this channel ensures that our code uses APIs that are supported in our `MSRV`. + sed -i -e 's/profile = "default"/profile = "minimal"/g' -e "s/channel = .*/channel = \"$MSRV\"/g" rust-toolchain.toml rustup set profile minimal rustup show git restore .