ci.yml 35 KB

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