-
Notifications
You must be signed in to change notification settings - Fork 1
344 lines (295 loc) · 13.1 KB
/
Copy pathci.yml
File metadata and controls
344 lines (295 loc) · 13.1 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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
# Nightly full matrix: no path gating, no cache restore — the cold
# safety net that catches anything the scoped runs wrongly skipped.
schedule:
- cron: '0 3 * * *'
permissions:
contents: read
# A newer push to the same ref supersedes the running sweep — never
# stack two full runs.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
# Computes which slices of the tree a push touched, so the non-turbo
# jobs (the extension shards) can skip when nothing they cover
# changed. Turbo-driven jobs skip work through their cache instead.
changes:
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
extension: ${{ steps.filter.outputs.extension }}
steps:
# Only pushes have a diff base to gate on — every other trigger
# runs the full matrix and never reads this job's output.
- name: Checkout code
if: github.event_name == 'push'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Detect changed paths
if: github.event_name == 'push'
id: filter
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
with:
filters: |
extension:
- 'apps/extension/**'
- 'packages/**'
- 'pnpm-lock.yaml'
- 'package.json'
- 'turbo.json'
- 'tsconfig.base.json'
- '.github/workflows/ci.yml'
# Fast tripwires: lint (warn-only until the lint-debt session),
# typecheck, and the i18n gates. Fails in minutes when a push is
# structurally broken, while the test matrix grinds in parallel.
gates:
runs-on: ubuntu-latest
# Job timeouts sit at ~2x each job's observed wall time so a wedged
# infra step (dead apt mirror, hung install) releases the concurrency
# slot in minutes instead of holding it for the 6h default.
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22.x
cache: pnpm
- name: Cache Electron
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/electron
key: electron-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: electron-${{ runner.os }}-
# Content-addressed replay of unchanged tasks across runs; the
# nightly scheduled run stays cold on purpose.
- name: Cache turbo
if: github.event_name != 'schedule'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo/cache
key: turbo-gates-${{ runner.os }}-${{ github.sha }}
restore-keys: turbo-gates-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm biome check . || echo "::warning::Lint issues found — see output above"
- name: Typecheck all packages
run: pnpm turbo typecheck
- name: i18n hardcoded-string scan
run: pnpm turbo scan:i18n
- name: i18n locale-catalog lint
run: pnpm turbo lint:i18n-locales
# Plain-node vitest packages, serialized through turbo so suites that
# bind ports (daemon, web) never contend on one VM.
test-packages:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22.x
cache: pnpm
- name: Cache Electron
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/electron
key: electron-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: electron-${{ runner.os }}-
- name: Cache turbo
if: github.event_name != 'schedule'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo/cache
key: turbo-test-packages-${{ runner.os }}-${{ github.sha }}
restore-keys: turbo-test-packages-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Test node packages
run: >
pnpm turbo test --concurrency=1
--filter=@openheaders/core
--filter=@openheaders/i18n
--filter=@openheaders/oracle
--filter=@openheaders/oracle-host-browser
--filter=@openheaders/nm-host
--filter=@openheaders/cli
--filter=@openheaders/daemon
--filter=@openheaders/web
# The two electron-as-node suites, isolated on their own VM and
# serialized — Electron suites flake under same-machine contention.
test-electron-hosts:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22.x
cache: pnpm
- name: Cache Electron
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/electron
key: electron-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: electron-${{ runner.os }}-
# The runner's regional apt mirror (azure.archive) blackholes often
# enough to wedge apt past its own timeouts — route straight to the
# canonical archive, and keep the short acquire timeouts as the
# backstop for any remaining slow leg.
- name: Install Electron system dependencies
run: >
sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu|https://archive.ubuntu.com/ubuntu|' /etc/apt/apt-mirrors.txt &&
sudo apt-get -o Acquire::Retries=1 -o Acquire::http::Timeout=15 -o Acquire::https::Timeout=15 update &&
sudo apt-get -o Acquire::Retries=1 -o Acquire::http::Timeout=15 -o Acquire::https::Timeout=15 install -y
libgtk-3-0 libnotify4 libnss3 libxss1 libasound2t64 libgbm1
- name: Cache turbo
if: github.event_name != 'schedule'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo/cache
key: turbo-electron-hosts-${{ runner.os }}-${{ github.sha }}
restore-keys: turbo-electron-hosts-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Test electron hosts
run: >
pnpm turbo test --concurrency=1
--filter=@openheaders/oracle-host-node
--filter=@openheaders/desktop
# The extension suite's cost is per-file overhead across ~1,400 test
# files, so it shards near-linearly. Path-gated: only pushes that
# touch the extension or its inputs pay the three runners; every
# non-push trigger (PR, dispatch, nightly) runs unconditionally.
test-extension:
name: test-extension (shard ${{ matrix.shard }}/3)
runs-on: ubuntu-latest
timeout-minutes: 20
needs: changes
if: github.event_name != 'push' || needs.changes.outputs.extension == 'true'
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22.x
cache: pnpm
- name: Cache Electron
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/electron
key: electron-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: electron-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Typecheck stays off here: the shard runners never build workspace
# deps, so @openheaders/ui's dist-pointed types resolve to any and
# tsc storms. Test-file types ride the gates job's turbo typecheck
# (extension typecheck script runs tsconfig.test.json too).
- name: Test extension (shard ${{ matrix.shard }}/3)
run: >
pnpm --filter @openheaders/extension exec vitest run
--shard=${{ matrix.shard }}/3
--typecheck.enabled=false
--reporter=default --reporter=github-actions
build-e2e:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22.x
cache: pnpm
- name: Cache Electron
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/electron
key: electron-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: electron-${{ runner.os }}-
# The runner's regional apt mirror (azure.archive) blackholes often
# enough to wedge apt past its own timeouts — route straight to the
# canonical archive, and keep the short acquire timeouts as the
# backstop for any remaining slow leg.
- name: Install Electron system dependencies
run: >
sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu|https://archive.ubuntu.com/ubuntu|' /etc/apt/apt-mirrors.txt &&
sudo apt-get -o Acquire::Retries=1 -o Acquire::http::Timeout=15 -o Acquire::https::Timeout=15 update &&
sudo apt-get -o Acquire::Retries=1 -o Acquire::http::Timeout=15 -o Acquire::https::Timeout=15 install -y
libgtk-3-0 libnotify4 libnss3 libxss1 libasound2t64 libgbm1
- name: Cache turbo
if: github.event_name != 'schedule'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo/cache
key: turbo-build-e2e-${{ runner.os }}-${{ github.sha }}
restore-keys: turbo-build-e2e-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
# The web, extension, and desktop builds each peak ~4GB, so on the
# public 4-core/16GB runner two app builds share the box safely but
# three would not — and the heap cap stays lifted past Node's
# default so the big builds can reach their real working sets.
# The extension builds its chrome target only: one leg proves the
# pipeline, the e2e never loads it, and the four-browser matrix
# belongs to the release lanes.
- name: Build all packages
run: pnpm turbo build --concurrency=2 --filter=!@openheaders/extension
env:
NODE_OPTIONS: --max-old-space-size=6144
- name: Build extension (chrome only)
run: pnpm turbo build:chrome --filter=@openheaders/extension
env:
NODE_OPTIONS: --max-old-space-size=6144
# Ubuntu 24.04 confines unprivileged user namespaces behind AppArmor,
# which breaks Electron's sandbox under xvfb.
- name: Allow unprivileged user namespaces for the Electron sandbox
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
# The desktop's TUI gate probes PATH for `oh` — without it every
# provisioning state collapses to the install dialog.
- name: Put the built oh CLI on PATH
run: |
printf '#!/bin/sh\nexec node "%s/apps/cli/dist/cli.js" "$@"\n' "$PWD" | sudo tee /usr/local/bin/oh >/dev/null
sudo chmod +x /usr/local/bin/oh
command -v oh
- name: E2E — CLI provisioning (desktop + oh + pty)
run: xvfb-run --auto-servernum pnpm --filter @openheaders/desktop exec playwright test --trace retain-on-failure tests/e2e/cli-provision.spec.ts
- name: Upload e2e traces on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cli-provision-e2e-results
path: apps/desktop/tests/e2e/test-results
if-no-files-found: ignore
retention-days: 7