Skip to content

Zig

Zig CI on GitHub Actions

Zig's global cache is discarded, so cross-compilation targets rebuild every time.

8m → 90s
Multi-target build

Zig's global cache is discarded, so cross-compilation targets rebuild every time.

Why it happens

~/.cache/zig holds compiled artefacts for every target triple and is empty on a fresh runner.

What to change

  1. Cache ~/.cache/zig and zig-cache keyed on build.zig.zon
  2. Cross-compile all targets in one job to share the cache
  3. Pin the Zig version — the cache format changes between releases

Zig on runnerhut

yaml
jobs:
build:
runs-on: runnerhut-8vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v1
- run: zig build test
A working starting point

The only runnerhut-specific line is `runs-on: runnerhut-8vcpu-ubuntu-2404`. Everything else is standard GitHub Actions — the same actions, the same secrets and the same permissions model you use today.

Your next build could be twice as fast, at half the price

Start free. Migrating away is the same one line, and we publish that diff too.