Skip to content

Commit b25058a

Browse files
fix(ci): use nix for zig consistently, fix clset_vtab edge case
CI was failing because: 1. setup-zig@v2 used Zig 0.14.0 but Makefile uses nix (0.15.2) 2. Version mismatch caused extension to silently malfunction 3. clset_vtab unit tests failed on edge case Fixes: - All CI jobs now use 'nix run nixpkgs#zig --' for consistency - Fixed endsWithSchema() to reject '_schema' alone (no base name) - Updated cache keys to 'zig-nix-*' TASK-156: Linux CI parity
1 parent 57c2467 commit b25058a

File tree

3 files changed

+49
-42
lines changed

3 files changed

+49
-42
lines changed

.github/workflows/zig-tests.yaml

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,24 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323

24-
- name: Setup Zig
25-
uses: goto-bus-stop/setup-zig@v2
24+
- name: Install Nix
25+
uses: cachix/install-nix-action@v27
2626
with:
27-
version: 0.14.0
27+
nix_path: nixpkgs=channel:nixos-unstable
2828

2929
- name: Cache Zig
3030
uses: actions/cache@v4
3131
with:
3232
path: |
3333
zig/.zig-cache
3434
~/.cache/zig
35-
key: zig-${{ runner.os }}-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
35+
key: zig-nix-${{ runner.os }}-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
3636
restore-keys: |
37-
zig-${{ runner.os }}-
37+
zig-nix-${{ runner.os }}-
3838
3939
- name: Build
4040
working-directory: zig
41-
run: zig build
41+
run: nix run nixpkgs#zig -- build
4242

4343
- name: Size Report
4444
working-directory: zig
@@ -70,24 +70,24 @@ jobs:
7070
steps:
7171
- uses: actions/checkout@v4
7272

73-
- name: Setup Zig
74-
uses: goto-bus-stop/setup-zig@v2
73+
- name: Install Nix
74+
uses: cachix/install-nix-action@v27
7575
with:
76-
version: 0.14.0
76+
nix_path: nixpkgs=channel:nixos-unstable
7777

7878
- name: Cache Zig
7979
uses: actions/cache@v4
8080
with:
8181
path: |
8282
zig/.zig-cache
8383
~/.cache/zig
84-
key: zig-wasm-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
84+
key: zig-wasm-nix-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
8585
restore-keys: |
86-
zig-wasm-
86+
zig-wasm-nix-
8787
8888
- name: Build WASM
8989
working-directory: zig
90-
run: zig build wasm
90+
run: nix run nixpkgs#zig -- build wasm
9191

9292
- name: Upload artifact
9393
uses: actions/upload-artifact@v4
@@ -102,36 +102,31 @@ jobs:
102102
steps:
103103
- uses: actions/checkout@v4
104104

105-
- name: Setup Zig
106-
uses: goto-bus-stop/setup-zig@v2
105+
- name: Install Nix
106+
uses: cachix/install-nix-action@v27
107107
with:
108-
version: 0.14.0
108+
nix_path: nixpkgs=channel:nixos-unstable
109109

110110
- name: Cache Zig
111111
uses: actions/cache@v4
112112
with:
113113
path: |
114114
zig/.zig-cache
115115
~/.cache/zig
116-
key: zig-${{ runner.os }}-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
116+
key: zig-nix-${{ runner.os }}-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
117117
restore-keys: |
118-
zig-${{ runner.os }}-
118+
zig-nix-${{ runner.os }}-
119119
120120
- name: Run unit tests
121121
working-directory: zig
122-
run: zig build test
122+
run: nix run nixpkgs#zig -- build test
123123

124124
test-parity:
125125
name: Parity Tests
126126
runs-on: ubuntu-latest
127127
steps:
128128
- uses: actions/checkout@v4
129129

130-
- name: Setup Zig
131-
uses: goto-bus-stop/setup-zig@v2
132-
with:
133-
version: 0.14.0
134-
135130
- name: Install Nix
136131
uses: cachix/install-nix-action@v27
137132
with:
@@ -143,13 +138,13 @@ jobs:
143138
path: |
144139
zig/.zig-cache
145140
~/.cache/zig
146-
key: zig-${{ runner.os }}-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
141+
key: zig-nix-${{ runner.os }}-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
147142
restore-keys: |
148-
zig-${{ runner.os }}-
143+
zig-nix-${{ runner.os }}-
149144
150145
- name: Build extension
151146
working-directory: zig
152-
run: zig build
147+
run: nix run nixpkgs#zig -- build
153148

