CI: download gc from the package registry instead of building it #15

Merged
city-root merged 1 commit from worker/gascitypacks-464 into main 2026-11-11 18:03:01 +00:00
Contributor

test / lint no longer builds gc from source: it downloads the build gascity-root's gc workflow publishes for GC_SHA, and builds only when there is none.

  • Change (.forgejo/workflows/test.yaml, lint job only): a new id: gc step, gascity-root's test / config step with the pin read from GC_SHA instead of gc.pin. It fetches gc-linux-<amd64|arm64> and its .sha256 from $GITHUB_SERVER_URL/api/packages/mikluko/generic/gc/$GC_SHA/, checks them with sha256sum -c, puts the binary on PATH and sets downloaded=true. The go install step is now if: steps.gc.outputs.downloaded != 'true': it runs only when the pin is not published or the download or its checksum fails. setup-go stays unconditional, since the job's go vet and go test need Go.
  • Speed: test / lint took 3m06s to 4m06s (typically about 3m10s) over its last eleven successful runs. gascity-root's test / config, which this step was copied from (its commit 08a14b0), went from about three minutes to 8s on its pull request and 11s on main.
  • Verified here: the step's script, extracted from the workflow and run under bash -e with a fake runner environment (RUNNER_TEMP, HOME, GITHUB_PATH, GITHUB_OUTPUT). Against the real registry for GC_SHA, once per architecture branch: gc-linux-<arch>: OK, downloaded=true, a static ELF of that architecture installed 755, its SHA-256 equal to the published one. Against a local server with the registry's URL layout: a wrong checksum, a corrupted binary, a missing .sha256, an unpublished pin and a pin published for the other architecture only each leave downloaded unset, install nothing and exit 0, so the fallback runs, and the log says why. gc lint ., go vet, go test, tests/worktree-setup.sh, tests/merge.sh and tests/upgrade.sh pass; the scripts and changelog jobs are unchanged.
  • Not verified here: the Forgejo run itself. This pull request's test / lint is the check: go install should show as skipped, and the job should finish well under the baseline above. If it builds instead, the id: gc step's log gives curl's or sha256sum's reason.
  • To know: no CHANGELOG entry, since the change is CI-only and the changelog check this repo runs (mikluko/changelog@v1) has no per-pull-request requirement. The checksum comes from the same registry as the binary, as in gascity-root: it catches a corrupt or truncated download, not a replaced artifact. Bumping GC_SHA to a pin gascity-root has not published yet builds from source, as before.

🤖 Generated with Claude Code

Bead: gascitypacks-464

`test / lint` no longer builds gc from source: it downloads the build gascity-root's gc workflow publishes for `GC_SHA`, and builds only when there is none. - **Change** (`.forgejo/workflows/test.yaml`, `lint` job only): a new `id: gc` step, gascity-root's `test / config` step with the pin read from `GC_SHA` instead of `gc.pin`. It fetches `gc-linux-<amd64|arm64>` and its `.sha256` from `$GITHUB_SERVER_URL/api/packages/mikluko/generic/gc/$GC_SHA/`, checks them with `sha256sum -c`, puts the binary on `PATH` and sets `downloaded=true`. The `go install` step is now `if: steps.gc.outputs.downloaded != 'true'`: it runs only when the pin is not published or the download or its checksum fails. `setup-go` stays unconditional, since the job's `go vet` and `go test` need Go. - **Speed:** `test / lint` took 3m06s to 4m06s (typically about 3m10s) over its last eleven successful runs. gascity-root's `test / config`, which this step was copied from (its commit `08a14b0`), went from about three minutes to 8s on its pull request and 11s on `main`. - **Verified here:** the step's script, extracted from the workflow and run under `bash -e` with a fake runner environment (`RUNNER_TEMP`, `HOME`, `GITHUB_PATH`, `GITHUB_OUTPUT`). Against the real registry for `GC_SHA`, once per architecture branch: `gc-linux-<arch>: OK`, `downloaded=true`, a static ELF of that architecture installed `755`, its SHA-256 equal to the published one. Against a local server with the registry's URL layout: a wrong checksum, a corrupted binary, a missing `.sha256`, an unpublished pin and a pin published for the other architecture only each leave `downloaded` unset, install nothing and exit 0, so the fallback runs, and the log says why. `gc lint .`, `go vet`, `go test`, `tests/worktree-setup.sh`, `tests/merge.sh` and `tests/upgrade.sh` pass; the `scripts` and `changelog` jobs are unchanged. - **Not verified here:** the Forgejo run itself. This pull request's `test / lint` is the check: `go install` should show as skipped, and the job should finish well under the baseline above. If it builds instead, the `id: gc` step's log gives curl's or `sha256sum`'s reason. - **To know:** no CHANGELOG entry, since the change is CI-only and the changelog check this repo runs (`mikluko/changelog@v1`) has no per-pull-request requirement. The checksum comes from the same registry as the binary, as in gascity-root: it catches a corrupt or truncated download, not a replaced artifact. Bumping `GC_SHA` to a pin gascity-root has not published yet builds from source, as before. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Bead: gascitypacks-464
ci: download gc from the package registry instead of building it (gascitypacks-464)
All checks were successful
test / changelog (pull_request) Successful in 4s
test / scripts (pull_request) Successful in 7s
test / lint (pull_request) Successful in 15s
bf0b14ca6e
The lint job built gc from source on every run (`go install` of
gascity@$GC_SHA) and took 3m06s to 4m06s, typically about 3m10s, over its
last eleven successful runs. gascity-root's gc workflow now publishes gc
per pin to mikluko's generic package registry, readable without a token;
its own test / config job dropped from about three minutes to 8s by
downloading it.

