From 59b669940870f9bf8c039a7398e1a080539cdc06 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 8 Nov 2026 10:27:18 +0100 Subject: [PATCH] Run every documented check in CI The workflow ran the format, clippy, and test commands but not the docs build, the declared minimum Rust version, or the `no_std` build, so a regression in any of them reached `main` unnoticed. It also installed nextest from a third-party host and a floating nightly for rustfmt. The new jobs run the commands the README now lists, nextest comes from crates.io at a pinned version, and rustfmt runs on a pinned nightly. The stray `libempty_match.rlib` is gone and `.gitignore` covers build artifacts. --- .github/workflows/tests.yml | 82 ++++++++++++++++++++++++++++++------ .gitignore | 5 ++- README.md | 11 ++++- libempty_match.rlib | Bin 6936 -> 0 bytes 4 files changed, 83 insertions(+), 15 deletions(-) delete mode 100644 libempty_match.rlib diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3a1c85640..63e6bde6d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,24 +21,32 @@ permissions: contents: read # To minimize supply-chain exposure this workflow uses only GitHub's own -# first-party checkout action; every toolchain and tool is installed with the -# rustup/cargo already present on the runner. +# first-party actions; every toolchain and tool is installed from rustup, +# crates.io, or the checked-in sources. +# +# Every job runs a command the README's Development section lists, so a +# contributor can reproduce any job from the README. jobs: fmt: - name: Rustfmt (nightly) + name: Rustfmt (nightly-2026-11-05) runs-on: ubuntu-latest + timeout-minutes: 15 steps: - uses: actions/checkout@v4 - - name: Install nightly rustfmt - run: rustup toolchain install nightly --profile minimal --component rustfmt - - run: cargo +nightly fmt --all -- --check + # `.rustfmt.toml` sets `group_imports` and `imports_granularity`, which are + # unstable options, so rustfmt needs a nightly. The channel is pinned so a + # reformat cannot land without a commit. + - name: Install the pinned nightly for rustfmt + run: rustup toolchain install nightly-2026-11-05 --profile minimal --component rustfmt + - run: cargo +nightly-2026-11-05 fmt --all -- --check clippy: name: Clippy runs-on: ubuntu-latest + timeout-minutes: 30 steps: - uses: actions/checkout@v4 - - name: Install pinned toolchain + - name: Install the pinned toolchain run: rustup toolchain install - name: Clippy (all features) run: cargo clippy --all-features --all-targets -- -D warnings @@ -51,12 +59,60 @@ jobs: timeout-minutes: 30 steps: - uses: actions/checkout@v4 - - name: Install pinned toolchain + - name: Install the pinned toolchain run: rustup toolchain install - # Prebuilt binary from the official nextest distribution. - - name: Install cargo-nextest - run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin - # Runs the whole workspace, including the trybuild compile-fail fixtures in - # cgp-compile-fail-tests (an ordinary integration test nextest picks up). + # nextest comes from crates.io at a pinned version, into its own root so the + # cache holds nothing but nextest and its dependencies. + - name: Cache cargo-nextest + uses: actions/cache@v4 + with: + path: ~/.local/cargo-nextest + key: ${{ runner.os }}-cargo-nextest-0.9.151 + - name: Install cargo-nextest from crates.io + run: | + if [ ! -x "$HOME/.local/cargo-nextest/bin/cargo-nextest" ]; then + cargo install --locked cargo-nextest --version 0.9.151 --root "$HOME/.local/cargo-nextest" + fi + echo "$HOME/.local/cargo-nextest/bin" >> "$GITHUB_PATH" + # The suite covers `cgp-tests` for behavior and expansion snapshots and + # `cgp-macro-tests` for the macro internals. Post-codegen compile failures + # are UI fixtures in `cargo-cgp`, not tests here. - name: Run tests run: cargo nextest run --all-features --no-fail-fast --workspace + + doc: + name: Docs + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - name: Install the pinned toolchain + run: rustup toolchain install + - name: Build the docs with warnings denied + run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --workspace --all-features + + msrv: + name: Minimum Rust (1.89) + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - name: Install the declared minimum toolchain + run: rustup toolchain install 1.89 --profile minimal + - name: Check the workspace on the declared minimum + run: cargo +1.89 check --workspace --all-features + + no_std: + name: No std + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - name: Install the pinned toolchain and the bare-metal target + run: | + rustup toolchain install + rustup target add x86_64-unknown-none + - name: Check without std + run: cargo check -p cgp-no-std-tests --target x86_64-unknown-none + - name: Check with alloc + run: cargo check -p cgp-no-std-tests --target x86_64-unknown-none --features alloc diff --git a/.gitignore b/.gitignore index c41cc9e35..1fcf2c3f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -/target \ No newline at end of file +/target +# A build artifact that was committed once; keep the next one out. +*.rlib +*.rmeta diff --git a/README.md b/README.md index abd3e5d33..95d6e005a 100644 --- a/README.md +++ b/README.md @@ -248,12 +248,21 @@ Run the checks from the repository root. The toolchain is pinned in `rust-toolch crates are `#![no_std]`, so keep new code `no_std`-compatible. ```sh -cargo +nightly fmt --all +cargo +nightly-2026-11-05 fmt --all cargo clippy --all-features --all-targets -- -D warnings cargo clippy --no-default-features --all-targets -- -D warnings cargo nextest run --all-features --no-fail-fast --workspace +RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --workspace --all-features +cargo +1.89 check --workspace --all-features +rustup target add x86_64-unknown-none +cargo check -p cgp-no-std-tests --target x86_64-unknown-none +cargo check -p cgp-no-std-tests --target x86_64-unknown-none --features alloc ``` +The first command needs the `nightly-2026-11-05` toolchain, because `.rustfmt.toml` sets unstable +options; CI installs that exact channel. The last five check the docs, the declared minimum Rust +version, and both `no_std` paths, and CI runs each of them. + The suite covers `cgp-tests` for behavior and expansion snapshots and `cgp-macro-tests` for the macro internals. Post-codegen compile failures are UI fixtures in [`cargo-cgp`](https://github.com/contextgeneric/cargo-cgp). diff --git a/libempty_match.rlib b/libempty_match.rlib deleted file mode 100644 index 638b763a79d76474f384eebdc9d0de47e82886be..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6936 zcmc&Ze|QsBws(@5Oq!-ifT}H~*(t3oV$)70X_}!e+csFr%F~L9sOxJdGZR{E+B6OQ zfvmO^2|UYZWxLw-xzD1!^~Z-#Ko)VuCn10pix%BoK>=H75nSZ=vVMy4&YdJB6nLNe zy+7Xl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