154149
- name: Run parity tests
155150
working-directory: zig
@@ -162,10 +157,10 @@ jobs:
162157
steps:
163158
- uses: actions/checkout@v4
164159

165-
- name: Setup Zig
166-
uses: goto-bus-stop/setup-zig@v2
160+
- name: Install Nix
161+
uses: cachix/install-nix-action@v27
167162
with:
168-
version: 0.14.0
163+
nix_path: nixpkgs=channel:nixos-unstable
169164

170165
- name: Setup Node.js
171166
uses: actions/setup-node@v4
@@ -178,13 +173,13 @@ jobs:
178173
path: |
179174
zig/.zig-cache
180175
~/.cache/zig
181-
key: zig-wasm-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
176+
key: zig-wasm-nix-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
182177
restore-keys: |
183-
zig-wasm-
178+
zig-wasm-nix-
184179
185180
- name: Build WASM
186181
working-directory: zig
187-
run: zig build wasm
182+
run: nix run nixpkgs#zig -- build wasm
188183

189184
- name: Install dependencies
190185
working-directory: zig/browser-test

.tasks/triage/TASK-156-linux-ci-test-parity.md renamed to .tasks/active/TASK-156-linux-ci-test-parity.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
Make sure our build + test workflows run on Linux (CI + local), not only Darwin.
55

66
## Status
7-
- State: triage
8-
- Priority: LOW (CI-only, not blocking local dev or parity work)
7+
- State: active
8+
- Priority: HIGH (CI is broken)
99

1010
## Context
1111
We have strong Darwin coverage (local dev + artifacts), but Linux can silently rot unless we exercise it regularly.
@@ -48,12 +48,22 @@ This task adds/strengthens Linux execution for the same “canonical” test ent
4848
## Progress Log
4949
- 2025-12-21: Created from request to ensure Linux coverage.
5050
- 2025-12-22: Update tasks evaluation — waiting for Tom direction on CI priorities.
51+
- 2025-12-23: Tom requested Linux CI support. Analyzed CI failures:
52+
- CI uses `setup-zig@v2` with Zig 0.14.0
53+
- Makefile uses `nix run nixpkgs#zig` which is Zig 0.15.2
54+
- Version mismatch causes extension to load but functions return empty
55+
- Also 2 failing unit tests in `clset_vtab.zig` (edge case: "_schema" alone)
56+
- WASM build fails due to Zig 0.14 incompatibility
5157

52-
## Completion Notes
53-
(Empty until done.)
58+
## Fixes Applied
59+
1. **CI Workflow**: Updated `.github/workflows/zig-tests.yaml` to use nix for zig consistently
60+
- All jobs now use `nix run nixpkgs#zig --` instead of raw `zig`
61+
- Ensures same Zig version (0.15.2) across CI and local dev
62+
- Updated cache keys to `zig-nix-*`
63+
64+
2. **Unit Test Fix**: Fixed `endsWithSchema()` in `zig/src/clset_vtab.zig`
65+
- Changed `name.len < suffix.len` to `name.len <= suffix.len`
66+
- Prevents "_schema" alone from being considered valid (empty base name)
5467

55-
**Waiting on**: Tom to confirm CI priorities. Current state:
56-
- Darwin (macOS) coverage: excellent (local dev)
57-
- Linux coverage: unknown (need CI setup)
58-
- All harness scripts use portable bash (should work on Linux)
59-
- `.github/workflows/` has existing c-tests.yaml for C code but no Zig CI yet
68+
## Completion Notes
69+
(Pending CI verification)

zig/src/clset_vtab.zig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ fn toApiDb(db: ?*vtab.sqlite3) ?*api.sqlite3 {
9696
// =============================================================================
9797

9898
/// Check if table name ends with _schema suffix
99+
/// Returns false for "_schema" alone (must have base table name)
99100
fn endsWithSchema(name: []const u8) bool {
100101
const suffix = "_schema";
101-
if (name.len < suffix.len) return false;
102+
// Must be longer than suffix to have a base name
103+
if (name.len <= suffix.len) return false;
102104
return std.mem.endsWith(u8, name, suffix);
103105
}
104106

0 commit comments

Comments
 (0)