The `id: gc` step is that job's, with the pin read from GC_SHA instead of
gc.pin: fetch gc-linux-<amd64|arm64> and its .sha256 for the pin, check
them with `sha256sum -c`, install the binary on PATH and set
downloaded=true. The `go install` step stays as the fallback and runs only
when that output is unset: a pin the registry does not have yet, or a
download or checksum that fails (curl or sha256sum say which in the log).
setup-go stays unconditional, since the forgejo pack's `go vet` and
`go test` in the same job need Go whichever way gc arrives.

Checked by running the step's script, extracted from the workflow, under
bash -e with a fake runner environment (RUNNER_TEMP, HOME, GITHUB_PATH,
GITHUB_OUTPUT). Against the real registry, once per architecture branch:
`gc-linux-<arch>: OK`, downloaded=true, a static ELF of that architecture
installed 755 whose SHA-256 is the published one. Against a local server
with the registry's URL layout, a wrong checksum, a corrupted binary, a
missing .sha256, an unpublished pin and a pin published for the other
architecture only each leave downloaded unset, install nothing and exit 0,
so the fallback runs. The Forgejo run itself is for the pull request's CI.

No CHANGELOG entry: this is CI-only, and the v1 changelog check asks for
none per pull request.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
Contributor

Review: passes. Reviewed at bf0b14ca6eba28ce8aedb77fffcb6f64721c1a97 against bead gascitypacks-464.

Checked

  • Scope. One file, .forgejo/workflows/test.yaml, +17 −1, in the lint job only: the new id: gc step and an if: on the go install step. Nothing unrelated. main (eeb3aef) has not changed this file since the branch point b341fca, so the squash lands cleanly.
  • Requirement. The id: gc step is gascity-root's test / config step line for line, with $(cat gc.pin) replaced by $GC_SHA: it fetches gc-linux-<arch> and its .sha256, runs sha256sum -c, installs the binary as $HOME/.local/bin/gc, adds that directory to GITHUB_PATH and sets downloaded=true. go install runs only when that output is not true. setup-go stays unconditional, as the bead asks.
  • CI on this head. Run 35 (test, pull_request, bf0b14c): lint, scripts and changelog succeeded. The lint log shows the download path taken: gc-linux-amd64: OK, then gc lint: 2 pack(s) ok 0.14 s later with no go: downloading line between them, then the forgejo pack's go test passing. lint took 15 s; on main at eeb3aef (run 37) it took 3m04s, building gc.
  • Fallback. By reading, not by running: a failing curl -f or sha256sum -c leaves the if untaken, the step exits 0 without the output, and go install runs as before. Against the registry without a token: gc-linux-amd64, gc-linux-arm64 and both .sha256 files answer 200 for this pin, each checksum file names its binary by basename, and an unpublished pin answers 404.
  • Shell and secrets. Every expansion is quoted; the step reads no secret and sends no token.
  • Conventions. No CHANGELOG entry: the change is CI-only, the bead waives the note unless the check requires one, and test / changelog passed without it. The README does not say how CI gets gc, so nothing there goes stale. The merge does not start release, whose paths filter names only CHANGELOG.md and release.yaml.

