ci.yml 31 KB

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