ci.yml 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. name: CI
  2. on:
  3. push:
  4. branches: [master]
  5. pull_request:
  6. workflow_dispatch:
  7. inputs:
  8. suite:
  9. description: Manual CI suite to run
  10. required: true
  11. default: larger-runner-benchmark
  12. type: choice
  13. options:
  14. - larger-runner-benchmark
  15. - consolidated-runner-benchmark
  16. concurrency:
  17. group: ${{ github.workflow }}-${{ github.ref }}
  18. cancel-in-progress: true
  19. permissions:
  20. contents: read
  21. env:
  22. PRIMARY_NODE_VERSION: '24'
  23. jobs:
  24. # FIXME: Re-enable the three hosted serial reference jobs before cutting a release.
  25. # The self-hosted standby remains active on every master push.
  26. # Three enterprise jobs isolate coverage, static analysis, and the
  27. # build-backed consumer tail. The consumer job owns the only Linux build so
  28. # all three jobs enter runner allocation independently.
  29. #
  30. # FAILOVER: each Linux enterprise job resolves its pool through the
  31. # DSH_CI_FAILOVER repository variable. Unset (normal), the expressions
  32. # pick the hosted enterprise pools below. Setting the variable to
  33. # 'selfhosted' (repo Settings → Actions → Variables; writer-manageable
  34. # repository state — not PR-editable, no merge required) retargets all
  35. # three onto the in-house
  36. # vm-backup pool and re-running the failed jobs is the entire switch —
  37. # see .agents/notes/implemented/process/2026-07-26-ci-failover-runbook.md. The
  38. # in-house pool's readiness is re-proven on every master push by the
  39. # serial-linux-selfhosted standby lane below.
  40. node-24:
  41. if: github.event_name == 'pull_request'
  42. runs-on: >-
  43. ${{ vars.DSH_CI_FAILOVER == 'selfhosted'
  44. && github.event.pull_request.user.login != 'dependabot[bot]'
  45. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  46. || 'dsh-enterprise-ubuntu-latest-32core-test' }}
  47. name: node 24 / static
  48. env:
  49. DSH_GATE_CONCURRENCY: '8'
  50. steps:
  51. # Fetch complete history so the archive gate can read the trusted PR base from a reused shallow checkout.
  52. - uses: actions/checkout@v6
  53. with:
  54. fetch-depth: 0
  55. persist-credentials: false
  56. - uses: pnpm/action-setup@v4
  57. with:
  58. dest: ${{ runner.temp }}/setup-pnpm
  59. - uses: actions/setup-node@v6
  60. with:
  61. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  62. - name: Configure pnpm store path
  63. id: pnpm-store
  64. run: |
  65. store_root="$HOME/.local/share/pnpm/store"
  66. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  67. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  68. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  69. # Pull requests consume the default-branch cache but do not put cache
  70. # compression and upload on the paid latency-critical path. Skipped
  71. # under failover — see the coverage lane's identical rationale.
  72. - uses: actions/cache/restore@v4
  73. if: vars.DSH_CI_FAILOVER != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  74. with:
  75. path: ${{ steps.pnpm-store.outputs.path }}
  76. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  77. restore-keys: |
  78. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  79. - name: Install (immutable)
  80. run: pnpm install --frozen-lockfile
  81. - name: Run static gates
  82. env:
  83. DSH_ARCHIVE_BASE_REF: ${{ github.event.pull_request.base.sha }}
  84. run: pnpm run check:ci:static
  85. node-24-coverage:
  86. if: github.event_name == 'pull_request'
  87. runs-on: >-
  88. ${{ vars.DSH_CI_FAILOVER == 'selfhosted'
  89. && github.event.pull_request.user.login != 'dependabot[bot]'
  90. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  91. || 'dsh-enterprise-ubuntu-24-04-32core-test' }}
  92. name: node 24 / coverage
  93. env:
  94. # Failover shrinks the worker bound: the hosted 32-core runner is
  95. # exclusive to one job, but the failover pool shares one 64-core VM
  96. # across six always-on runner instances, and the timing-sensitive
  97. # process suites have documented aggregate-contention failures.
  98. # 8 × 6 instances = 48 workers worst case on 64 cores.
  99. DSH_COVERAGE_MAX_WORKERS: ${{ vars.DSH_CI_FAILOVER == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '8' || '8' }}
  100. DSH_GATE_CONCURRENCY: '3'
  101. NODE_OPTIONS: '--max-old-space-size=8192'
  102. steps:
  103. - uses: actions/checkout@v6
  104. with:
  105. persist-credentials: false
  106. - uses: pnpm/action-setup@v4
  107. with:
  108. dest: ${{ runner.temp }}/setup-pnpm
  109. - uses: actions/setup-node@v6
  110. with:
  111. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  112. - name: Configure pnpm store path
  113. id: pnpm-store
  114. run: |
  115. store_root="$HOME/.local/share/pnpm/store"
  116. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  117. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  118. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  119. # Skipped under failover: the self-hosted VM's persistent pnpm store
  120. # already serves warm installs, while restoring the hosted archive
  121. # would spend ~52 s pulling ~180 MB into that populated store.
  122. - uses: actions/cache/restore@v4
  123. if: vars.DSH_CI_FAILOVER != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  124. with:
  125. path: ${{ steps.pnpm-store.outputs.path }}
  126. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  127. restore-keys: |
  128. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  129. - name: Install dependencies and prepare bubblewrap
  130. run: |
  131. pnpm install --frozen-lockfile &
  132. install_pid=$!
  133. bash scripts/prepare-ci-bubblewrap.sh &
  134. sandbox_pid=$!
  135. install_status=0
  136. wait "$install_pid" || install_status=$?
  137. sandbox_status=0
  138. wait "$sandbox_pid" || sandbox_status=$?
  139. if (( install_status != 0 )); then exit "$install_status"; fi
  140. exit "$sandbox_status"
  141. - name: Run exhaustive coverage
  142. run: pnpm run check:ci:coverage
  143. node-24-consumers:
  144. if: github.event_name == 'pull_request'
  145. runs-on: >-
  146. ${{ vars.DSH_CI_FAILOVER == 'selfhosted'
  147. && github.event.pull_request.user.login != 'dependabot[bot]'
  148. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  149. || 'dsh-enterprise-ubuntu-latest-32core-test' }}
  150. name: node 24 / snapshots and artifacts
  151. env:
  152. DSH_GATE_CONCURRENCY: '8'
  153. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  154. DSH_OXLINT_THREADS: '8'
  155. DSH_PUBLINT_CONCURRENCY: '8'
  156. # Failover halves snapshot concurrency for the shared 64-core VM.
  157. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '12' || '32' }}
  158. steps:
  159. - uses: actions/checkout@v6
  160. with:
  161. persist-credentials: false
  162. - uses: pnpm/action-setup@v4
  163. with:
  164. dest: ${{ runner.temp }}/setup-pnpm
  165. - uses: actions/setup-node@v6
  166. with:
  167. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  168. - name: Configure pnpm store path
  169. id: pnpm-store
  170. run: |
  171. store_root="$HOME/.local/share/pnpm/store"
  172. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  173. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  174. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  175. # Skipped under failover — see the coverage lane's identical rationale.
  176. - uses: actions/cache/restore@v4
  177. if: vars.DSH_CI_FAILOVER != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  178. with:
  179. path: ${{ steps.pnpm-store.outputs.path }}
  180. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  181. restore-keys: |
  182. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  183. # Pull requests restore the cache normally produced by serial-linux on
  184. # master; they do not pay compression and upload on the required path.
  185. - uses: actions/cache/restore@v4
  186. if: vars.DSH_CI_FAILOVER != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  187. with:
  188. path: ~/.cache/ms-playwright
  189. key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
  190. restore-keys: |
  191. ${{ runner.os }}-playwright-
  192. - name: Install dependencies and prepare bubblewrap
  193. run: |
  194. pnpm install --frozen-lockfile &
  195. install_pid=$!
  196. bash scripts/prepare-ci-bubblewrap.sh &
  197. sandbox_pid=$!
  198. install_status=0
  199. wait "$install_pid" || install_status=$?
  200. sandbox_status=0
  201. wait "$sandbox_pid" || sandbox_status=$?
  202. if (( install_status != 0 )); then exit "$install_status"; fi
  203. exit "$sandbox_status"
  204. - name: Install Playwright Chromium and hosted dependencies
  205. if: vars.DSH_CI_FAILOVER != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  206. run: pnpm --filter @deepseek-ai/dsh-frontend exec playwright install --with-deps chromium
  207. # The persistent VM image owns Playwright's Linux system packages; do
  208. # not mutate the shared host with apt on every failover run.
  209. - name: Install Playwright Chromium on the failover VM
  210. if: vars.DSH_CI_FAILOVER == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]'
  211. run: pnpm --filter @deepseek-ai/dsh-frontend exec playwright install chromium
  212. - name: Run compatibility, snapshot, and artifact gates
  213. run: pnpm run check:ci:consumers
  214. node-compat:
  215. if: github.event_name == 'pull_request'
  216. # Each compatibility contract receives an independent standard hosted job.
  217. runs-on: ${{ matrix.runner }}
  218. name: ${{ matrix.name }}
  219. env:
  220. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  221. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  222. strategy:
  223. fail-fast: false
  224. matrix:
  225. include:
  226. - node: '22.19'
  227. name: node 22.19
  228. runner: ubuntu-latest
  229. gate_concurrency: '1'
  230. - node: 26
  231. name: node 26
  232. runner: ubuntu-latest
  233. gate_concurrency: '1'
  234. steps:
  235. - uses: actions/checkout@v6
  236. - uses: pnpm/action-setup@v4
  237. with:
  238. dest: ${{ runner.temp }}/setup-pnpm
  239. - uses: actions/setup-node@v6
  240. with:
  241. node-version: ${{ matrix.node }}
  242. cache: pnpm
  243. - name: Install (immutable)
  244. run: pnpm install --frozen-lockfile
  245. - name: Run compatibility smokes
  246. run: pnpm run check:node-compat
  247. python-sdk:
  248. if: github.event_name == 'pull_request'
  249. runs-on: ubuntu-latest
  250. name: python 3.10 / keyless SDK
  251. steps:
  252. - uses: actions/checkout@v6
  253. - uses: actions/setup-python@v6.3.0
  254. with:
  255. python-version: '3.10'
  256. cache: pip
  257. - name: Install uv
  258. run: python -m pip install uv==0.11.23
  259. - name: Run complete keyless Python suite
  260. run: uv run --python 3.10 --group test --project python/sdk pytest
  261. # The required pull-request Windows signal: the two blocking win32 surfaces
  262. # (workspace build, production site) execute with real, checksum-verified
  263. # Windows Node under Wine on standard hosted Linux. The master
  264. # serial-windows job below normally keeps the complete native-kernel
  265. # inventory — including the observational portability gates this lane does
  266. # not run —
  267. # on real windows-2025. This job only provisions runner state (caches,
  268. # apt); scripts/wine-windows-gates.sh owns the gate logic and is the same
  269. # script the optional local gate `pnpm run check:windows-wine` runs.
  270. # Layout, fidelity limits, and measured timings live in
  271. # .agents/notes/implemented/process/2026-07-27-wine-windows-gates-experiment.md
  272. windows:
  273. if: github.event_name == 'pull_request'
  274. runs-on: ubuntu-latest
  275. name: windows node 24 / wine blocking
  276. timeout-minutes: 15
  277. steps:
  278. - uses: actions/checkout@v6
  279. with:
  280. persist-credentials: false
  281. - uses: pnpm/action-setup@v4
  282. with:
  283. dest: ${{ runner.temp }}/setup-pnpm
  284. - uses: actions/setup-node@v6
  285. with:
  286. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  287. - name: Configure pnpm store path
  288. id: pnpm-store
  289. run: |
  290. store_root="$HOME/.local/share/pnpm/store"
  291. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  292. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  293. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  294. - uses: actions/cache/restore@v4
  295. with:
  296. path: ${{ steps.pnpm-store.outputs.path }}
  297. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  298. restore-keys: |
  299. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  300. # Master's wine-apt-cache job seeds the default-branch scope every pull
  301. # request can read; a save from this job only reaches reruns of the
  302. # same merge ref.
  303. - name: Compose Wine apt cache key
  304. id: wine-cache-key
  305. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  306. - uses: actions/cache@v4
  307. with:
  308. path: ~/wine-debs
  309. key: ${{ steps.wine-cache-key.outputs.key }}
  310. # Runner provisioning only — a developer machine installs Wine through
  311. # its own package manager; the gate script assumes a wine binary and
  312. # fails loud without one. Wine from the apt cache when present; else
  313. # download the full dependency closure once and keep it for the next
  314. # run. The `wine` dispatcher package (not bare `wine64`) is what puts a
  315. # binary on PATH.
  316. - name: Install Wine
  317. run: |
  318. if compgen -G "$HOME/wine-debs/*.deb" > /dev/null; then
  319. sudo apt-get install -y --no-install-recommends "$HOME"/wine-debs/*.deb
  320. else
  321. sudo apt-get update
  322. sudo apt-get install -y --no-install-recommends --download-only wine
  323. mkdir -p "$HOME/wine-debs"
  324. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/" 2>/dev/null || true
  325. sudo apt-get install -y --no-install-recommends wine
  326. fi
  327. - name: Run the Wine Windows gates
  328. run: bash scripts/wine-windows-gates.sh
  329. - name: Shut down wineserver
  330. if: always()
  331. run: wineserver -k 2>/dev/null || true
  332. # Master seeds the Wine apt-archive cache in the default-branch scope,
  333. # which every pull request's windows job can restore; saves from
  334. # pull-request runs are scoped to their own merge ref and help nobody
  335. # else. Runs in seconds when the image version already has a cache.
  336. wine-apt-cache:
  337. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  338. name: wine apt cache
  339. runs-on: ubuntu-latest
  340. timeout-minutes: 10
  341. steps:
  342. - name: Compose Wine apt cache key
  343. id: wine-cache-key
  344. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  345. - uses: actions/cache@v4
  346. id: wine-cache
  347. with:
  348. path: ~/wine-debs
  349. key: ${{ steps.wine-cache-key.outputs.key }}
  350. - name: Download the Wine dependency closure
  351. if: steps.wine-cache.outputs.cache-hit != 'true'
  352. run: |
  353. sudo apt-get update
  354. sudo apt-get install -y --no-install-recommends --download-only wine
  355. mkdir -p "$HOME/wine-debs"
  356. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/"
  357. du -sh "$HOME/wine-debs"
  358. # The hosted reference jobs below are temporarily disabled; the self-hosted
  359. # standby remains active. Each enabled host executes the complete, unsharded
  360. # primary Node aggregate with one gate worker, giving reviewers a simple
  361. # cross-platform oracle for completeness and timing.
  362. serial-linux:
  363. if: false
  364. name: serial / linux
  365. runs-on: ubuntu-latest
  366. steps:
  367. - uses: actions/checkout@v6
  368. with:
  369. fetch-depth: 2
  370. - uses: pnpm/action-setup@v4
  371. with:
  372. dest: ${{ runner.temp }}/setup-pnpm
  373. - uses: actions/setup-node@v6
  374. with:
  375. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  376. - name: Configure pnpm store path
  377. id: pnpm-store
  378. run: |
  379. store_root="$HOME/.local/share/pnpm/store"
  380. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  381. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  382. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  383. # Master refreshes the pnpm store cache that pull requests restore without saving.
  384. # The store cache stays a hand-rolled actions/cache step rather than
  385. # setup-node's `cache: pnpm`: the enterprise pull-request jobs above
  386. # restore exactly this key and path, and setup-node's built-in cache
  387. # uses its own key format — converting this producer would silently
  388. # starve their documented restore-only optimization.
  389. - uses: actions/cache@v4
  390. with:
  391. path: ${{ steps.pnpm-store.outputs.path }}
  392. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  393. restore-keys: |
  394. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  395. # Master produces the hosted Chromium cache restored by pull requests.
  396. - uses: actions/cache@v4
  397. with:
  398. path: ~/.cache/ms-playwright
  399. key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
  400. restore-keys: |
  401. ${{ runner.os }}-playwright-
  402. - name: Install (immutable)
  403. run: pnpm install --frozen-lockfile
  404. - name: Install Playwright Chromium and system dependencies
  405. run: pnpm --filter @deepseek-ai/dsh-frontend exec playwright install --with-deps chromium
  406. - name: Prepare bubblewrap (unrestrict userns)
  407. run: bash scripts/prepare-ci-bubblewrap.sh
  408. - name: Run complete unsharded primary Node CI serially
  409. env:
  410. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  411. DSH_COVERAGE_MAX_WORKERS: '1'
  412. DSH_E2E_MAX_WORKERS: '1'
  413. DSH_GATE_CONCURRENCY: '1'
  414. DSH_OXLINT_THREADS: '1'
  415. DSH_PUBLINT_CONCURRENCY: '1'
  416. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  417. run: pnpm run check:ci:linux-primary
  418. # Hot-standby drill for the in-house self-hosted pool: every master move
  419. # re-runs the complete unsharded aggregate on the persistent 64-core VM,
  420. # continuously proving that environment can take over a required lane if
  421. # the hosted pools degrade (the switch is then setting the writer-manageable
  422. # DSH_CI_FAILOVER variable — see the failover runbook, no merge required).
  423. # Push-triggered, so this lane always executes the base branch's own
  424. # workflow definition. (Under failover, pull_request jobs do reach these
  425. # runners with the PR merge ref's workflow — the boundary there is
  426. # repository membership: private, forking disabled, Dependabot excluded.)
  427. # Non-blocking for
  428. # pull requests; no cache steps because the VM's persistent pnpm store and
  429. # tool caches make them redundant (and saving here would poison the hosted
  430. # cache namespace with self-hosted paths).
  431. serial-linux-selfhosted:
  432. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  433. name: serial / linux (self-hosted standby)
  434. runs-on: [self-hosted, linux, x64, vm-backup]
  435. steps:
  436. # Full history + DSH_ARCHIVE_BASE_REF below: same frozen-archive
  437. # comparison as serial-linux. Depth 2 would miss github.event.before
  438. # on multi-commit or force pushes; full fetch is cheap here because
  439. # checkout resolves against the VM's local mirror.
  440. - uses: actions/checkout@v6
  441. with:
  442. fetch-depth: 0
  443. - uses: pnpm/action-setup@v4
  444. with:
  445. dest: ${{ runner.temp }}/setup-pnpm
  446. - uses: actions/setup-node@v6
  447. with:
  448. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  449. - name: Configure persistent pnpm store
  450. run: echo "PNPM_CONFIG_STORE_DIR=$HOME/.local/share/pnpm/store" >> "$GITHUB_ENV"
  451. - name: Install (immutable)
  452. run: pnpm install --frozen-lockfile
  453. # The persistent VM image owns Playwright's Linux system packages; this
  454. # step also proves that browser provisioning remains usable for failover.
  455. - name: Install Playwright Chromium
  456. run: pnpm --filter @deepseek-ai/dsh-frontend exec playwright install chromium
  457. - name: Prepare bubblewrap (unrestrict userns)
  458. run: bash scripts/prepare-ci-bubblewrap.sh
  459. - name: Run complete unsharded primary Node CI serially
  460. env:
  461. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  462. DSH_COVERAGE_MAX_WORKERS: '1'
  463. DSH_E2E_MAX_WORKERS: '1'
  464. DSH_GATE_CONCURRENCY: '1'
  465. DSH_OXLINT_THREADS: '1'
  466. DSH_PUBLINT_CONCURRENCY: '1'
  467. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  468. run: pnpm run check:ci:linux-primary
  469. serial-macos:
  470. if: false
  471. name: serial / macos
  472. runs-on: macos-latest
  473. steps:
  474. - uses: actions/checkout@v6
  475. - uses: pnpm/action-setup@v4
  476. with:
  477. dest: ${{ runner.temp }}/setup-pnpm
  478. - uses: actions/setup-node@v6
  479. with:
  480. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  481. - name: Install (immutable)
  482. run: pnpm install --frozen-lockfile
  483. - name: Run complete unsharded primary Node CI serially
  484. env:
  485. DSH_COVERAGE_MAX_WORKERS: '1'
  486. DSH_E2E_MAX_WORKERS: '1'
  487. DSH_GATE_CONCURRENCY: '1'
  488. DSH_PUBLINT_CONCURRENCY: '1'
  489. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  490. run: pnpm run check:ci
  491. serial-windows:
  492. if: false
  493. name: serial / windows
  494. runs-on: windows-2025
  495. steps:
  496. - uses: actions/checkout@v6
  497. - name: Enable Developer Mode (symlink support)
  498. shell: pwsh
  499. run: >-
  500. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  501. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  502. - uses: pnpm/action-setup@v4
  503. with:
  504. dest: ${{ runner.temp }}/setup-pnpm
  505. - uses: actions/setup-node@v6
  506. with:
  507. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  508. - name: Install (immutable)
  509. shell: pwsh
  510. run: pnpm install --frozen-lockfile
  511. - name: Run complete unsharded primary Node CI serially
  512. shell: pwsh
  513. env:
  514. DSH_COVERAGE_MAX_WORKERS: '1'
  515. DSH_E2E_MAX_WORKERS: '1'
  516. DSH_GATE_CONCURRENCY: '1'
  517. DSH_OXLINT_THREADS: '1'
  518. DSH_PUBLINT_CONCURRENCY: '1'
  519. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  520. run: pnpm run check:ci
  521. # Manual, bounded comparison of the actual critical Linux and Windows lanes.
  522. # The named pools are restricted at the organization level to this repository.
  523. larger-runner-benchmark:
  524. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'larger-runner-benchmark'
  525. runs-on: ${{ matrix.runner }}
  526. timeout-minutes: 15
  527. strategy:
  528. fail-fast: false
  529. max-parallel: 12
  530. matrix:
  531. include:
  532. - platform: linux
  533. cores: '4'
  534. runner: dsh-ubuntu-24-04-4core
  535. workload: typecheck
  536. - platform: linux
  537. cores: '8'
  538. runner: dsh-ubuntu-24-04-8core
  539. workload: typecheck
  540. - platform: linux
  541. cores: '16'
  542. runner: dsh-ubuntu-24-04-16core
  543. workload: typecheck
  544. - platform: linux
  545. cores: '32'
  546. runner: dsh-ubuntu-24-04-32core
  547. workload: typecheck
  548. - platform: linux
  549. cores: '64'
  550. runner: dsh-ubuntu-24-04-64core
  551. workload: typecheck
  552. - platform: linux
  553. cores: '96'
  554. runner: dsh-ubuntu-24-04-96core
  555. workload: typecheck
  556. - platform: windows
  557. cores: '4'
  558. runner: dsh-windows-2025-4core
  559. workload: production-site
  560. - platform: windows
  561. cores: '8'
  562. runner: dsh-windows-2025-8core
  563. workload: production-site
  564. - platform: windows
  565. cores: '16'
  566. runner: dsh-windows-2025-16core
  567. workload: production-site
  568. - platform: windows
  569. cores: '32'
  570. runner: dsh-windows-2025-32core
  571. workload: production-site
  572. - platform: windows
  573. cores: '64'
  574. runner: dsh-windows-2025-64core
  575. workload: production-site
  576. - platform: windows
  577. cores: '96'
  578. runner: dsh-windows-2025-96core
  579. workload: production-site
  580. steps:
  581. - uses: actions/checkout@v6
  582. - uses: pnpm/action-setup@v4
  583. with:
  584. dest: ${{ runner.temp }}/setup-pnpm
  585. # The Windows lanes deliberately skip the store cache like the required
  586. # windows job; an empty cache input disables setup-node's caching.
  587. - uses: actions/setup-node@v6
  588. with:
  589. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  590. cache: ${{ matrix.platform == 'linux' && 'pnpm' || '' }}
  591. - name: Report runner capacity
  592. run: >-
  593. node -e "const os = require('node:os');
  594. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  595. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  596. - name: Install (immutable)
  597. run: pnpm install --frozen-lockfile
  598. - name: Run critical Linux typecheck lane
  599. if: matrix.platform == 'linux'
  600. run: pnpm run typecheck
  601. - name: Run critical Windows production-site lane
  602. if: matrix.platform == 'windows'
  603. run: pnpm run docs:build
  604. # Manual comparison of the intended low-fanout topology. Linux runs the
  605. # complete unsharded primary aggregate with bounded in-runner parallelism;
  606. # Windows runs both blocking build surfaces concurrently through run-gates.
  607. consolidated-runner-benchmark:
  608. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  609. runs-on: ${{ matrix.runner }}
  610. timeout-minutes: 15
  611. strategy:
  612. fail-fast: false
  613. max-parallel: 12
  614. matrix:
  615. include:
  616. - platform: linux
  617. cores: '4'
  618. runner: dsh-ubuntu-24-04-4core
  619. workers: '4'
  620. - platform: linux
  621. cores: '8'
  622. runner: dsh-ubuntu-24-04-8core
  623. workers: '8'
  624. - platform: linux
  625. cores: '16'
  626. runner: dsh-ubuntu-24-04-16core
  627. workers: '16'
  628. - platform: linux
  629. cores: '32'
  630. runner: dsh-ubuntu-24-04-32core
  631. workers: '32'
  632. - platform: linux
  633. cores: '64'
  634. runner: dsh-ubuntu-24-04-64core
  635. workers: '32'
  636. - platform: linux
  637. cores: '96'
  638. runner: dsh-ubuntu-24-04-96core
  639. workers: '32'
  640. - platform: windows
  641. cores: '4'
  642. runner: dsh-windows-2025-4core
  643. workers: '2'
  644. - platform: windows
  645. cores: '8'
  646. runner: dsh-windows-2025-8core
  647. workers: '2'
  648. - platform: windows
  649. cores: '16'
  650. runner: dsh-windows-2025-16core
  651. workers: '2'
  652. - platform: windows
  653. cores: '32'
  654. runner: dsh-windows-2025-32core
  655. workers: '2'
  656. - platform: windows
  657. cores: '64'
  658. runner: dsh-windows-2025-64core
  659. workers: '2'
  660. - platform: windows
  661. cores: '96'
  662. runner: dsh-windows-2025-96core
  663. workers: '2'
  664. steps:
  665. - uses: actions/checkout@v6
  666. - uses: pnpm/action-setup@v4
  667. with:
  668. dest: ${{ runner.temp }}/setup-pnpm
  669. # Unlike the larger-runner suite, both platforms cache the store here:
  670. # the consolidated topology measures cache mechanics as workload.
  671. - uses: actions/setup-node@v6
  672. with:
  673. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  674. cache: pnpm
  675. - name: Report runner capacity
  676. run: >-
  677. node -e "const os = require('node:os');
  678. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  679. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  680. - name: Install and prepare Linux
  681. if: matrix.platform == 'linux'
  682. run: |
  683. pnpm install --frozen-lockfile &
  684. install_pid=$!
  685. bash scripts/prepare-ci-bubblewrap.sh &
  686. sandbox_pid=$!
  687. install_status=0
  688. wait "$install_pid" || install_status=$?
  689. sandbox_status=0
  690. wait "$sandbox_pid" || sandbox_status=$?
  691. if (( install_status != 0 )); then exit "$install_status"; fi
  692. exit "$sandbox_status"
  693. - name: Install (immutable)
  694. if: matrix.platform == 'windows'
  695. shell: pwsh
  696. run: pnpm install --frozen-lockfile
  697. - name: Run complete unsharded primary Node CI concurrently
  698. if: matrix.platform == 'linux'
  699. env:
  700. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  701. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  702. DSH_OXLINT_THREADS: ${{ matrix.workers }}
  703. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  704. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  705. run: pnpm run check:ci
  706. - name: Run blocking Windows builds concurrently
  707. if: matrix.platform == 'windows'
  708. shell: pwsh
  709. env:
  710. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  711. run: pnpm run check:ci:windows-blocking
  712. # Single stable required check for branch protection: require "all checks
  713. # passed" instead of enumerating matrix legs whose names change as lanes and
  714. # node versions evolve. Every blocking job in THIS workflow must be listed in
  715. # `needs`; observational Windows gates share the required Windows job but are
  716. # marked non-blocking inside run-gates. (`needs` cannot reach across workflow
  717. # files; e2e.yml stays its own check.)
  718. # `if: always()` is load-bearing: without it a failed dependency
  719. # would SKIP this job, and GitHub counts a skipped required check as passing
  720. # — so this job always runs and fails on any non-success result, including
  721. # 'cancelled' and 'skipped'.
  722. all-checks-passed:
  723. name: all checks passed
  724. # This bookkeeping-only verdict must not depend on custom-pool
  725. # provisioning (master's #734 moved it to ubuntu-latest) — and under
  726. # failover it follows the same selector as the worker jobs it
  727. # aggregates, so a standard-hosted outage cannot strand the
  728. # branch-protection verdict either (observed 2026-07-27).
  729. runs-on: >-
  730. ${{ vars.DSH_CI_FAILOVER == 'selfhosted'
  731. && github.event.pull_request.user.login != 'dependabot[bot]'
  732. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  733. || 'ubuntu-latest' }}
  734. needs: [node-24, node-24-coverage, node-24-consumers, node-compat, python-sdk, windows]
  735. if: always() && github.event_name == 'pull_request'
  736. steps:
  737. - name: Fail if any needed job did not succeed
  738. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  739. run: |
  740. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  741. exit 1
  742. - name: All checks passed
  743. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"