-
-
Notifications
You must be signed in to change notification settings - Fork 0
325 lines (270 loc) Β· 9.71 KB
/
Copy pathtest.yml
File metadata and controls
325 lines (270 loc) Β· 9.71 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
name: Test
on:
workflow_dispatch:
inputs:
linux-runner:
description: 'Linux runner label (custom image or vanilla fallback)'
required: false
default: 'blacksmith-4vcpu-ubuntu-2404'
type: choice
options:
- blacksmith-4vcpu-ubuntu-2404
- blacksmith-4vcpu-ubuntu-2404-mt
pull_request:
paths:
- 'crates/**'
- 'app/**'
- 'Cargo.*'
- 'taskfiles/**'
- '.github/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
rust:
name: Rust Lint, Format, and Test
runs-on: [macOS, ARM64]
timeout-minutes: 20
env:
CARGO_INCREMENTAL: 1
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v6
- name: Setup Tauri build environment
uses: ./.github/actions/setup-tauri-build
with:
mode: test
- name: Cargo fmt check
run: cargo fmt --all -- --check
- name: Cargo clippy
run: cargo clippy --workspace --all-features -- -D warnings
- name: Run Rust tests
run: cargo nextest run --workspace
deno-lint:
name: Deno Lint and Format Check
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Install Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Check Deno formatting
run: deno fmt --check
- name: Run Deno lint
run: deno lint
# Independent of the rust job and intentionally absent from build/playwright
# needs: so Zig work cannot extend the critical path.
zig:
name: Zig Lint, Test, and Build
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Read pinned Zig toolchain from .tool-versions
id: zig-version
shell: bash
run: |
version=$(grep '^zig ' .tool-versions | awk '{print $2}')
echo "toolchain=${version}" >> "$GITHUB_OUTPUT"
- name: Restore Zig build cache
uses: actions/cache@v4
with:
path: |
zig-core/.zig-cache
zig-core/zig-out
key: zig-build-${{ runner.os }}-${{ steps.zig-version.outputs.toolchain }}-${{ hashFiles('zig-core/build.zig', 'zig-core/build.zig.zon', 'zig-core/src/**/*.zig', 'zig-core/vendor/**', '.tool-versions') }}
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: ${{ steps.zig-version.outputs.toolchain }}
- name: Install Task
uses: go-task/setup-task@v1
- name: Zig format check
run: task zig:lint
- name: Zig tests
run: task zig:test
- name: Zig build
run: task zig:build
# Shadow-diff parity between the Rust library_get_all and its Zig port
# (TASK-355.5 AC#6). Deliberately not in any other job's `needs`, and
# continue-on-error, so a divergence is reported on the PR without blocking
# an unrelated change: the harness compares two implementations of the same
# query rather than verifying either against a spec, and it needs both the
# Rust and Zig toolchains plus a staged sidecar, which the rust job
# intentionally does not carry.
shadow-diff:
name: Rust/Zig Shadow-Diff Parity
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 25
steps:
- uses: actions/checkout@v6
- name: Setup Tauri build environment
uses: ./.github/actions/setup-tauri-build
with:
mode: test
- name: Read pinned Zig toolchain from .tool-versions
id: zig-version
shell: bash
run: |
version=$(grep '^zig ' .tool-versions | awk '{print $2}')
echo "toolchain=${version}" >> "$GITHUB_OUTPUT"
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: ${{ steps.zig-version.outputs.toolchain }}
- name: Install Task
uses: go-task/setup-task@v1
- name: Run shadow-diff parity harness
continue-on-error: true
run: task ci:shadow-diff TARGET=x86_64-unknown-linux-gnu
build:
name: Build (${{ matrix.platform }})
# Gate on deno-lint only -- rust/vitest-tests/playwright-tests run in
# parallel and don't produce artifacts the build matrix consumes, so
# serializing on them just adds wall-clock (see docs/builds.md#test-workflow-dependency-graph).
needs: [deno-lint]
if: ${{ !failure() && !cancelled() }}
strategy:
fail-fast: false
matrix:
include:
- platform: macos
os: [macOS, ARM64]
target: aarch64-apple-darwin
- platform: linux
os: ${{ inputs.linux-runner || 'blacksmith-4vcpu-ubuntu-2404' }}
target: x86_64-unknown-linux-gnu
- platform: windows
os: blacksmith-4vcpu-windows-2025
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
# Linux: skip Docker build when cargo-check inputs haven't changed.
# Hash covers everything the Dockerfile check target copies:
# Cargo manifests, lockfile, Rust source, cargo config, and the
# Dockerfile itself. Cache hit means cargo check already passed
# for these exact inputs β no need to spin up Docker at all.
- name: Check cargo-check cache (Linux)
if: runner.os == 'Linux'
id: cargo-check-cache
uses: actions/cache@v4
with:
path: .cargo-check-sentinel
key: linux-cargo-check-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'crates/**/*.rs', 'crates/**/Cargo.toml', 'crates/**/.cargo/**', 'docker/linux/Dockerfile') }}
- name: Skip notice (Linux)
if: runner.os == 'Linux' && steps.cargo-check-cache.outputs.cache-hit == 'true'
run: echo "cargo check inputs unchanged β skipping Docker build"
# Linux: containerized cargo check with Blacksmith Docker layer caching
- name: Setup Docker builder (Linux)
if: runner.os == 'Linux' && steps.cargo-check-cache.outputs.cache-hit != 'true'
uses: useblacksmith/setup-docker-builder@v1
- name: Cargo check (Linux)
if: runner.os == 'Linux' && steps.cargo-check-cache.outputs.cache-hit != 'true'
uses: useblacksmith/build-push-action@v2
with:
context: .
file: docker/linux/Dockerfile
target: check
push: false
- name: Write cargo-check sentinel (Linux)
if: runner.os == 'Linux' && steps.cargo-check-cache.outputs.cache-hit != 'true'
run: date -u > .cargo-check-sentinel
# macOS/Windows: bare-metal setup + cargo check
- name: Setup Tauri build environment
if: runner.os != 'Linux'
uses: ./.github/actions/setup-tauri-build
with:
mode: check
- name: Cargo check (macOS)
if: runner.os == 'macOS'
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
run: task ci:check TARGET=${{ matrix.target }}
- name: Cargo check (Windows)
if: runner.os == 'Windows'
shell: pwsh
env:
GITHUB_TOKEN: ${{ github.token }}
run: task ci:check TARGET=${{ matrix.target }}
vitest-tests:
name: Vitest Unit Tests
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Setup frontend
uses: ./.github/actions/setup-frontend
with:
cache: 'npm'
cache-dependency-path: app/frontend/package-lock.json
- name: Run Vitest with coverage
working-directory: ./app/frontend
run: npm run test:coverage
- name: Upload coverage report
if: always()
continue-on-error: true
uses: actions/upload-artifact@v7
with:
name: vitest-coverage
path: app/frontend/coverage/
retention-days: 30
# Detect frontend changes for conditional Playwright execution
changes:
name: Detect Changes
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 2
outputs:
frontend: ${{ steps.filter.outputs.frontend }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
frontend:
- 'app/frontend/**'
playwright-tests:
name: Playwright E2E Tests
# Runs against a Vite preview build with mocked IPC -- no Tauri/Rust
# artifact dependency, so it only needs deno-lint plus the change filter.
needs: [changes, deno-lint]
if: ${{ !failure() && !cancelled() && (needs.changes.outputs.frontend == 'true' || github.event_name == 'workflow_dispatch') }}
runs-on: [macOS, ARM64]
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- name: Setup frontend
uses: ./.github/actions/setup-frontend
- name: Install Playwright browsers
working-directory: ./app/frontend
run: npx playwright install --with-deps webkit
- name: Kill stale dev server on port 5173
run: lsof -ti:5173 | xargs kill -9 2>/dev/null || true
- name: Run Playwright tests
working-directory: ./app/frontend
run: npx playwright test
env:
CI: true
- name: Upload Playwright report
if: always()
continue-on-error: true
uses: actions/upload-artifact@v7
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Upload test results
if: always()
continue-on-error: true
uses: actions/upload-artifact@v7
with:
name: playwright-results
path: test-results/
retention-days: 30