From bd83b517b96fd809c3ee0227d686151be5cfc33d Mon Sep 17 00:00:00 2001 From: Croto Bot Date: Fri, 27 Nov 2026 14:44:25 +0000 Subject: [PATCH 1/3] ci: make CI faster and stop filling artifact storage Run the tests with a ci profile that optimizes dependencies, share one Rust cache saved only from main, cancel superseded PR runs, stop the release PR from repeating the tests and building every wheel, and keep release artifacts for 7 days instead of 90. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 13 ++++++++++++- .github/workflows/release.yml | 35 ++++++++++++++++++++++++++++++++--- Cargo.toml | 9 +++++++++ README.md | 1 + docs/RELEASING.md | 9 +++++---- 5 files changed, 59 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62b05c2..ccd2477 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,10 @@ on: branches: [main] pull_request: +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: test: runs-on: ubuntu-latest @@ -15,6 +19,13 @@ jobs: toolchain: "1.98.0" components: clippy, rustfmt - uses: astral-sh/setup-uv@v6 + with: + cache-dependency-glob: tests/fixtures/uv.lock + # One cache for this job and release.yml's `checks`, saved only from main: a cache per + # branch fills the repository's 10 GB cache quota. - uses: Swatinem/rust-cache@v2 + with: + shared-key: test + save-if: ${{ github.ref == 'refs/heads/main' }} - run: cargo clippy --workspace --all-targets --locked -- -D warnings - - run: cargo test --workspace --locked + - run: cargo test --workspace --locked --profile ci diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 38bcff9..d5d2aa0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,9 @@ # (after approval in the `pypi` environment) and attaches them to the GitHub release. # Everything stays in this one workflow: tags made with GITHUB_TOKEN don't trigger other # workflows, and PyPI trusts this file by name. -# Pull requests that touch packaging build the wheels without publishing; so does a manual run. +# Pull requests that touch packaging build and smoke-test one Linux wheel, uploading nothing +# (ci.yml runs the tests). A manual run tests and builds every wheel without publishing. +# Artifacts live 7 days: long enough for the `pypi` approval, short enough for the storage quota. name: Release on: @@ -41,7 +43,7 @@ jobs: checks: needs: release-please - if: ${{ !cancelled() && (needs.release-please.outputs.created == 'true' || github.event_name != 'push') }} + if: ${{ !cancelled() && (needs.release-please.outputs.created == 'true' || github.event_name == 'workflow_dispatch') }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -50,7 +52,14 @@ jobs: toolchain: "1.98.0" components: clippy - uses: astral-sh/setup-uv@v6 + with: + cache-dependency-glob: tests/fixtures/uv.lock + save-cache: false + # ci.yml's cache; ci.yml saves it. - uses: Swatinem/rust-cache@v2 + with: + shared-key: test + save-if: false - name: Tag matches the workspace version if: needs.release-please.outputs.created == 'true' run: | @@ -58,7 +67,23 @@ jobs: | jq -r '.packages[] | select(.name == "hydroid") | .version') test "v$version" = "${{ needs.release-please.outputs.tag }}" - run: cargo clippy --workspace --all-targets --locked -- -D warnings - - run: cargo test --workspace --locked + - run: cargo test --workspace --locked --profile ci + + wheel-smoke: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: PyO3/maturin-action@v1 + with: + target: x86_64 + manylinux: auto + args: --release --locked --out dist + - uses: astral-sh/setup-uv@v6 + with: + enable-cache: false + - name: Smoke test the wheel + run: uvx --no-index --find-links dist --from hydroid-cli hydroid --version wheels: needs: checks @@ -84,6 +109,8 @@ jobs: args: --release --locked --out dist - if: matrix.smoke uses: astral-sh/setup-uv@v6 + with: + enable-cache: false - name: Smoke test the wheel if: matrix.smoke shell: bash @@ -92,6 +119,7 @@ jobs: with: name: wheels-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.manylinux || 'native' }} path: dist + retention-days: 7 sdist: needs: checks @@ -107,6 +135,7 @@ jobs: with: name: sdist path: dist + retention-days: 7 publish: needs: [release-please, wheels, sdist] diff --git a/Cargo.toml b/Cargo.toml index 6ed1e89..88b9fac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,3 +47,12 @@ inherits = "release" lto = false codegen-units = 16 incremental = true + +# CI tests (`--profile ci`): ty is far too slow unoptimized, so dependencies are optimized while +# the workspace keeps fast builds and debug assertions. Less debug info keeps `target/` small. +[profile.ci] +inherits = "dev" +debug = "line-tables-only" + +[profile.ci.package."*"] +opt-level = 2 diff --git a/README.md b/README.md index 0b38e96..b22ca57 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,7 @@ method, so the real implementation can be missed. What hydroid knowingly misses, ```sh cargo test --workspace # needs `uv`; syncs tests/fixtures/.venv from uv.lock +cargo test --workspace --profile ci # what CI runs: optimized deps, much faster tests scripts/corpus.sh [names] # Polar, mealie, lnbits, dispatch, litellm, open-webui, template ``` diff --git a/docs/RELEASING.md b/docs/RELEASING.md index b0b404e..c79863f 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -16,13 +16,14 @@ to PyPI as `hydroid-cli` by `.github/workflows/release.yml`. clippy and the tests, builds the wheels and the sdist, waits for approval in the `pypi` environment, publishes to PyPI and attaches the files to the GitHub release. -The release PR is created with `GITHUB_TOKEN`, so CI does not run on it; the release run -repeats clippy and the tests before anything is published. +CI runs clippy and the tests on every PR, the release PR too. The release run repeats them on +the tagged commit before anything is published. ## Dry run -Run the **Release** workflow by hand (Actions → Release → Run workflow), or open a PR that -touches packaging: it builds and smoke-tests every wheel without publishing. +Run the **Release** workflow by hand (Actions → Release → Run workflow): it runs the tests and +builds every wheel and the sdist without publishing. A PR that touches packaging builds and +smoke-tests only the Linux x86_64 wheel, and uploads nothing. ## Setup (done once) From 68a624eca88615cc9433325a32feb6cae4960153 Mon Sep 17 00:00:00 2001 From: Croto Bot Date: Fri, 27 Nov 2026 14:46:58 +0000 Subject: [PATCH 2/3] ci: keep every main push running, document release approvals Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 5 +++-- docs/RELEASING.md | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ccd2477..01b0318 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,9 +5,10 @@ on: branches: [main] pull_request: +# A new push to a PR cancels its older run; every push to main runs. concurrency: - group: ci-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} + group: ci-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} + cancel-in-progress: true jobs: test: diff --git a/docs/RELEASING.md b/docs/RELEASING.md index c79863f..bbb11f8 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -16,8 +16,12 @@ to PyPI as `hydroid-cli` by `.github/workflows/release.yml`. clippy and the tests, builds the wheels and the sdist, waits for approval in the `pypi` environment, publishes to PyPI and attaches the files to the GitHub release. -CI runs clippy and the tests on every PR, the release PR too. The release run repeats them on -the tagged commit before anything is published. +CI runs clippy and the tests on every PR, the release PR too. The release PR is opened with +`GITHUB_TOKEN`, so its CI waits until you select **Approve workflows to run** on it. The release +run repeats clippy and the tests on the tagged commit before anything is published. + +Approve the `pypi` deployment within 7 days: the built wheels expire after that, and the +publish jobs then fail. ## Dry run From c0e08537166459a39a7d348a573f79c9ffbd69b9 Mon Sep 17 00:00:00 2001 From: Croto Bot Date: Fri, 27 Nov 2026 14:48:28 +0000 Subject: [PATCH 3/3] docs: say when the release artifacts expire Co-Authored-By: Claude Opus 5.5 --- docs/RELEASING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/RELEASING.md b/docs/RELEASING.md index bbb11f8..ab02e8a 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -20,8 +20,8 @@ CI runs clippy and the tests on every PR, the release PR too. The release PR is `GITHUB_TOKEN`, so its CI waits until you select **Approve workflows to run** on it. The release run repeats clippy and the tests on the tagged commit before anything is published. -Approve the `pypi` deployment within 7 days: the built wheels expire after that, and the -publish jobs then fail. +Approve the `pypi` deployment within 7 days of the release run: the wheels and the sdist expire +7 days after upload, and the publish jobs then fail. ## Dry run