ci.yml 32 KB

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