forked from vlcn-io/cr-sqlite
-
Notifications
You must be signed in to change notification settings - Fork 0
207 lines (176 loc) · 5.33 KB
/
zig-tests.yaml
File metadata and controls
207 lines (176 loc) · 5.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: zig-tests
on:
push:
branches: [main]
paths:
- 'zig/**'
- '.github/workflows/zig-tests.yaml'
pull_request:
paths:
- 'zig/**'
- '.github/workflows/zig-tests.yaml'
jobs:
build-native:
name: Build Native (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.14.0
- name: Cache Zig
uses: actions/cache@v4
with:
path: |
zig/.zig-cache
~/.cache/zig
key: zig-${{ runner.os }}-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
restore-keys: |
zig-${{ runner.os }}-
- name: Build
working-directory: zig
run: zig build
- name: Size Report
working-directory: zig
run: |
echo "════════════════════════════════════════════════════════════════"
echo " CR-SQLite Artifact Size Report"
echo "════════════════════════════════════════════════════════════════"
echo ""
echo "CR-SQLite Zig Build Artifacts:"
for f in zig-out/lib/*; do
if [ -f "$f" ]; then
SIZE=$(stat -c%s "$f" 2>/dev/null || stat -f%z "$f" 2>/dev/null)
SIZE_MB=$(echo "scale=2; $SIZE / 1024 / 1024" | bc)
echo " $(basename $f): ${SIZE_MB} MB (${SIZE} bytes)"
fi
done
echo ""
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: crsqlite-native-${{ runner.os }}
path: zig/zig-out/lib/
retention-days: 7
build-wasm:
name: Build WASM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.14.0
- name: Cache Zig
uses: actions/cache@v4
with:
path: |
zig/.zig-cache
~/.cache/zig
key: zig-wasm-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
restore-keys: |
zig-wasm-
- name: Build WASM
working-directory: zig
run: zig build wasm
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: crsqlite-wasm
path: zig/zig-out/lib/*.wasm
retention-days: 7
test-unit:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.14.0
- name: Cache Zig
uses: actions/cache@v4
with:
path: |
zig/.zig-cache
~/.cache/zig
key: zig-${{ runner.os }}-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
restore-keys: |
zig-${{ runner.os }}-
- name: Run unit tests
working-directory: zig
run: zig build test
test-parity:
name: Parity Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.14.0
- name: Install Nix
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Cache Zig
uses: actions/cache@v4
with:
path: |
zig/.zig-cache
~/.cache/zig
key: zig-${{ runner.os }}-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
restore-keys: |
zig-${{ runner.os }}-
- name: Build extension
working-directory: zig
run: zig build
- name: Run parity tests
working-directory: zig
run: make test-parity
test-browser:
name: Browser Tests
runs-on: ubuntu-latest
needs: build-wasm
steps:
- uses: actions/checkout@v4
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.14.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache Zig
uses: actions/cache@v4
with:
path: |
zig/.zig-cache
~/.cache/zig
key: zig-wasm-${{ hashFiles('zig/build.zig', 'zig/build.zig.zon') }}
restore-keys: |
zig-wasm-
- name: Build WASM
working-directory: zig
run: zig build wasm
- name: Install dependencies
working-directory: zig/browser-test
run: npm ci
- name: Install Playwright browsers
working-directory: zig/browser-test
run: npx playwright install --with-deps chromium
- name: Run browser tests
working-directory: zig/browser-test
run: npm test
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: zig/browser-test/test-results/
retention-days: 7