Follow-ups, none blocking

  1. CI now runs whatever the registry holds under the pin's name, where it used to build the commit GC_SHA names. The checksum comes from the same registry, as the description says, so it catches a corrupt download and not a replaced artifact. Keeping the expected SHA-256 beside GC_SHA, one per architecture, would bind the binary to the pin again.
  2. setup-go still caches in lint. With gc not built there, it saves only the forgejo pack's build cache, warns that the module cache directory does not exist, and the cache service answers 500 on the save, as it does on main. cache: false, as in gascity-root, would drop the step's work and its warnings.
  3. curl has no --max-time: a registry that accepts the connection and then stalls holds the job until the runner's timeout instead of falling back to the build.

Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.

**Review: passes.** Reviewed at `bf0b14ca6eba28ce8aedb77fffcb6f64721c1a97` against bead gascitypacks-464. ### Checked - **Scope.** One file, `.forgejo/workflows/test.yaml`, +17 −1, in the `lint` job only: the new `id: gc` step and an `if:` on the `go install` step. Nothing unrelated. `main` (`eeb3aef`) has not changed this file since the branch point `b341fca`, so the squash lands cleanly. - **Requirement.** The `id: gc` step is gascity-root's `test / config` step line for line, with `$(cat gc.pin)` replaced by `$GC_SHA`: it fetches `gc-linux-<arch>` and its `.sha256`, runs `sha256sum -c`, installs the binary as `$HOME/.local/bin/gc`, adds that directory to `GITHUB_PATH` and sets `downloaded=true`. `go install` runs only when that output is not `true`. `setup-go` stays unconditional, as the bead asks. - **CI on this head.** Run 35 (`test`, `pull_request`, `bf0b14c`): `lint`, `scripts` and `changelog` succeeded. The `lint` log shows the download path taken: `gc-linux-amd64: OK`, then `gc lint: 2 pack(s) ok` 0.14 s later with no `go: downloading` line between them, then the forgejo pack's `go test` passing. `lint` took 15 s; on `main` at `eeb3aef` (run 37) it took 3m04s, building gc. - **Fallback.** By reading, not by running: a failing `curl -f` or `sha256sum -c` leaves the `if` untaken, the step exits 0 without the output, and `go install` runs as before. Against the registry without a token: `gc-linux-amd64`, `gc-linux-arm64` and both `.sha256` files answer 200 for this pin, each checksum file names its binary by basename, and an unpublished pin answers 404. - **Shell and secrets.** Every expansion is quoted; the step reads no secret and sends no token. - **Conventions.** No CHANGELOG entry: the change is CI-only, the bead waives the note unless the check requires one, and `test / changelog` passed without it. The README does not say how CI gets gc, so nothing there goes stale. The merge does not start `release`, whose `paths` filter names only `CHANGELOG.md` and `release.yaml`. ### Follow-ups, none blocking 1. CI now runs whatever the registry holds under the pin's name, where it used to build the commit `GC_SHA` names. The checksum comes from the same registry, as the description says, so it catches a corrupt download and not a replaced artifact. Keeping the expected SHA-256 beside `GC_SHA`, one per architecture, would bind the binary to the pin again. 2. `setup-go` still caches in `lint`. With gc not built there, it saves only the forgejo pack's build cache, warns that the module cache directory does not exist, and the cache service answers 500 on the save, as it does on `main`. `cache: false`, as in gascity-root, would drop the step's work and its warnings. 3. `curl` has no `--max-time`: a registry that accepts the connection and then stalls holds the job until the runner's timeout instead of falling back to the build. Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/gascitypacks!15
No description provided.