diff --git a/.github/justfile b/.github/justfile index b9fb18921b5..24034a27bcd 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 @@ -116,3 +117,7 @@ benchmark-publish *args: # Commit a built report to gh-pages under one directory, leaving the branch checked out for the deploy. pages-publish directory report site: sh/gh/pages-publish.sh {{ quote(directory) }} {{ quote(report) }} {{ quote(site) }} + +# 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/interop.yml b/.github/workflows/interop.yml index 97dbd59da4e..6cd6c34b1d6 100644 --- a/.github/workflows/interop.yml +++ b/.github/workflows/interop.yml @@ -219,7 +219,7 @@ jobs: cancel-in-progress: false queue: max permissions: - # Deletes a stale Pages artifact. + # Delete a Pages artifact left by an earlier run attempt. actions: write contents: write pages: write @@ -245,14 +245,10 @@ jobs: - name: Commit report run: just gh pages-publish interop "$RUNNER_TEMP/interop-report" "$RUNNER_TEMP/pages" - # A re-run attempt sees the earlier attempt's Pages artifact beside its own, and - # deploy-pages refuses to choose between them. - name: Drop a stale Pages artifact + run: just gh pages-clean env: GH_TOKEN: ${{ github.token }} - run: | - gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/artifacts?name=github-pages" --jq '.artifacts[].id' | - while read -r id; do gh api -X DELETE "repos/$GITHUB_REPOSITORY/actions/artifacts/$id"; done - name: Upload site uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 2ab4461436b..c27ead98c8a 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -244,6 +244,8 @@ jobs: cancel-in-progress: false queue: max permissions: + # Delete a Pages artifact left by an earlier run attempt. + actions: write contents: write pages: write id-token: write @@ -297,6 +299,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 55020cebb67..29082b8c7b1 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -399,6 +399,8 @@ jobs: cancel-in-progress: false queue: max permissions: + # Delete a Pages artifact left by an earlier run attempt. + actions: write contents: write pages: write id-token: write @@ -423,6 +425,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 5e5e87c05b5..a40a69393a5 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -127,7 +127,7 @@ lite-07 stream type here. - [moq-net compiles once](/quest/m1/net-erase-transport.md) - the session drivers stop monomorphizing per transport and per crate, saving several MiB of the relay, FFI library, `libmoq` and CLI - [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 - [Interop audio delivery](/quest/m1/interop-audio.md) - every interop subscriber decodes and checks the publishers' 440 Hz tone, and the Rust publisher sends Opus - [AAC in the native JS fallback](/quest/m1/libav-aac.md) - Node and Bun players decode AAC, and the Rust interop publisher adds an AAC track - [Native audio decode conformance](/quest/m1/audio-decode-conformance.md) - Opus and AAC decode through every moq-audio backend, moq-c, and moq-ffi is checked against known tones and clips, like moq-video's suite diff --git a/quest/m1/ci-housekeeping.md b/quest/m1/ci-housekeeping.md index 48232393edf..ae1ea6c4952 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) added 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()