ci.yml 31 KB

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