ci.yml 34 KB

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