ci: cache Go modules, build/test cache and the TinyGo .deb #46

Merged
jmz merged 1 commit from ci/go-cache into main 2026-11-03 22:32:19 +00:00
Member

Why

The go job runs fully cold on every push: setup-go with cache: false, the TinyGo .deb downloaded from GitHub, and every module, build and test from scratch. Recent runs took 10:24–13:14 (runs 34, 38–43).

Where the time goes (run 43 on deploy, 10:52 total):

phase time
apt + checkout + setup-go + TinyGo .deb/dpkg 37 s
go fmt (module downloads) 12 s
go vet (compiles) 37 s
go test ./... in db 8 min 46 s: routes 510 s, pocketbase 272 s, federation 102 s, permissions 80 s (test execution time, not compile)
plugins test + TinyGo builds 37 s

Change (.forgejo/workflows/ci.yml, go job)

  • actions/cache@v4 on ~/go/pkg/mod, ~/.cache/go-build and /tmp/wanderer-tinygo-cache. The key is Go/TinyGo version + hash of all go.sum files + commit, with restore-keys for partial hits. GOCACHE also holds the go test results, so packages whose inputs did not change are not re-run. That is the big win, for web-only and plugin-only pushes above all.
  • actions/cache@v4 on the TinyGo .deb, keyed on TINYGO_VERSION. GitHub is hit only on a miss.
  • The actions stay on the majors this file already uses (checkout@v4, setup-go@v5, now cache@v4), all node20.

Prerequisite: the runner's cache server

spl-vm06's runner has cache.enabled = false (nixos-hosts modules/ci-runner/default.nix: "the egress policy closes the VM to its own jobs"). Until that changes, actions/cache only warns and the job runs cold, exactly as now. See the PR's CI run for proof that it is harmless.

Branches

CI runs on push (any branch), not on pull_request, so this branch's push is its check. The same ci.yml is on deploy, with no workflow_dispatch. deploy gets this with the next main→deploy merge (jmz, ff-only), or as the same hunk cherry-picked.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XMf4EKNjKMd6bwCpS7K4jU

## Why The `go` job runs fully cold on every push: `setup-go` with `cache: false`, the TinyGo .deb downloaded from GitHub, and every module, build and test from scratch. Recent runs took 10:24–13:14 (runs 34, 38–43). Where the time goes (run 43 on `deploy`, 10:52 total): | phase | time | |---|---| | apt + checkout + setup-go + TinyGo .deb/dpkg | 37 s | | `go fmt` (module downloads) | 12 s | | `go vet` (compiles) | 37 s | | `go test ./...` in db | **8 min 46 s**: `routes` 510 s, `pocketbase` 272 s, `federation` 102 s, `permissions` 80 s (test execution time, not compile) | | plugins test + TinyGo builds | 37 s | ## Change (`.forgejo/workflows/ci.yml`, go job) - `actions/cache@v4` on `~/go/pkg/mod`, `~/.cache/go-build` and `/tmp/wanderer-tinygo-cache`. The key is Go/TinyGo version + hash of all go.sum files + commit, with restore-keys for partial hits. GOCACHE also holds the **`go test` results**, so packages whose inputs did not change are not re-run. That is the big win, for web-only and plugin-only pushes above all. - `actions/cache@v4` on the TinyGo .deb, keyed on `TINYGO_VERSION`. GitHub is hit only on a miss. - The actions stay on the majors this file already uses (`checkout@v4`, `setup-go@v5`, now `cache@v4`), all node20. ## Prerequisite: the runner's cache server spl-vm06's runner has `cache.enabled = false` (nixos-hosts `modules/ci-runner/default.nix`: "the egress policy closes the VM to its own jobs"). Until that changes, `actions/cache` only warns and the job runs cold, exactly as now. See the PR's CI run for proof that it is harmless. ## Branches CI runs on push (any branch), not on `pull_request`, so this branch's push is its check. The same `ci.yml` is on `deploy`, with no `workflow_dispatch`. `deploy` gets this with the next main→deploy merge (jmz, ff-only), or as the same hunk cherry-picked. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XMf4EKNjKMd6bwCpS7K4jU
ci: cache Go modules, build/test cache and the TinyGo .deb
All checks were successful
CI / go (push) Successful in 12m10s
CI / web (push) Successful in 53s
0d56e4dcd7
The go job ran fully cold every time (setup-go cache: false, TinyGo .deb
fetched from GitHub on every run), about 11-13 min.

Restore and save ~/go/pkg/mod, ~/.cache/go-build (which also holds the
go test results, so unchanged packages are not re-run) and TinyGo's
build cache with actions/cache@v4. There is one entry per commit, with
restore-keys on the go.sum set and the Go/TinyGo version. The TinyGo .deb
is cached separately, keyed on its version. Actions stay on the
node20-era majors this file already uses (checkout@v4, setup-go@v5).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XMf4EKNjKMd6bwCpS7K4jU
Author
Member

Run 45 (this branch): go 10:27, web green. That is the same range as the cold baseline (10:24–13:14, runs 34/38–43), as expected. Both cache steps log Cache action is only supported on GHES… because spl-vm06's runner has cache.enabled = false, so there is no ACTIONS_CACHE_URL and the job runs cold, unchanged. A second run would be just as cold, so I did not trigger one (single CI slot). The warm-cache number needs the runner cache server enabled first (nixos-hosts modules/ci-runner).

Run 45 (this branch): go 10:27, web green. That is the same range as the cold baseline (10:24–13:14, runs 34/38–43), as expected. Both cache steps log `Cache action is only supported on GHES…` because spl-vm06's runner has `cache.enabled = false`, so there is no ACTIONS_CACHE_URL and the job runs cold, unchanged. A second run would be just as cold, so I did not trigger one (single CI slot). The warm-cache number needs the runner cache server enabled first (nixos-hosts `modules/ci-runner`).
jmz merged commit 0d56e4dcd7 into main 2026-11-03 22:32:19 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
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
public/wanderer!46
No description provided.