ci.yml 34 KB

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