From 1eec92fb2743e26b4c69a4a5ae975675a55550d0 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Tue, 16 Sep 2025 13:44:24 -0700 Subject: [PATCH 01/13] add check-msrv to Makefile --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 2cc847d7b3..1047b4c3ea 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,11 @@ fix-toml: install-taplo-cli check-toml: install-taplo-cli taplo check +check-msrv: + cargo generate-lockfile -Z direct-minimal-versions + cargo check --locked --workspace + git checkout -- Cargo.lock + check: check-fmt check-clippy check-toml cargo-machete doc-test: From 4960bf9abbc88ad200c62bd0c38c19d5c7f9ab15 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 17 Sep 2025 10:05:12 -0700 Subject: [PATCH 02/13] use make check-msrv in CI --- .github/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88bb2a9c45..09ed57eb3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -161,13 +161,9 @@ jobs: uses: arduino/setup-protoc@v3 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Generate minimal versions lockfile - run: | - cargo generate-lockfile -Z direct-minimal-versions - name: Setup MSRV Rust toolchain uses: ./.github/actions/setup-builder with: rust-version: ${{ env.rust_msrv }} - name: Check MSRV - run: | - cargo +${{ env.rust_msrv }} check --locked --workspace + run: make check-msrv From 9e791721f8ffab7c9f3edcb2ddbaafad8ee3598b Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 17 Sep 2025 10:21:57 -0700 Subject: [PATCH 03/13] fix ci --- .github/workflows/ci.yml | 2 ++ Makefile | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09ed57eb3f..f0f7b517f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,4 +166,6 @@ jobs: with: rust-version: ${{ env.rust_msrv }} - name: Check MSRV + env: + rust_msrv: ${{ env.rust_msrv }} run: make check-msrv diff --git a/Makefile b/Makefile index 1047b4c3ea..dd55597a63 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,11 @@ check-toml: install-taplo-cli check-msrv: cargo generate-lockfile -Z direct-minimal-versions - cargo check --locked --workspace + if [ -n "$$rust_msrv" ]; then \ + cargo +$$rust_msrv check --locked --workspace; \ + else \ + cargo check --locked --workspace; \ + fi git checkout -- Cargo.lock check: check-fmt check-clippy check-toml cargo-machete From 71ad8b97170ae944a3e0bba7dbb6671d8a21df95 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 17 Sep 2025 12:35:37 -0700 Subject: [PATCH 04/13] more fixes --- .github/workflows/ci.yml | 4 ++-- Makefile | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0f7b517f3..dd96359f51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,12 +155,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - name: Setup Nightly Rust toolchain - uses: ./.github/actions/setup-builder - name: Install protoc uses: arduino/setup-protoc@v3 with: repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Setup Nightly Rust toolchain + uses: ./.github/actions/setup-builder - name: Setup MSRV Rust toolchain uses: ./.github/actions/setup-builder with: diff --git a/Makefile b/Makefile index dd55597a63..bfd10a3640 100644 --- a/Makefile +++ b/Makefile @@ -42,13 +42,9 @@ check-toml: install-taplo-cli taplo check check-msrv: - cargo generate-lockfile -Z direct-minimal-versions - if [ -n "$$rust_msrv" ]; then \ - cargo +$$rust_msrv check --locked --workspace; \ - else \ - cargo check --locked --workspace; \ - fi - git checkout -- Cargo.lock + cargo +nightly generate-lockfile -Z direct-minimal-versions + cargo +1.87 check --locked --workspace + git restore Cargo.lock check: check-fmt check-clippy check-toml cargo-machete From 563f249fa12f13269a65c04a8b433759f09d019b Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 17 Sep 2025 12:37:06 -0700 Subject: [PATCH 05/13] add comment --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bfd10a3640..1b3b41fdb4 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ check-toml: install-taplo-cli check-msrv: cargo +nightly generate-lockfile -Z direct-minimal-versions cargo +1.87 check --locked --workspace - git restore Cargo.lock + git restore Cargo.lock # prevent checking in Cargo.lock changes check: check-fmt check-clippy check-toml cargo-machete From 7ee11bcebe5c5e95b69c495df6341a7a6d4fcb10 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 17 Sep 2025 12:59:11 -0700 Subject: [PATCH 06/13] refactor --- .github/workflows/ci.yml | 2 -- Makefile | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd96359f51..b39e12a6ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,6 +166,4 @@ jobs: with: rust-version: ${{ env.rust_msrv }} - name: Check MSRV - env: - rust_msrv: ${{ env.rust_msrv }} run: make check-msrv diff --git a/Makefile b/Makefile index 1b3b41fdb4..2c21ac1bbe 100644 --- a/Makefile +++ b/Makefile @@ -42,9 +42,9 @@ check-toml: install-taplo-cli taplo check check-msrv: - cargo +nightly generate-lockfile -Z direct-minimal-versions - cargo +1.87 check --locked --workspace - git restore Cargo.lock # prevent checking in Cargo.lock changes + cargo generate-lockfile -Z direct-minimal-versions # uses the nightly version specified in rust-toolchain.toml + cargo +1.87 check --locked --workspace # keep in sync with MSRV in Cargo.toml + git restore Cargo.lock # prevent checking in Cargo.lock changes check: check-fmt check-clippy check-toml cargo-machete From 1b167c99a2b5fbec3722b714344f77941cc63013 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 17 Sep 2025 13:03:59 -0700 Subject: [PATCH 07/13] trap git restore --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2c21ac1bbe..87e7440ec0 100644 --- a/Makefile +++ b/Makefile @@ -42,9 +42,9 @@ check-toml: install-taplo-cli taplo check check-msrv: - cargo generate-lockfile -Z direct-minimal-versions # uses the nightly version specified in rust-toolchain.toml - cargo +1.87 check --locked --workspace # keep in sync with MSRV in Cargo.toml - git restore Cargo.lock # prevent checking in Cargo.lock changes + trap 'git restore Cargo.lock; exit 1' ERR # prevent checking in Cargo.lock changes + cargo generate-lockfile -Z direct-minimal-versions # uses the nightly version specified in rust-toolchain.toml + cargo +1.87 check --locked --workspace # keep in sync with MSRV in Cargo.toml check: check-fmt check-clippy check-toml cargo-machete From 7a8041fbbb6c84e30b8351f7f75524c3a1f9a145 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 17 Sep 2025 13:09:50 -0700 Subject: [PATCH 08/13] restore Cargo.lock on error --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 87e7440ec0..56fcd5a6e4 100644 --- a/Makefile +++ b/Makefile @@ -42,9 +42,9 @@ check-toml: install-taplo-cli taplo check check-msrv: - trap 'git restore Cargo.lock; exit 1' ERR # prevent checking in Cargo.lock changes - cargo generate-lockfile -Z direct-minimal-versions # uses the nightly version specified in rust-toolchain.toml - cargo +1.87 check --locked --workspace # keep in sync with MSRV in Cargo.toml + cargo generate-lockfile -Z direct-minimal-versions # uses the nightly version specified in rust-toolchain.toml + cargo +1.87 check --locked --workspace || true # keep in sync with MSRV in Cargo.toml + git restore Cargo.lock # prevent checking in Cargo.lock changes check: check-fmt check-clippy check-toml cargo-machete From 54d2f4d1b2b1a08e02d8bd10f6badf3d90474a80 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 17 Sep 2025 13:13:56 -0700 Subject: [PATCH 09/13] switch order --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b39e12a6ef..c08f1c60f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -159,11 +159,11 @@ jobs: uses: arduino/setup-protoc@v3 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Setup Nightly Rust toolchain - uses: ./.github/actions/setup-builder - name: Setup MSRV Rust toolchain uses: ./.github/actions/setup-builder with: rust-version: ${{ env.rust_msrv }} + - name: Setup Nightly Rust toolchain + uses: ./.github/actions/setup-builder - name: Check MSRV run: make check-msrv From cb9b48bac98f847ef6165c47ddca0eb03e57508b Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 17 Sep 2025 13:35:52 -0700 Subject: [PATCH 10/13] dont explicitly override version --- .github/actions/setup-builder/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/setup-builder/action.yml b/.github/actions/setup-builder/action.yml index 532174590f..c558ef4aca 100644 --- a/.github/actions/setup-builder/action.yml +++ b/.github/actions/setup-builder/action.yml @@ -33,7 +33,6 @@ runs: run: | echo "Installing ${RUST_VERSION}" rustup toolchain install ${RUST_VERSION} - rustup override set ${RUST_VERSION} rustup component add rustfmt clippy - name: Setup Rust toolchain according to rust-toolchain.toml shell: bash From 9ddf65034870eefd52095450bdaee06373e6ab53 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 17 Sep 2025 21:01:34 -0700 Subject: [PATCH 11/13] fix makefile --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 56fcd5a6e4..27ea7dadb0 100644 --- a/Makefile +++ b/Makefile @@ -41,10 +41,12 @@ fix-toml: install-taplo-cli check-toml: install-taplo-cli taplo check +NIGHTLY_VERSION := $(shell awk -F'"' '/^channel/ {print $$2}' rust-toolchain.toml) +MSRV_VERSION := $(shell awk -F'"' '/^rust-version/ {print $$2}' Cargo.toml) check-msrv: - cargo generate-lockfile -Z direct-minimal-versions # uses the nightly version specified in rust-toolchain.toml - cargo +1.87 check --locked --workspace || true # keep in sync with MSRV in Cargo.toml - git restore Cargo.lock # prevent checking in Cargo.lock changes + cargo +$(NIGHTLY_VERSION) generate-lockfile -Z direct-minimal-versions + cargo +$(MSRV_VERSION) check --locked --workspace || true + git restore Cargo.lock # prevents accidentally checking in Cargo.lock changes check: check-fmt check-clippy check-toml cargo-machete From 0f469a907b02dd8605dd3866e2e9285f52df3521 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 17 Sep 2025 21:01:45 -0700 Subject: [PATCH 12/13] revert --- .github/actions/setup-builder/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup-builder/action.yml b/.github/actions/setup-builder/action.yml index c558ef4aca..532174590f 100644 --- a/.github/actions/setup-builder/action.yml +++ b/.github/actions/setup-builder/action.yml @@ -33,6 +33,7 @@ runs: run: | echo "Installing ${RUST_VERSION}" rustup toolchain install ${RUST_VERSION} + rustup override set ${RUST_VERSION} rustup component add rustfmt clippy - name: Setup Rust toolchain according to rust-toolchain.toml shell: bash From ce1b205b4ed487bcb7eb1aee3bc38b051b92b8fb Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 17 Sep 2025 21:06:06 -0700 Subject: [PATCH 13/13] trap git restore --- Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 27ea7dadb0..1b98fe8fa1 100644 --- a/Makefile +++ b/Makefile @@ -42,11 +42,13 @@ check-toml: install-taplo-cli taplo check NIGHTLY_VERSION := $(shell awk -F'"' '/^channel/ {print $$2}' rust-toolchain.toml) -MSRV_VERSION := $(shell awk -F'"' '/^rust-version/ {print $$2}' Cargo.toml) +MSRV_VERSION := $(shell awk -F'"' '/^rust-version/ {print $$2}' Cargo.toml) + check-msrv: - cargo +$(NIGHTLY_VERSION) generate-lockfile -Z direct-minimal-versions - cargo +$(MSRV_VERSION) check --locked --workspace || true - git restore Cargo.lock # prevents accidentally checking in Cargo.lock changes + @set -e; \ + trap 'git restore Cargo.lock' EXIT; \ + cargo +$(NIGHTLY_VERSION) generate-lockfile -Z direct-minimal-versions; \ + cargo +$(MSRV_VERSION) check --locked --workspace check: check-fmt check-clippy check-toml cargo-machete