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 638b763a7..000000000 Binary files a/libempty_match.rlib and /dev/null differ