From 9d74f238ed1fb523e294ad95272e35e35054c6dc Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 21 Oct 2026 14:35:42 -0700 Subject: [PATCH 1/2] chore: claim CI housekeeping quest Co-Authored-By: GPT-6 From 33fe04c7d2ccef7108054c525dbea0b2deab5f05 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 21 Oct 2026 14:44:35 -0700 Subject: [PATCH 2/2] fix(ci): clear stale Pages artifacts before report reruns Share run-scoped artifact cleanup between nightly and relay report publishers. Retain queue oversubscription until loaded validation passes, plus the actionlint release condition. Co-Authored-By: GPT-6 --- .github/justfile | 5 +++ .github/workflows/nightly.yml | 7 ++++ .github/workflows/smoke.yml | 8 +++++ quest/m1/README.md | 2 +- quest/m1/ci-housekeeping.md | 36 +++++++++++---------- sh/gh/pages-clean.sh | 10 ++++++ sh/gh/pages-clean.test.py | 61 +++++++++++++++++++++++++++++++++++ 7 files changed, 111 insertions(+), 18 deletions(-) create mode 100755 sh/gh/pages-clean.sh create mode 100644 sh/gh/pages-clean.test.py diff --git a/.github/justfile b/.github/justfile index 9d5935e8ad5..d22a566d6fc 100644 --- a/.github/justfile +++ b/.github/justfile @@ -40,6 +40,7 @@ test: python3 sh/rs/test-lints.test.py python3 sh/rs/model-markers.test.py python3 sh/gh/nightly.test.py + python3 sh/gh/pages-clean.test.py python3 sh/gh/bench-report.test.py python3 sh/gh/ts-paths.test.py sh/go/publish-wrapper.test.sh @@ -112,3 +113,7 @@ ffi *args: [positional-arguments] benchmark-publish *args: sh/gh/bench-publish.sh "$@" + +# Delete this run's Pages artifact before uploading a replacement on a rerun. +pages-clean: + sh/gh/pages-clean.sh diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 24f4253d08d..9884a4b251d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -241,6 +241,8 @@ jobs: group: benchmark-pages cancel-in-progress: false permissions: + # Delete a Pages artifact left by an earlier run attempt. + actions: write contents: write pages: write id-token: write @@ -294,6 +296,11 @@ jobs: fail-on-alert: false - name: Publish shared history run: nix shell --inputs-from . nixpkgs#just --command just gh benchmark-publish finish benchmark-site + - name: Drop a stale Pages artifact + run: nix shell --inputs-from . nixpkgs#just --command just gh pages-clean + env: + GH_TOKEN: ${{ github.token }} + - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 with: path: benchmark-site diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 2cb761aef66..4fda25a6050 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -397,6 +397,8 @@ jobs: group: benchmark-pages cancel-in-progress: false permissions: + # Delete a Pages artifact left by an earlier run attempt. + actions: write contents: write pages: write id-token: write @@ -421,6 +423,12 @@ jobs: - name: Commit report run: just publish "$RUNNER_TEMP/relay-report" "$RUNNER_TEMP/pages" + - name: Drop a stale Pages artifact + working-directory: . + run: just gh pages-clean + env: + GH_TOKEN: ${{ github.token }} + - name: Upload site uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 with: diff --git a/quest/m1/README.md b/quest/m1/README.md index 2c7ec96538c..5f07a10c5c7 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -113,7 +113,7 @@ lands before the cut. - [C++ and OBS package proof](/quest/m1/cpp-package-check.md) - the installed artifacts pass before their first release - [Binding check cost](/quest/m1/binding-check-cost.md) - `moq.cpp` compiles once per C++ standard and Gradle stays warm, measured before and after - [Audio devices on ARM](/quest/m1/audio-devices-arm.md) - `just rs audio-devices` passes on the hosted ARM runner -- [CI housekeeping](/quest/m1/ci-housekeeping.md) - queue nextest at 24 threads, stale Pages artifacts cleared, the actionlint ignore dropped +- [CI housekeeping](/quest/m1/ci-housekeeping.md) - validate queue nextest at 24 threads and remove the actionlint queue ignore after its release - [Smoke flake bumps](/quest/m1/smoke-dependabot.md) - `test/smoke/flake.lock` bumps with its Playwright pin, automated or documented - [Playwright browsers from Nix](/quest/m1/playwright-nix.md) - every Playwright check runs on Nix's Chromium locally and in CI, with npm pinned to match diff --git a/quest/m1/ci-housekeeping.md b/quest/m1/ci-housekeeping.md index 48232393edf..063171476d4 100644 --- a/quest/m1/ci-housekeeping.md +++ b/quest/m1/ci-housekeeping.md @@ -1,13 +1,9 @@ -# [XS] CI housekeeping +# [XS] Finish CI housekeeping ## Goal -Three small CI changes land together: - -- The merge queue's nextest runs with `NEXTEST_TEST_THREADS=24`. -- Nightly `benchmark-site` and smoke `relays-report` delete an earlier - attempt's stale `github-pages` artifact before uploading, as interop's - report job does. +- The merge queue's nextest runs with `NEXTEST_TEST_THREADS=24` after loaded + validation passes. - `.github/actionlint.yaml` drops its ignore for the `queue` key once an actionlint release after 1.7.12 is in the dev shell. @@ -15,16 +11,22 @@ Three small CI changes land together: - **Threads.** Recommended in [moq-dev/moq#6174](https://github.com/moq-dev/moq/pull/6174): the suite - needs about 200 CPU-seconds, and most slots wait on sockets, subprocesses, - and timeouts. Pinned to 8 CPUs it took 105 to 113 s at 8 threads and 47 s - at 24. Set it for the queue job only, after a few loaded - `just check --all` runs at 24; a flake there points at a test to fix. -- **Pages artifact** and **actionlint** both come from - [moq-dev/moq#6180](https://github.com/moq-dev/moq/pull/6180). A re-run of - either nightly job fails on the stale artifact today. The actionlint fix, - [rhysd/actionlint#661](https://github.com/rhysd/actionlint/pull/661), is - merged but unreleased; if no release reaches nixpkgs by the time the rest - is ready, land the rest and leave this bullet. + spends most slots waiting. Run a few loaded `just check --all` passes at + 24 before setting it for the queue job only. A full Rust test selection + with 24 workers pinned to eight CPUs failed + `export::redundant_importers_switch_to_the_survivor_and_back_on_lite_07` + ("stitching export exited") and + `stats::a_late_sink_reads_the_final_stats` + ("the import exited before its input ended"). nextest stopped after + 1,870 of 9,398 tests: 1,868 passed, two failed. Investigate these failures + before enabling the setting; don't mask them with retries or longer + timeouts. [moq-dev/moq#6113](https://github.com/moq-dev/moq/pull/6113) + already edits the redundant-importer tests. +- **Actionlint.** [rhysd/actionlint#661](https://github.com/rhysd/actionlint/pull/661) + is merged but unreleased. The dev shell still has actionlint 1.7.12. + [moq-dev/moq#6180](https://github.com/moq-dev/moq/pull/6180) adds the + ignore for the three Pages publishing workflows; remove it when the + release reaches nixpkgs and `just gh check` accepts `queue: max`. Public API: none. Wire: none. diff --git a/sh/gh/pages-clean.sh b/sh/gh/pages-clean.sh new file mode 100755 index 00000000000..9cc86ecfe36 --- /dev/null +++ b/sh/gh/pages-clean.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -euo pipefail + +# deploy-pages refuses to choose between artifacts from different run attempts. +# Scope deletion to this run so other Pages publishers keep their artifacts. +: "${GITHUB_REPOSITORY:?}" "${GITHUB_RUN_ID:?}" +artifacts=$(gh api --paginate "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/artifacts?name=github-pages" --jq '.artifacts[].id') +for id in $artifacts; do + gh api -X DELETE "repos/$GITHUB_REPOSITORY/actions/artifacts/$id" +done diff --git a/sh/gh/pages-clean.test.py b/sh/gh/pages-clean.test.py new file mode 100644 index 00000000000..15c65de02e6 --- /dev/null +++ b/sh/gh/pages-clean.test.py @@ -0,0 +1,61 @@ +"""A Pages rerun replaces only its own artifact and refuses API failures.""" + +import os +from pathlib import Path +import subprocess +import tempfile +import unittest + + +ROOT = Path(__file__).resolve().parents[2] + + +class PagesCleanTest(unittest.TestCase): + def run_clean(self, artifacts="", fail=""): + with tempfile.TemporaryDirectory() as directory: + scratch = Path(directory) + calls = scratch / "calls" + stub = scratch / "gh" + stub.write_text( + '#!/usr/bin/env bash\n' + 'printf "%s\\n" "$*" >> "$PAGES_CALLS"\n' + 'if [[ "$*" == "$PAGES_FAIL" ]]; then exit 1; fi\n' + 'if [[ "$2" == --paginate ]]; then printf "%s\\n" "$PAGES_ARTIFACTS"; fi\n' + ) + stub.chmod(0o755) + env = dict(os.environ, PATH=f"{scratch}:{os.environ['PATH']}", + GITHUB_REPOSITORY="owner/repo", GITHUB_RUN_ID="123", + PAGES_CALLS=str(calls), PAGES_ARTIFACTS=artifacts, + PAGES_FAIL=fail, BASH_ENV="/dev/null") + result = subprocess.run(["bash", "sh/gh/pages-clean.sh"], cwd=ROOT, + env=env, capture_output=True, text=True) + return result, calls.read_text().splitlines() + + def test_rerun_deletes_all_prior_attempts_in_this_run(self): + result, calls = self.run_clean("41\n42") + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(calls, [ + "api --paginate repos/owner/repo/actions/runs/123/artifacts?name=github-pages --jq .artifacts[].id", + "api -X DELETE repos/owner/repo/actions/artifacts/41", + "api -X DELETE repos/owner/repo/actions/artifacts/42", + ]) + + def test_first_attempt_has_nothing_to_delete(self): + result, calls = self.run_clean() + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(len(calls), 1) + + def test_failed_listing_stops_before_any_deletion(self): + listing = "api --paginate repos/owner/repo/actions/runs/123/artifacts?name=github-pages --jq .artifacts[].id" + result, calls = self.run_clean("41\n42", fail=listing) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(calls, [listing]) + + def test_failed_deletion_stops_the_upload(self): + result, calls = self.run_clean("41\n42", fail="api -X DELETE repos/owner/repo/actions/artifacts/41") + self.assertNotEqual(result.returncode, 0) + self.assertEqual(len(calls), 2) + + +if __name__ == "__main__": + unittest.main()