Skip to content

ci: add Zig cache and build.zig integration tests#16

Merged
vmvarela merged 1 commit intomasterfrom
feature/ci-workflow
Mar 2, 2026
Merged

ci: add Zig cache and build.zig integration tests#16
vmvarela merged 1 commit intomasterfrom
feature/ci-workflow

Conversation

@vmvarela
Copy link
Owner

@vmvarela vmvarela commented Mar 2, 2026

Summary

Enhances the CI workflow to satisfy all acceptance criteria from #8.

Changes

  • Zig build cache: caches ~/.cache/zig (Linux/macOS) and ~/AppData/Local/zig (Windows) using actions/cache@v4, keyed on OS and build.zig/build.zig.zon hashes
  • zig build test: runs the integration tests defined in build.zig (type inference, --no-type-inference, REAL aggregates) on Unix platforms

Acceptance Criteria checklist

  • Runs on every push and pull request to master/main
  • Builds with zig build (ReleaseSafe)
  • Runs all tests with zig build test
  • At least one integration test: pipe CSV via stdin and assert SQL output
  • Matrix build covers: ubuntu-latest, macos-latest, windows-latest
  • Build status badge added to README

Closes #8

- Cache ~/.cache/zig and ~/AppData/Local/zig across runs
- Run 'zig build test' (build.zig integration tests) on Unix
- Closes #8
Copilot AI review requested due to automatic review settings March 2, 2026 14:42
@github-actions github-actions bot added the type:chore Maintenance, refactoring, tooling label Mar 2, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Zig step using actions/cache@v4 to speed up CI builds
  • Adds a new Integration tests (build.zig) step that runs zig build test on 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
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
run: zig build test
run: zig build test -Dbundle-sqlite=true

Copilot uses AI. Check for mistakes.
uses: actions/cache@v4
with:
path: |
~/.cache/zig
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
~/.cache/zig
~/.cache/zig
~/Library/Caches/zig

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +39
- 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 }}-

Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
- 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 }}-

Copilot uses AI. Check for mistakes.
@vmvarela vmvarela merged commit 54b1276 into master Mar 2, 2026
10 checks passed
@vmvarela vmvarela deleted the feature/ci-workflow branch March 3, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:chore Maintenance, refactoring, tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI workflow: build and test on push/PR (Linux, macOS, Windows)

2 participants