Local CI with act
Why the GitHub workflows run on workstations, and what that costs.
Why does this repository ship a bespoke local act environment — a custom
runner image, hand-written event payloads, documented workarounds — instead
of saying "push and see CI"? Because a five-minute feedback loop beats a
five-minute round trip to a hosted runner, and because most CI failures are
environment failures, not logic failures.
The problem being solved
The workflows are small but real: matrix builds, race detection with a C
toolchain, lint across four ecosystems, GoReleaser config validation,
govulncheck. Running "the real thing" locally means running the workflows
themselves — not a parallel script that drifts from what CI does. act
executes the actual .github/workflows/*.yml in containers, so drift is
impossible by construction.
The design choices
A purpose-built image instead of the giant defaults.
catthehacker/ubuntu images are 1.1–1.6 GB; CI needs Node (JavaScript
actions), git (GoReleaser), and build-essential (go test -race). The
local image is ~570 MB, built natively for the host architecture (arm64 on
Apple Silicon) — no amd64 emulation, so runs are minutes, not hours.
Copy mode, bind only when forced. act copies the checkout into the
container, so generated files (coverage.out, bin/, dist/) never
appear in your repository owned by root. Only the lint job binds the
checkout — goreleaser check needs a real .git.
Scoped expectations. The local run covers the ubuntu leg only; macOS
and Windows stay GitHub-only. The docs job is opt-in
(ACT_INCLUDE_DOCS=1) so a docs-in-progress tree does not block Go runs.
Documented workarounds, not magic. GOFLAGS=-buildvcs=false (act's
copy has no .git), the !env.ACT guard on upload-artifact (act's
artifact server lacks the v7 protocol), .actrc mapping ubuntu-latest to
the local image — each workaround is commented in the scripts and in
.github/act/README.md, and each names the GitHub-hosted behavior it
does not change.
What this buys and what it does not
Buys: minutes-not-hours feedback on the true CI definition; no secrets needed; no GitHub writes; a rehearsal of the release workflow that provably cannot publish (dry-run payload checked in).
Does not buy: hosted-runner parity (different OS/arch), artifact
uploads, OIDC/cosign signing, or matrix breadth. Those remain the hosted
run's job — which is why mise run check still runs everything locally
outside act as well.
Related
- The exact commands and files: How to run CI locally with act
- What each workflow does: CI workflows reference