ci.yml 31 KB

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