# ci-release ## Goal Automate the checks and the release. Every push to master runs the three checks CLAUDE.md requires (fmt, clippy, test) on Gitea Actions; every tag `vX.Y.Z` builds the full cross-platform artifact set (Apple Silicon + x86_64 macOS, static-musl x86-64/ARM64 and RHEL 8-compatible Linux, Windows — both binaries each — plus the seven `.vsix` packages and `SHA256SUMS`) and publishes a Gitea release whose notes are the CHANGELOG section for that version. **Published assets are the seven `.vsix` packages only** (since 2026-08-27, owner decision): the extension is the product a release delivers, every package is checked by name before publishing, and the loose binaries — still built and audited, since the packages embed them — stay unpublished; a standalone binary is `cargo build --release` for whoever wants one (docs/features/editor-platform-vsix). The point is that a release is one `git tag` + `git push` and cannot ship without green checks, matching versions, written notes, and all seven packages. ## Assumptions - The runner is `mac-arm64`: this development Mac, registered instance-wide against https://git.luci.ooo with labels `macos-arm64`/`self-hosted`, running in **host mode** (no containers) as a Homebrew service (`brew services start gitea-runner`; config `/opt/homebrew/etc/gitea-runner/config.yaml`, state and job workdirs under `/opt/homebrew/var/lib/gitea-runner`). Everything `tools/release.sh --cross` needs (rustup targets, mingw-w64, the messense linux-gnu toolchain, node) is already installed per `tools/RELEASING.md`; the workflows install nothing. - One runner, capacity 1: CI and release jobs queue rather than race. A release build and a local `cargo build` can still contend for the machine; acceptable on a solo project. - The corpus is not in the repository; CI scores it from a pinned-rev cache on the runner host (`~/.cache/lucisv-corpus`, fetched once by `tools/corpus_fetch.sh` on a miss) and gates on `scripts/corpus-baseline` via `scripts/corpus_gate.sh`. - `secrets.GITHUB_TOKEN` is auto-provided by Gitea Actions with rights to create releases and attach assets on this repo. - Release notes are written by hand (by the lead/Claude, specific to the changes) into `CHANGELOG.md` *before* tagging; CI publishes, it does not compose. A missing section fails the release on purpose. ## Handshakes - Consumes `tools/release.sh --cross` unchanged: artifact names (`lucisv[-server]--[.exe]`, `lucisv-[-].vsix`, `lucisv--all.vsix`, `SHA256SUMS`) and the version-from-binary convention. `tools/prune_release_assets.sh` depends on those `.vsix` names exactly — it checks all **seven** by name and filters `SHA256SUMS` down to `.vsix` lines before publishing. A package added, renamed or dropped in `release.sh` must be reflected in that script's suffix list, or the release fails naming the file it could not find (docs/features/editor-platform-vsix). - The workflow's steps are one-liners calling `tools/` scripts, so every release step is runnable by hand on a developer machine and testable without pushing a tag. `prune_release_assets.sh` in particular is safe to re-run: a second run over an already-pruned directory finds the same seven packages and verifies them again. - Consumes `CHANGELOG.md`'s heading convention: `## — `; `tools/release_notes.sh` keys on the second word of `## ` headings. - `tools/publish_release.sh` expects the GitHub-compatible CI environment (`GITHUB_SERVER_URL`, `GITHUB_REPOSITORY`, `GITHUB_TOKEN`, `GITHUB_REF_NAME` via the workflow) and jq + curl on the runner. - Promises to the release checklist (`tools/RELEASING.md`): the tag must equal `v` + the workspace version, and the CHANGELOG section must exist, or the workflow fails before publishing anything. ## Status / TODO - [x] Runner installed (`brew install gitea-runner`), registered (`mac-arm64`), running as a service. - [x] `.gitea/workflows/ci.yml` — fmt/clippy(-D warnings)/test on every master push and PR. - [x] `.gitea/workflows/release.yml` — tag → cross build → version check → notes extraction → release with assets. - [x] `tools/release_notes.sh` (+ missing-section failure path tested), `tools/publish_release.sh` (get-or-create, skip-attached re-run safety). - [x] End-to-end verification with a real tag (v0.7.1). - [x] Corpus score as a CI gate (`corpus` job: cached corpus + `scripts/corpus_gate.sh` against `scripts/corpus-baseline`; regression, verification error or crash fails the push). - [x] Release-time artifact audit (`tools/audit_artifacts.sh`: musl static-ness, linux-gnu glibc ceiling <= 2.28, PE/Mach-O file types) — automates what RELEASING.md documented as manual; Linux/Windows binaries remain audited, never executed (no such machine in the loop, and no container runtime on the runner). - [x] Publish `.vsix` packages only (2026-08-27): after the audit, the workflow asserts all seven packages exist by name, filters `SHA256SUMS` down to them (keeping the audited hashes), re-verifies it, and deletes the loose binaries from `dist/` so `publish_release.sh` attaches only the packages. Prune logic tested locally against a real `--cross` `dist/`, with a negative control (one package removed → the step fails naming it). - [x] That logic lives in `tools/prune_release_assets.sh` (2026-08-27), not inline in the workflow: every release step is a one-line call into `tools/`, so it can be run and negative-controlled on a developer machine without pushing a tag. The seventh (all-platforms) package joined the must-exist list at the same time. - [ ] A second runner on a non-macOS host, if native-built (rather than cross-built) Linux artifacts are ever wanted. ## Work log - 2026-08-26 — lead. Installed and registered the runner (one-time instance token from the owner), wrote both workflows and both scripts, smoke-tested `release_notes.sh` on the present-and-missing paths. Decisions: host mode over docker (the cross toolchain lives on this Mac and macOS jobs can't be containerized anyway); notes extracted from CHANGELOG.md rather than generated in CI (the owner wants specific, written notes — composing them is the lead's job at tag time, publishing is CI's); a hard failure on tag/version mismatch or missing notes rather than a fallback body. Version bumped to 0.7.1 and released end-to-end as the verification. - 2026-08-26 — lead (round 2, after external review). Added the corpus gate job and the release artifact audit; both tested before landing (the gate against the local corpus at exactly the 813 baseline, the audit against the 10 downloaded v0.7.1 release binaries — all pass). Docker was considered for executing the musl build's tests on Linux and rejected: no container runtime exists on the runner Mac, and installing a VM stack is an owner decision, not a CI increment. - 2026-08-27 — lead. Owner decision: the release page ships the six `.vsix` packages only (each platform package a must, checked by name; the universal fallback included), no loose binaries — the platform packages embed them, and an experienced user builds standalone binaries with cargo. Implemented as a "Keep only the extension packages" step in `release.yml` between the artifact audit and the notes extraction: the audit still sees (and gates on) the loose binaries, then the step filters `SHA256SUMS` to `.vsix` lines — the published hashes are the audited ones, not recomputed — deletes everything else from `dist/`, and re-runs `shasum -c`. `publish_release.sh` is untouched: it attaches whatever `dist/` holds. Tested against the real 0.10.0 `--cross` dist (six packages verify, correct survivors) and negative-controlled (one package removed → fails naming `lucisv-0.10.0-linux-arm64.vsix`). Docs trued up: RELEASING.md (publishing + CI sections), top-level README (Editor setup and Install-and-releases sections now lead with the platform package and say binaries are build-your-own), and this README's Goal/Handshakes/Status. - 2026-08-27 — dev (all-platforms package round). Two changes here, both in service of the seventh `.vsix` (`docs/features/editor-platform-vsix`): - **The inline "Keep only the extension packages" step became `tools/prune_release_assets.sh `.** Same logic, same order — check every package by name, filter `SHA256SUMS` to its `.vsix` lines rather than recompute, delete everything else, re-verify with `shasum -c` — now in a script with a usage header like its siblings, so `release.yml` is back to one-line steps and the step is testable without a tag. It grew the `-all` suffix and argument validation (`[ $# -eq 2 ]`, missing dir, missing `SHA256SUMS` → exit 2, matching `publish_release.sh`'s convention); a missing package is still exit 1 naming the file. - **`release.yml`**: the step body is now `tools/prune_release_assets.sh dist "${GITHUB_REF_NAME#v}"`, and the header comment says seven packages. Nothing else in the workflow moved; the prune still sits between the artifact audit and the notes extraction, so the audit keeps gating on the loose binaries before they are deleted. **Verified**, from the real repo path, against the real `dist/` from a `tools/release.sh --cross` run of 0.10.1 (copies only — `dist/` itself was left intact for the lead, since the script deletes files): | Check | Result | |---|---| | `bash -n tools/prune_release_assets.sh` | clean | | positive: a 20-file `dist/` copy | exit 0, 8 survivors (7 `.vsix` + `SHA256SUMS`), `SHA256SUMS` down to 7 lines, all 7 verify `OK` | | negative: `lucisv-0.10.1-all.vsix` removed | exit 1, `missing lucisv-0.10.1-all.vsix`, **and nothing deleted** — all 19 remaining files still there, because the name check runs before any destructive step | | negative: wrong version argument (`0.10.0`) | exit 1, `missing lucisv-0.10.0.vsix`, nothing deleted | | negative: one argument / missing dir / dir without `SHA256SUMS` | exit 2 each, with the usage or the specific reason | | re-run over an already-pruned directory | exit 0, same 7 packages verify again — a CI job re-run is safe | | `python3 -c yaml.safe_load` on `release.yml` | parses; the six step names unchanged | The negative controls were run on copies in the session scratchpad, but the script itself and every `release.sh` run were driven from `/Users/guoliangchen/repo/verilogrustformatter` — `vsce` collects zero files under the scratchpad's UUID path (`docs/features/editor-packaging` QA Finding 2). Not verified: the workflow has not been run on the Gitea runner in this round — no tag was pushed (and pushing one is the lead's call). The step is a one-line invocation of a script proven by hand on the same machine the runner is, which is as close as this gets without cutting a release. **2026-09-02 — lead: the publish step against Cloudflare's 100-second origin timeout.** Releases 0.27.0–0.30.0 were pushed together after an ssh-key outage; the runner built all four, 0.27.0 and 0.28.0 published, and 0.29.0 and 0.30.0 both died in "Create the release and attach the artifacts" with `curl: (56) The requested URL returned error: 524` — Cloudflare's own page, because `$GITHUB_SERVER_URL` is the public host and every API call goes through the proxy, which gives the origin 100 seconds per request. 0.29.0's release object existed with zero assets, so the very first upload had timed out on a busy server. Two changes in `tools/publish_release.sh`, both mock-tested with a curl stand-in: (1) uploads retry (`UPLOAD_ATTEMPTS`, default 5, backing off 10 s × n), and before each retry the server is asked again what it holds — a 524 is the proxy giving up on the *response*, so the origin may have finished; an asset present at the local size is treated as attached, one at another size is deleted and re-sent, so a truncated file can never be published; (2) `LUCISV_API_URL`, an optional repository Actions variable passed by `release.yml`, names a direct `http://host:port` for the API so uploads bypass the proxy altogether; unset, nothing changes. The two stuck tags carry the old script and are re-run from the Actions page — that script was already idempotent (release reused, attached names skipped), so a re-run on a quieter server completes them. `docs/features/ci-release` is the only file set touched. ## QA log _(no QA round — infrastructure, verified by the live v0.7.1 run; see work log)_ ## Review _(reserved)_