From 1693976099ae64696fd4f38cfe167bc1cb7e91c7 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 8 Nov 2026 11:05:49 +0100 Subject: [PATCH 1/3] Move the check list into the workflow and download nextest The README's Development section duplicated the workflow's command list and shipped it as the crate's docs.rs page, so the nine commands now live only in `.github/workflows/tests.yml`, and the rule in `AGENTS.md` points there. nextest now comes from its official distribution at a pinned version instead of being built from crates.io, which drops the install cache and the compiler work from that job. --- .github/workflows/tests.yml | 24 ++++++++---------------- AGENTS.md | 2 +- README.md | 25 ------------------------- 3 files changed, 9 insertions(+), 42 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 63e6bde6..6e5a85ef 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,11 +21,11 @@ permissions: contents: read # To minimize supply-chain exposure this workflow uses only GitHub's own -# first-party actions; every toolchain and tool is installed from rustup, -# crates.io, or the checked-in sources. +# first-party actions; every toolchain and tool is installed from rustup, the +# tool's official distribution, 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. +# Every job runs one of the repository's checks, and this file is where that +# list lives, so a contributor can reproduce any job from here. jobs: fmt: name: Rustfmt (nightly-2026-11-05) @@ -61,19 +61,11 @@ jobs: - uses: actions/checkout@v4 - name: Install the pinned toolchain run: rustup toolchain install - # 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 + # The official nextest distribution, at a pinned version: a prebuilt binary, + # so the job needs no compiler for it. + - name: Install cargo-nextest from the official distribution 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" + curl -LsSf https://get.nexte.st/0.9.151/linux | tar zxf - -C "${CARGO_HOME:-$HOME/.cargo}/bin" # 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. diff --git a/AGENTS.md b/AGENTS.md index 50392c0b..ed70cbbe 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -45,7 +45,7 @@ update this block to match. - Treat [CHANGELOG.md](CHANGELOG.md) as the record of which macro forms are current and which are removed. - Add a `///` to every public item that lacks one, and keep inline docs brief. -- Run the repository's checks before committing; the commands are in [README.md](README.md). +- Run the repository's checks before committing; [`.github/workflows/tests.yml`](.github/workflows/tests.yml) lists them, and CI runs the same commands. - Put a post-codegen compile failure in a `cargo-cgp` UI fixture, not in this repository, and update the matching fixture when a construct change alters a diagnostic. diff --git a/README.md b/README.md index 95d6e005..b06bd517 100644 --- a/README.md +++ b/README.md @@ -242,31 +242,6 @@ Contributions, questions, and bug reports are welcome. Open an [contribute page](https://contextgeneric.dev/docs/contribute) to get oriented first. Unless stated otherwise, contributions are made under the terms of the Apache-2.0 license below. -### Development - -Run the checks from the repository root. The toolchain is pinned in `rust-toolchain.toml`, and most -crates are `#![no_std]`, so keep new code `no_std`-compatible. - -```sh -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). - ## License Licensed under the [Apache License, Version 2.0](LICENSE). From f84e86c4b9cb162c182317cf47d7b67ec2ecd4da Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 8 Nov 2026 11:12:45 +0100 Subject: [PATCH 2/3] Retry the nextest download The official distribution answered 504 on the first run of the PR and the step failed, because a single curl attempt had no retry. curl now retries the whole request up to five times, so a transient gateway error does not fail the job. --- .github/workflows/tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6e5a85ef..33e57835 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -62,10 +62,12 @@ jobs: - name: Install the pinned toolchain run: rustup toolchain install # The official nextest distribution, at a pinned version: a prebuilt binary, - # so the job needs no compiler for it. + # so the job needs no compiler for it. The host answers 504 under load, so + # curl retries the whole request rather than leaving a partial stream to tar. - name: Install cargo-nextest from the official distribution run: | - curl -LsSf https://get.nexte.st/0.9.151/linux | tar zxf - -C "${CARGO_HOME:-$HOME/.cargo}/bin" + curl -LsSf --retry 5 --retry-delay 2 --retry-all-errors \ + https://get.nexte.st/0.9.151/linux | tar zxf - -C "${CARGO_HOME:-$HOME/.cargo}/bin" # 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. From 3ae1ac6c4fd42e706eac80b508bb5ece888c8972 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Sun, 8 Nov 2026 11:24:38 +0100 Subject: [PATCH 3/3] Fall back to crates.io when the nextest download fails The official distribution answered 504 on every attempt of one run, which failed the job even though the same download had worked minutes earlier. A failed download now builds the same pinned version from crates.io, so an outage of one host does not fail the suite. --- .github/workflows/tests.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 33e57835..51d5202b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -62,12 +62,17 @@ jobs: - name: Install the pinned toolchain run: rustup toolchain install # The official nextest distribution, at a pinned version: a prebuilt binary, - # so the job needs no compiler for it. The host answers 504 under load, so - # curl retries the whole request rather than leaving a partial stream to tar. + # so the job needs no compiler for it. The host intermittently answers 504, + # so a failed download builds the same pinned version from crates.io instead + # of failing the job. - name: Install cargo-nextest from the official distribution run: | - curl -LsSf --retry 5 --retry-delay 2 --retry-all-errors \ - https://get.nexte.st/0.9.151/linux | tar zxf - -C "${CARGO_HOME:-$HOME/.cargo}/bin" + set -o pipefail + if ! curl -LsSf --retry 3 --retry-delay 2 --retry-all-errors \ + https://get.nexte.st/0.9.151/linux | tar zxf - -C "${CARGO_HOME:-$HOME/.cargo}/bin"; then + echo "the official distribution did not answer; building 0.9.151 from crates.io" >&2 + cargo install --locked cargo-nextest --version 0.9.151 + fi # 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.