-
-
Notifications
You must be signed in to change notification settings - Fork 0
255 lines (211 loc) Β· 6.74 KB
/
test.yml
File metadata and controls
255 lines (211 loc) Β· 6.74 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
name: Test
on:
workflow_dispatch:
pull_request:
paths:
- 'crates/**'
- 'app/**'
- 'Cargo.*'
- 'taskfiles/**'
- '.github/**'
push:
branches: [main]
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-lint:
name: Rust Lint and Format Check
runs-on: [self-hosted, macOS, ARM64]
timeout-minutes: 15
steps:
- name: Setup macOS self-hosted runner PATH
shell: bash
run: |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
echo "/opt/homebrew/bin:/opt/homebrew/sbin" >> $GITHUB_PATH
- uses: actions/checkout@v6
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
components: clippy, rustfmt
cache: false
- name: Cargo clippy
run: cargo clippy --workspace -- -D warnings
- name: Cargo fmt check
run: cargo fmt --all -- --check
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 }})
needs: [rust-lint, deno-lint, vitest-tests, playwright-tests, rust-tests]
strategy:
fail-fast: false
matrix:
include:
- platform: macos
os: [macOS, ARM64, studio]
target: aarch64-apple-darwin
- platform: linux
os: blacksmith-4vcpu-ubuntu-2404
target: x86_64-unknown-linux-gnu
- platform: windows
os: [self-hosted, Windows, X64]
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- name: Bootstrap Windows prerequisites
if: runner.os == 'Windows'
shell: powershell
run: |
$ProgressPreference = 'SilentlyContinue'
$toInstall = @()
if (-not (Get-Command git -ErrorAction SilentlyContinue)) { $toInstall += 'git' }
if (-not (Get-Command pwsh -ErrorAction SilentlyContinue)) { $toInstall += 'pwsh' }
if ($toInstall.Count -gt 0) {
choco install @toInstall -y
}
$gitPath = (Get-ItemProperty 'HKLM:\SOFTWARE\GitForWindows' -ErrorAction SilentlyContinue).InstallPath
if ($gitPath) {
echo "$gitPath\cmd" >> $env:GITHUB_PATH
}
- uses: actions/checkout@v6
- name: Setup Tauri build environment
uses: ./.github/actions/setup-tauri-build
- name: Cargo check (Linux)
if: runner.os == 'Linux'
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
run: task ci:check TARGET=${{ matrix.target }}
- 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 Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: app/frontend/package-lock.json
- name: Install frontend dependencies
working-directory: ./app/frontend
run: npm ci
- name: Run Vitest with coverage
working-directory: ./app/frontend
run: npm run test:coverage
continue-on-error: true
- 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
playwright-tests:
name: Playwright E2E Tests
runs-on: [macOS, ARM64]
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install frontend dependencies
working-directory: ./app/frontend
run: npm ci
- 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
rust-tests:
name: Rust Tests with Coverage
needs: rust-lint
runs-on: [macOS, ARM64, studio]
timeout-minutes: 10
env:
CARGO_INCREMENTAL: 1
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v6
- name: Setup Tauri build environment
uses: ./.github/actions/setup-tauri-build
- name: Check Rust build
run: cargo check --workspace --all-features
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-tarpaulin
run: cargo binstall --no-confirm --force cargo-tarpaulin
- name: Run Rust tests with coverage
run: |
cargo tarpaulin --workspace --out Html --out Json --output-dir coverage \
--ignore-tests --skip-clean \
--exclude-files 'crates/mt-tauri/src/commands/*' 'crates/mt-tauri/src/lib.rs' 'crates/mt-tauri/src/main.rs' 'crates/mt-tauri/src/watcher.rs' 'crates/mt-tauri/src/dialog.rs' 'crates/mt-tauri/src/media_keys.rs' \
--fail-under 50
- name: Upload coverage report
if: always()
continue-on-error: true
uses: actions/upload-artifact@v7
with:
name: rust-coverage
path: coverage/
retention-days: 30