ci.yml 31 KB

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