Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 69 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/target
/target
# A build artifact that was committed once; keep the next one out.
*.rlib
*.rmeta
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Binary file removed libempty_match.rlib
Binary file not shown.
Loading