From 1b3a2bab278f12d292f784bd5574c8ce6369dcf3 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sat, 20 Dec 2025 13:43:16 +0000 Subject: [PATCH 1/2] add MSRV check to CI --- .github/workflows/rust.yml | 13 +++++++++++++ Cargo.toml | 3 +++ cargo-typify/Cargo.toml | 1 + typify-impl/Cargo.toml | 1 + typify-macro/Cargo.toml | 1 + typify-test/Cargo.toml | 2 +- typify/Cargo.toml | 1 + 7 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index da63d037..6ca9c240 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -32,3 +32,16 @@ jobs: run: cargo build --locked --tests --verbose - name: Run tests run: cargo test --locked --verbose + + msrv: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: taiki-e/install-action@cargo-hack + - name: Check published packages on their declared MSRV + run: >- + cargo hack --workspace + --exclude typify-test + --exclude example-build + --exclude example-macro + --no-dev-deps --rust-version check diff --git a/Cargo.toml b/Cargo.toml index 4848b80c..fba808f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,9 @@ members = [ resolver = "2" +[workspace.package] +rust-version = "1.88.0" + [workspace.dependencies] typify = { version = "0.10.1", path = "typify" } typify-impl = { version = "0.10.1", path = "typify-impl" } diff --git a/cargo-typify/Cargo.toml b/cargo-typify/Cargo.toml index 7d89c0fc..c20050bf 100644 --- a/cargo-typify/Cargo.toml +++ b/cargo-typify/Cargo.toml @@ -8,6 +8,7 @@ repository = "https://github.com/oxidecomputer/typify" readme = "README.md" keywords = ["json", "schema", "cargo"] categories = ["api-bindings", "compilers"] +rust-version.workspace = true default-run = "cargo-typify" diff --git a/typify-impl/Cargo.toml b/typify-impl/Cargo.toml index bcbded6b..3679c1d0 100644 --- a/typify-impl/Cargo.toml +++ b/typify-impl/Cargo.toml @@ -6,6 +6,7 @@ license = "Apache-2.0" description = "typify backend implementation" repository = "https://github.com/oxidecomputer/typify" readme = "../README.md" +rust-version.workspace = true [dependencies] heck = { workspace = true } diff --git a/typify-macro/Cargo.toml b/typify-macro/Cargo.toml index f52a924d..1461c1f3 100644 --- a/typify-macro/Cargo.toml +++ b/typify-macro/Cargo.toml @@ -6,6 +6,7 @@ license = "Apache-2.0" description = "typify macro implementation" repository = "https://github.com/oxidecomputer/typify" readme = "../README.md" +rust-version.workspace = true [lib] proc-macro = true diff --git a/typify-test/Cargo.toml b/typify-test/Cargo.toml index 8bde90cd..794168d3 100644 --- a/typify-test/Cargo.toml +++ b/typify-test/Cargo.toml @@ -14,6 +14,6 @@ typify = { path = "../typify" } ipnetwork = { workspace = true } prettyplease = { workspace = true } schemars = { workspace = true } -serde = { workspace = true } +serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } syn = { workspace = true } diff --git a/typify/Cargo.toml b/typify/Cargo.toml index 50283602..0a891d72 100644 --- a/typify/Cargo.toml +++ b/typify/Cargo.toml @@ -8,6 +8,7 @@ repository = "https://github.com/oxidecomputer/typify" readme = "../README.md" keywords = ["json", "schema", "proc_macro"] categories = ["api-bindings", "compilers"] +rust-version.workspace = true [features] default = ["macro"] From 448e5f45e6623cd664607e13e0019be3386e48d3 Mon Sep 17 00:00:00 2001 From: "Adam H. Leventhal" Date: Mon, 16 Nov 2026 19:31:58 -0800 Subject: [PATCH 2/2] check the MSRV with a real build-and-test leg The msrv job builds and runs the suite on 1.97, the version typespace requires, instead of a cargo-hack check at 1.88. Actions are pinned by SHA, clippy and docs jobs deny warnings, and the existing job names stay as they are so branch protection keeps matching. --- .github/workflows/rust.yml | 77 +++++++++++++++++++++++++++++++------- Cargo.toml | 2 +- typify-test/Cargo.toml | 2 +- 3 files changed, 65 insertions(+), 16 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6ca9c240..c9ca9c36 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -8,40 +8,89 @@ on: branches: [ main ] pull_request: branches: [ main ] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: check-style: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: Report cargo version run: cargo --version - name: Report rustfmt version run: cargo fmt -- --version - name: Check style - run: cargo fmt -- --check + run: cargo fmt --all -- --check + + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 + - name: Report clippy version + run: cargo clippy --version + - name: Run clippy + run: cargo clippy --locked --workspace --all-targets --all-features -- -D warnings + + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 + - name: Build documentation + run: cargo doc --locked --no-deps --all-features --workspace + env: + RUSTDOCFLAGS: -D warnings + # Runs everything, including the trybuild compile-fail test, under the + # toolchain pinned by rust-toolchain.toml. build-and-test: runs-on: ${{ matrix.os }} strategy: matrix: os: [ ubuntu-latest, windows-latest, macos-latest ] steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 - name: Build - run: cargo build --locked --tests --verbose + run: cargo build --locked --workspace --tests --verbose - name: Run tests - run: cargo test --locked --verbose + run: cargo test --locked --workspace --no-fail-fast --verbose msrv: runs-on: ubuntu-latest + env: + # rust-toolchain.toml would otherwise override whatever + # dtolnay/rust-toolchain selects; this variable overrides + # rust-toolchain.toml, so this job really uses the MSRV compiler. + # Without it the job silently builds with the pinned toolchain and + # proves nothing. + RUSTUP_TOOLCHAIN: "1.97" steps: - - uses: actions/checkout@v2 - - uses: taiki-e/install-action@cargo-hack - - name: Check published packages on their declared MSRV - run: >- - cargo hack --workspace - --exclude typify-test - --exclude example-build - --exclude example-macro - --no-dev-deps --rust-version check + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable + with: + # Keep "1.97" (here and in RUSTUP_TOOLCHAIN above) in sync with + # rust-version in Cargo.toml. + toolchain: "1.97" + - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 + with: + key: msrv + - name: Report cargo version + run: cargo --version + - name: Report rustc version + run: rustc --version + - name: Build + run: cargo build --locked --workspace --tests --verbose + - name: Run tests + # test_compile_fail (trybuild) runs in build-and-test, on the + # pinned toolchain: it compares against compiler diagnostics, + # which drift between releases. + run: cargo test --locked --workspace --no-fail-fast --verbose -- --skip test_compile_fail diff --git a/Cargo.toml b/Cargo.toml index fba808f1..ef67bd8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ members = [ resolver = "2" [workspace.package] -rust-version = "1.88.0" +rust-version = "1.97" [workspace.dependencies] typify = { version = "0.10.1", path = "typify" } diff --git a/typify-test/Cargo.toml b/typify-test/Cargo.toml index 794168d3..8bde90cd 100644 --- a/typify-test/Cargo.toml +++ b/typify-test/Cargo.toml @@ -14,6 +14,6 @@ typify = { path = "../typify" } ipnetwork = { workspace = true } prettyplease = { workspace = true } schemars = { workspace = true } -serde = { workspace = true, features = ["derive"] } +serde = { workspace = true } serde_json = { workspace = true } syn = { workspace = true }