-
Notifications
You must be signed in to change notification settings - Fork 29
385 lines (333 loc) · 14.8 KB
/
Copy pathfork-ci.yml
File metadata and controls
385 lines (333 loc) · 14.8 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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
name: Fork CI
# Fork-owned CI (dshcode). The inherited upstream workflows keep their
# upstream targets (DeepSeek's org-scoped runner pools and provider secrets)
# and stay disabled in the fork's Actions settings — ci.yml, e2e.yml,
# sandbox.yml, and the npm release workflows are `disabled_manually`; they
# stay verbatim so upstream syncs never conflict on them. This workflow is
# the fork's real signal, entirely on GitHub-hosted runners and entirely
# keyless, so it is safe for untrusted contributor PRs.
#
# Job map:
# - static: Typert contracts, lint, typecheck (host + client), the doc-sync
# aggregate, the shared static gates (constraints, package
# invariants, Cordis config, runtime closure, optional-dependency
# imports, issue policy), the module graph check, and the desktop
# runtime closure
# - unit: the complete keyless vitest unit inventory (thread-safe and
# process-bound projects; includes apps/desktop and apps/web specs)
# - web: built web frontend + keyless browser replay
# (DSH_SNAPSHOT=replay over apps/web/tests). Promoted into the
# verdict after its first Ubuntu run proved the fork's goldens
# current (one stale retry golden, refreshed in df281d24e2).
# - coverage: per-file 100% coverage gate on packages/*/*/src
# - all-checks-passed: single stable required check for branch protection
#
# Deliberately absent for now:
# - knip and duplication: the fork carries pre-existing debt on both
# (unused desktop file/deps, 108 unlisted test imports, 14 plugin-installer
# clones), so the upstream check:ci:static aggregate (which embeds knip)
# cannot run whole; this lane pins its green subset instead. Fix the debt,
# then rejoin via check:ci:static plus one duplication step.
# - Snapshot replays (test:snapshot): their goldens are upstream-owned and
# drift on this fork; re-own them with a fork-side refresh before
# re-enabling (check:ci:snapshot after build).
# - Real-API e2e: needs provider keys this public fork does not hold; e2e.yml
# stays disabled in the fork's Actions settings, and real-API runs remain a
# manual, keyed concern.
# - Desktop packaging: desktop.yml owns the desktop-v* tag matrix
# (macOS arm64/x64 + Windows x64) and the release assembly.
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: fork-ci-${{ github.ref }}
# A push run is the post-merge signal and the cache producer; never cancel
# it. Every other event (pull request, manual dispatch) cancels superseded
# runs in the same group — the negated form matches upstream's semantics.
cancel-in-progress: ${{ github.event_name != 'push' }}
env:
PRIMARY_NODE_VERSION: '24'
# CI runs must never report to the production telemetry endpoint baked
# into apps/cli/cordis.yml (AppCLIEntry disables the row when set).
DSH_TELEMETRY_DISABLED: '1'
jobs:
static:
name: static (lint, typecheck, gates)
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
# Full history so the archived-agent-notes gate can read the trusted PR
# base from a reused shallow checkout.
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- uses: pnpm/action-setup@v4
with:
dest: ${{ runner.temp }}/setup-pnpm
- uses: actions/setup-node@v6
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Configure pnpm store path
id: pnpm-store
run: |
store_root="$HOME/.local/share/pnpm/store"
echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
echo "path=$store_path" >> "$GITHUB_OUTPUT"
- name: Restore pnpm store
uses: actions/cache/restore@v4
with:
path: ${{ steps.pnpm-store.outputs.path }}
key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
- name: Install (immutable)
run: pnpm install --frozen-lockfile
# One host build feeds every contracts-ready consumer below; the raw
# `lint`/`typecheck` scripts would each rebuild it.
- name: Typert contracts (host build)
run: pnpm run build:lib:host
- name: Lint
run: pnpm run lint:contracts-ready
- name: Typecheck (host + client)
run: pnpm run typecheck:contracts-ready
# DSH_ARCHIVE_BASE_REF must be set exactly on pull requests: an empty
# string would be read as a literal ref instead of the HEAD default.
- name: Run documentation gates (pull request)
if: github.event_name == 'pull_request'
env:
DSH_ARCHIVE_BASE_REF: ${{ github.event.pull_request.base.sha }}
run: pnpm run doc-sync
- name: Run documentation gates (push)
if: github.event_name != 'pull_request'
run: pnpm run doc-sync
# The shared static gates from upstream's check:ci:static, minus the
# deferred knip and duplication lanes (see the header job map).
- name: Runtime closure
run: pnpm run verify-runtime-closure
- name: Workspace constraints
run: pnpm run constraints
- name: DSH package licenses
run: pnpm run verify-dsh-package-licenses
- name: Package invariants
run: pnpm run verify-package-invariants
- name: Cordis config
run: pnpm run verify-cordis-config
- name: Optional dependency imports
run: pnpm run verify-optional-dependency-imports
- name: Issue management policy
run: pnpm run test:issue-management
- name: Module graph
run: pnpm run verify-module-graph
- name: Desktop runtime closure
run: pnpm run verify-desktop-runtime-closure
unit:
name: unit tests
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: pnpm/action-setup@v4
with:
dest: ${{ runner.temp }}/setup-pnpm
- uses: actions/setup-node@v6
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Configure pnpm store path
id: pnpm-store
run: |
store_root="$HOME/.local/share/pnpm/store"
echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
echo "path=$store_path" >> "$GITHUB_OUTPUT"
- name: Restore pnpm store
uses: actions/cache/restore@v4
with:
path: ${{ steps.pnpm-store.outputs.path }}
key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
# The single producer of the pnpm store cache: five parallel saves of
# one key would race and waste compression on every master push.
- name: Save pnpm store (master push)
if: github.event_name == 'push'
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-store.outputs.path }}
key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
- name: Install dependencies and prepare bubblewrap
run: |
pnpm install --frozen-lockfile &
install_pid=$!
bash scripts/prepare-ci-bubblewrap.sh &
sandbox_pid=$!
install_status=0
wait "$install_pid" || install_status=$?
sandbox_status=0
wait "$sandbox_pid" || sandbox_status=$?
if (( install_status != 0 )); then exit "$install_status"; fi
exit "$sandbox_status"
- name: Run unit tests
# Two forked workers leave headroom on the 4-vCPU hosted runner:
# run 5 of the fork's monolith CI failed at unit tests on a docs-only
# commit, and the timing-sensitive terminal/subprocess suites run in
# the same inventory as the CPU-heavy files.
run: pnpm exec vitest run --maxWorkers=2
web:
name: web browser replay
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: pnpm/action-setup@v4
with:
dest: ${{ runner.temp }}/setup-pnpm
- uses: actions/setup-node@v6
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Configure pnpm store path
id: pnpm-store
run: |
store_root="$HOME/.local/share/pnpm/store"
echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
echo "path=$store_path" >> "$GITHUB_OUTPUT"
- name: Restore pnpm store
uses: actions/cache/restore@v4
with:
path: ${{ steps.pnpm-store.outputs.path }}
key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
- name: Install dependencies and prepare bubblewrap
run: |
pnpm install --frozen-lockfile &
install_pid=$!
bash scripts/prepare-ci-bubblewrap.sh &
sandbox_pid=$!
install_status=0
wait "$install_pid" || install_status=$?
sandbox_status=0
wait "$sandbox_pid" || sandbox_status=$?
if (( install_status != 0 )); then exit "$install_status"; fi
exit "$sandbox_status"
- name: Restore Playwright browser cache
uses: actions/cache/restore@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-
# The single producer of the Playwright browser cache (only this lane
# installs Chromium, so the save needs no deduplication).
- name: Save Playwright browser cache (master push)
if: github.event_name == 'push'
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright Chromium and system dependencies
run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install --with-deps chromium
- name: Build and run keyless web browser replay
env:
DSH_SNAPSHOT: replay
DSH_BUILD_CLIENT_PROFILE: official
run: pnpm run test:web
coverage:
name: coverage (per-file 100%)
runs-on: ubuntu-latest
timeout-minutes: 120
env:
# A 4-vCPU hosted runner splits its worker budget: two instrumented
# workers plus one exempt heavy-suite worker. Gate concurrency 2 lets
# the two coverage gates overlap (2 + 1 = 3 forks) instead of running
# serially, keeping the lane well inside its timeout.
DSH_COVERAGE_MAX_WORKERS: '3'
DSH_GATE_CONCURRENCY: '2'
# The overlapping gates starve timing-sensitive scenario hosts; this
# knob widens Vitest timeouts AND the process-exit scenario's ready
# wait (which reads it) on this lane only.
DSH_COVERAGE_TEST_TIMEOUT_MS: '60000'
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: pnpm/action-setup@v4
with:
dest: ${{ runner.temp }}/setup-pnpm
- uses: actions/setup-node@v6
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Configure pnpm store path
id: pnpm-store
run: |
store_root="$HOME/.local/share/pnpm/store"
echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
echo "path=$store_path" >> "$GITHUB_OUTPUT"
- name: Restore pnpm store
uses: actions/cache/restore@v4
with:
path: ${{ steps.pnpm-store.outputs.path }}
key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
- name: Install dependencies and prepare bubblewrap
run: |
pnpm install --frozen-lockfile &
install_pid=$!
bash scripts/prepare-ci-bubblewrap.sh &
sandbox_pid=$!
install_status=0
wait "$install_pid" || install_status=$?
sandbox_status=0
wait "$sandbox_pid" || sandbox_status=$?
if (( install_status != 0 )); then exit "$install_status"; fi
exit "$sandbox_status"
- name: Run exhaustive coverage
# The tee keeps a log the annotation step below can re-emit when the
# per-file threshold fails; the command text must stay a superset of
# `pnpm run check:ci:coverage` for the workflow spec's step-run pin.
run: pnpm run check:ci:coverage 2>&1 | tee coverage.log
shell: bash
- name: Surface coverage failures as annotations
if: failure()
run: |
# v8 threshold errors and uncovered-location records are log-only by
# default; re-emit them as workflow annotations so a per-file miss
# names the offending file without downloading the raw log.
grep -E 'ERROR: Coverage|does not meet|uncovered' coverage.log | sed 's/^[[:space:]]*//' | sed 's/^/::error::/' || true
shell: bash
# Single stable required check for branch protection: require "Fork CI /
# all checks passed" instead of enumerating jobs whose names evolve as lanes
# change. Every blocking job above must stay listed in `needs`.
# `if: always()` is load-bearing: without it a failed dependency would SKIP
# this job, and GitHub counts a skipped required check as passing — so this
# job always runs on pull requests and fails on any non-success result,
# including 'cancelled' and 'skipped'.
all-checks-passed:
name: all checks passed
needs: [static, unit, coverage]
if: always() && github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Fail if any needed job did not succeed
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
run: |
echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
exit 1
- name: All checks passed
run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"