-
-
Notifications
You must be signed in to change notification settings - Fork 0
241 lines (202 loc) Β· 6.89 KB
/
test.yml
File metadata and controls
241 lines (202 loc) Β· 6.89 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
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
build:
name: Build (${{ matrix.platform }})
# Gate on lint/format/test jobs so builds don't burn CI minutes
# when basic checks fail.
needs: [deno-lint, rust, vitest-tests, playwright-tests]
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
needs: [changes, deno-lint, rust, vitest-tests]
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