ci: add Zig cache and build.zig integration tests#16
Conversation
- Cache ~/.cache/zig and ~/AppData/Local/zig across runs - Run 'zig build test' (build.zig integration tests) on Unix - Closes #8
There was a problem hiding this comment.
Pull request overview
This PR enhances the CI workflow to satisfy acceptance criteria from issue #8 by adding a Zig build cache and a new zig build test step that runs the integration tests defined in build.zig (type inference, --no-type-inference, and REAL aggregates). The README CI badge was also added in a prior step.
Changes:
- Adds a
Cache Zigstep usingactions/cache@v4to speed up CI builds - Adds a new
Integration tests (build.zig)step that runszig build teston Unix platforms
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| - name: Integration tests (build.zig) | ||
| if: runner.os != 'Windows' | ||
| run: zig build test |
There was a problem hiding this comment.
The zig build test step rebuilds the executable with bundle-sqlite defaulting to false, which causes it to attempt linking against a system sqlite3 library. On ubuntu-latest this may work if libsqlite3-dev is installed, but it is not guaranteed to be available. The earlier Build step uses -Dbundle-sqlite=true, but that compiled binary at zig-out/bin/sql-pipe will be overwritten when zig build test triggers a rebuild without the flag. The integration test step should also pass -Dbundle-sqlite=true to ensure the binary is built consistently and the tests use the same compilation configuration.
| run: zig build test | |
| run: zig build test -Dbundle-sqlite=true |
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cache/zig |
There was a problem hiding this comment.
The ~/.cache/zig path is Linux-specific. On macOS, Zig stores its cache in ~/Library/Caches/zig, not ~/.cache/zig. As a result, the cache step will silently miss the Zig cache directory on macOS runners, and the macOS build cache will never be saved or restored. The path list should include ~/Library/Caches/zig for macOS coverage.
| ~/.cache/zig | |
| ~/.cache/zig | |
| ~/Library/Caches/zig |
| - name: Cache Zig | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cache/zig | ||
| ~/AppData/Local/zig | ||
| key: zig-cache-${{ matrix.os }}-${{ hashFiles('build.zig', 'build.zig.zon') }} | ||
| restore-keys: zig-cache-${{ matrix.os }}- | ||
|
|
There was a problem hiding this comment.
mlugg/setup-zig@v2 already includes built-in caching via actions/cache internally (it caches both the Zig toolchain and the global Zig cache directory). Adding a separate "Cache Zig" step that targets the same directories (~/.cache/zig, ~/AppData/Local/zig) will result in two cache operations targeting the same paths. This can cause redundant cache saves, potentially inflating cache storage usage and slowing down the workflow. Consider either relying on mlugg/setup-zig@v2's built-in caching alone, or verifying whether its caching covers ~/.cache/zig/~/Library/Caches/zig before adding a manual step.
| - name: Cache Zig | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/zig | |
| ~/AppData/Local/zig | |
| key: zig-cache-${{ matrix.os }}-${{ hashFiles('build.zig', 'build.zig.zon') }} | |
| restore-keys: zig-cache-${{ matrix.os }}- |
Summary
Enhances the CI workflow to satisfy all acceptance criteria from #8.
Changes
~/.cache/zig(Linux/macOS) and~/AppData/Local/zig(Windows) usingactions/cache@v4, keyed on OS andbuild.zig/build.zig.zonhasheszig build test: runs the integration tests defined inbuild.zig(type inference,--no-type-inference, REAL aggregates) on Unix platformsAcceptance Criteria checklist
master/mainzig build(ReleaseSafe)zig build testubuntu-latest,macos-latest,windows-latestCloses #8