ci.yml 37 KB

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