ci-master.yml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. name: CI master
  2. on:
  3. push:
  4. branches: [master]
  5. workflow_dispatch:
  6. inputs:
  7. suite:
  8. description: Manual CI suite to run
  9. required: true
  10. default: larger-runner-benchmark
  11. type: choice
  12. options:
  13. - larger-runner-benchmark
  14. - consolidated-runner-benchmark
  15. # New master pushes and manual runs replace obsolete checks in this workflow/ref.
  16. # Standby drills share cancellation; use completed runs as readiness evidence.
  17. concurrency:
  18. group: ${{ github.workflow }}-${{ github.ref }}
  19. cancel-in-progress: true
  20. permissions:
  21. contents: read
  22. env:
  23. PRIMARY_NODE_VERSION: '24'
  24. # CI runs must never report to the production telemetry endpoint baked
  25. # into apps/cli/cordis.yml (AppCLIEntry disables the row when set).
  26. DSH_TELEMETRY_DISABLED: '1'
  27. jobs:
  28. # These native runtime carriers are post-merge checks; release keeps all targets.
  29. python-runtime:
  30. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  31. name: python runtime / macOS and Linux ARM64
  32. uses: ./.github/workflows/build-exe-for-python-sdk.yml
  33. with:
  34. targets: node24-linux-arm64,node24-macos-arm64,node24-macos-x64
  35. ci: true
  36. secrets:
  37. DEEPSEEK_API_KEY_EXTERNAL: ${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }}
  38. # Wine runs once here, independently of the native serial standby aggregates.
  39. windows:
  40. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  41. runs-on: ubuntu-latest
  42. name: windows node 24 / wine
  43. timeout-minutes: 15
  44. steps:
  45. - uses: actions/checkout@v6
  46. with:
  47. persist-credentials: false
  48. - uses: pnpm/action-setup@v4
  49. with:
  50. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  51. - uses: actions/setup-node@v6
  52. with:
  53. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  54. - name: Configure pnpm store path
  55. id: pnpm-store
  56. run: |
  57. store_root="$HOME/.local/share/pnpm/store"
  58. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  59. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  60. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  61. - uses: actions/cache/restore@v4
  62. with:
  63. path: ${{ steps.pnpm-store.outputs.path }}
  64. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  65. restore-keys: |
  66. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  67. # Master CI restores and seeds the image-specific Wine dependency cache.
  68. - name: Compose Wine apt cache key
  69. id: wine-cache-key
  70. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  71. - uses: actions/cache@v4
  72. with:
  73. path: ~/wine-debs
  74. key: ${{ steps.wine-cache-key.outputs.key }}
  75. # Runner provisioning only — a developer machine installs Wine through
  76. # its own package manager; the gate script assumes a wine binary and
  77. # fails loud without one. Wine from the apt cache when present; else
  78. # download the full dependency closure once and keep it for the next
  79. # run. The `wine` dispatcher package (not bare `wine64`) is what puts a
  80. # binary on PATH.
  81. - name: Install Wine
  82. run: |
  83. if compgen -G "$HOME/wine-debs/*.deb" > /dev/null; then
  84. # The restored archive is the full --download-only closure of
  85. # `wine` for this runner image, so installing the .debs directly
  86. # with dpkg needs no repository access. apt-get would instead
  87. # re-download the same 100+ MB closure from the mirror, which has
  88. # stalled the job past its budget on a degraded runner network.
  89. # If the archive cannot satisfy the closure, fall back to the apt
  90. # network install.
  91. if ! sudo DEBIAN_FRONTEND=noninteractive dpkg -i "$HOME"/wine-debs/*.deb; then
  92. sudo DEBIAN_FRONTEND=noninteractive dpkg --configure -a || true
  93. sudo apt-get install -y --no-install-recommends "$HOME"/wine-debs/*.deb
  94. fi
  95. else
  96. sudo apt-get update
  97. sudo apt-get install -y --no-install-recommends --download-only wine
  98. mkdir -p "$HOME/wine-debs"
  99. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/" 2>/dev/null || true
  100. sudo apt-get install -y --no-install-recommends wine
  101. fi
  102. - name: Run the Wine Windows gates
  103. run: bash scripts/wine-windows-gates.sh
  104. - name: Shut down wineserver
  105. if: always()
  106. run: wineserver -k 2>/dev/null || true
  107. # Hot-standby drill for the in-house self-hosted pool: every master move
  108. # re-runs the complete unsharded aggregate on the persistent 64-core VM,
  109. # continuously proving that environment can take over a required lane if
  110. # the hosted pools degrade (the switch is then setting the writer-manageable
  111. # DSH_CI_FAILOVER_LINUX variable — see the failover runbook, no merge required).
  112. # Push-triggered, so this lane always executes the base branch's own
  113. # workflow definition. This workflow never listens to pull_request, so the
  114. # drill does not appear in PR checks. No cache steps because the VM's
  115. # persistent pnpm store and tool caches make them redundant (and saving here
  116. # would poison the hosted cache namespace with self-hosted paths).
  117. serial-linux-selfhosted:
  118. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  119. name: serial / linux (self-hosted standby)
  120. runs-on: [self-hosted, linux, x64, vm-backup]
  121. steps:
  122. # DSH_ARCHIVE_BASE_REF below compares the frozen-archive gate against
  123. # github.event.before, so full history is required: depth 2 would miss it
  124. # on multi-commit or force pushes; full fetch is cheap here because
  125. # checkout resolves against the VM's local mirror.
  126. - uses: actions/checkout@v6
  127. with:
  128. fetch-depth: 0
  129. # Redirect the Node compile cache (enabled by pnpm and TypeScript) off
  130. # the root partition's /tmp before the first pnpm call in this lane —
  131. # see .agents/notes/implemented/process/2026-08-28-ci-node-compile-cache-data-disk.md.
  132. - name: Redirect Node compile cache to runner temp
  133. run: echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"
  134. - uses: pnpm/action-setup@v4
  135. with:
  136. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  137. - uses: actions/setup-node@v6
  138. with:
  139. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  140. - name: Configure persistent pnpm store
  141. run: echo "PNPM_CONFIG_STORE_DIR=$HOME/.local/share/pnpm/store" >> "$GITHUB_ENV"
  142. - name: Install (immutable)
  143. run: pnpm install --frozen-lockfile
  144. # The persistent VM image owns Playwright's Linux system packages; this
  145. # step also proves that browser provisioning remains usable for failover.
  146. - name: Install Playwright Chromium
  147. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install chromium
  148. - name: Prepare bubblewrap (unrestrict userns)
  149. run: bash scripts/prepare-ci-bubblewrap.sh
  150. - name: Run complete unsharded primary Node CI serially
  151. env:
  152. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  153. DSH_COVERAGE_MAX_WORKERS: '1'
  154. DSH_E2E_MAX_WORKERS: '1'
  155. DSH_GATE_CONCURRENCY: '1'
  156. DSH_OXLINT_THREADS: '1'
  157. DSH_PUBLINT_CONCURRENCY: '1'
  158. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  159. run: pnpm run check:ci:linux-primary
  160. # TODO(hosted-serial-ci): Re-enable the one remaining disabled hosted serial
  161. # reference job (serial-macos) before release. Re-enabling serial-macos does
  162. # not restore a Linux hosted-cache producer: decide whether to add a master
  163. # seeder or remove the restore-only steps if cold starts become a concern.
  164. serial-macos:
  165. if: false
  166. name: serial / macos
  167. runs-on: macos-latest
  168. steps:
  169. - uses: actions/checkout@v6
  170. - uses: pnpm/action-setup@v4
  171. with:
  172. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  173. - uses: actions/setup-node@v6
  174. with:
  175. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  176. - name: Install (immutable)
  177. run: pnpm install --frozen-lockfile
  178. - name: Run complete unsharded primary Node CI serially
  179. env:
  180. DSH_COVERAGE_MAX_WORKERS: '1'
  181. DSH_E2E_MAX_WORKERS: '1'
  182. DSH_GATE_CONCURRENCY: '1'
  183. DSH_PUBLINT_CONCURRENCY: '1'
  184. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  185. run: pnpm run check:ci
  186. # Hot-standby drill for the in-house self-hosted Windows pool: every master
  187. # move re-runs the complete unsharded Windows gate inventory on the persistent
  188. # VM, continuously proving that environment can take over the required
  189. # `windows` lane if the hosted pool degrades (the switch is setting the
  190. # writer-manageable DSH_CI_FAILOVER_WINDOWS variable — see the failover
  191. # runbook, no merge required). Push-triggered, so this lane always executes
  192. # the base branch's own workflow definition. This workflow never listens to
  193. # pull_request, so the drill does not appear in PR checks. No cache steps
  194. # because the VM's persistent pnpm store and tool caches make them redundant
  195. # (and saving here would poison the hosted cache namespace with self-hosted
  196. # paths).
  197. serial-windows:
  198. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  199. name: serial / windows (self-hosted standby)
  200. runs-on: [self-hosted, dsh-win-ci, windows]
  201. timeout-minutes: 120
  202. steps:
  203. - uses: actions/checkout@v6
  204. - name: Enable Developer Mode (symlink support)
  205. shell: pwsh
  206. run: >-
  207. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  208. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  209. - uses: pnpm/action-setup@v4
  210. with:
  211. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  212. - uses: actions/setup-node@v6
  213. with:
  214. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  215. - name: Configure persistent pnpm store
  216. shell: pwsh
  217. # The store must share the ReFS workspace volume for the clone
  218. # import method below. Runner workspaces can reside on different drives.
  219. run: |
  220. $storeRoot = Join-Path ([IO.Path]::GetPathRoot($env:GITHUB_WORKSPACE)) '.pnpm-store'
  221. echo "PNPM_CONFIG_STORE_DIR=$storeRoot" >> $env:GITHUB_ENV
  222. - name: Install (immutable)
  223. shell: pwsh
  224. # See 2026-08-30-windows-refs-store-block-clone-install for the
  225. # ReFS block-clone rationale; use clone only on ReFS.
  226. run: >-
  227. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  228. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  229. if ($fs -eq 'ReFS') {
  230. corepack pnpm install --frozen-lockfile --package-import-method=clone
  231. } else {
  232. pnpm install --frozen-lockfile
  233. }
  234. - name: Run complete unsharded Windows gate inventory serially
  235. shell: pwsh
  236. env:
  237. DSH_COVERAGE_MAX_WORKERS: '1'
  238. DSH_COVERAGE_TEST_TIMEOUT_MS: '90000'
  239. DSH_GATE_CONCURRENCY: '1'
  240. DSH_PUBLINT_CONCURRENCY: '1'
  241. run: pnpm run check:ci:windows-complete
  242. # Manual, bounded comparison of the actual critical Linux and Windows lanes.
  243. # The named pools are restricted at the organization level to this repository.
  244. larger-runner-benchmark:
  245. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'larger-runner-benchmark'
  246. # Default measures the repository's own fleet tiers; under the matching
  247. # platform's blacksmith failover value the tiers Blacksmith offers (up to
  248. # 32 vCPU) move onto their Blacksmith equivalents, while the 64/96-core
  249. # rows keep the fleet labels because Blacksmith has no such tier.
  250. runs-on: >-
  251. ${{ (matrix.platform == 'linux' && vars.DSH_CI_FAILOVER_LINUX == 'blacksmith'
  252. || matrix.platform == 'windows' && vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith')
  253. && matrix.blacksmith
  254. || matrix.runner }}
  255. timeout-minutes: 15
  256. strategy:
  257. fail-fast: false
  258. max-parallel: 12
  259. matrix:
  260. include:
  261. - platform: linux
  262. cores: '4'
  263. runner: dsh-ubuntu-24-04-4core
  264. blacksmith: blacksmith-4vcpu-ubuntu-2404
  265. workload: typecheck
  266. - platform: linux
  267. cores: '8'
  268. runner: dsh-ubuntu-24-04-8core
  269. blacksmith: blacksmith-8vcpu-ubuntu-2404
  270. workload: typecheck
  271. - platform: linux
  272. cores: '16'
  273. runner: dsh-ubuntu-24-04-16core
  274. blacksmith: blacksmith-16vcpu-ubuntu-2404
  275. workload: typecheck
  276. - platform: linux
  277. cores: '32'
  278. runner: dsh-ubuntu-24-04-32core
  279. blacksmith: blacksmith-32vcpu-ubuntu-2404
  280. workload: typecheck
  281. - platform: linux
  282. cores: '64'
  283. runner: dsh-ubuntu-24-04-64core
  284. blacksmith: ''
  285. workload: typecheck
  286. - platform: linux
  287. cores: '96'
  288. runner: dsh-ubuntu-24-04-96core
  289. blacksmith: ''
  290. workload: typecheck
  291. - platform: windows
  292. cores: '4'
  293. runner: dsh-windows-2025-4core
  294. blacksmith: blacksmith-4vcpu-windows-2025
  295. workload: production-site
  296. - platform: windows
  297. cores: '8'
  298. runner: dsh-windows-2025-8core
  299. blacksmith: blacksmith-8vcpu-windows-2025
  300. workload: production-site
  301. - platform: windows
  302. cores: '16'
  303. runner: dsh-windows-2025-16core
  304. blacksmith: blacksmith-16vcpu-windows-2025
  305. workload: production-site
  306. - platform: windows
  307. cores: '32'
  308. runner: dsh-windows-2025-32core
  309. blacksmith: blacksmith-32vcpu-windows-2025
  310. workload: production-site
  311. - platform: windows
  312. cores: '64'
  313. runner: dsh-windows-2025-64core
  314. blacksmith: ''
  315. workload: production-site
  316. - platform: windows
  317. cores: '96'
  318. runner: dsh-windows-2025-96core
  319. blacksmith: ''
  320. workload: production-site
  321. steps:
  322. - uses: actions/checkout@v6
  323. - uses: pnpm/action-setup@v4
  324. with:
  325. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  326. # The benchmark's Windows lanes deliberately skip the store cache like
  327. # the independent native Windows job; an empty input disables caching.
  328. - uses: actions/setup-node@v6
  329. with:
  330. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  331. cache: ${{ matrix.platform == 'linux' && 'pnpm' || '' }}
  332. - name: Report runner capacity
  333. run: >-
  334. node -e "const os = require('node:os');
  335. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  336. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  337. - name: Install (immutable)
  338. run: pnpm install --frozen-lockfile
  339. - name: Run critical Linux typecheck lane
  340. if: matrix.platform == 'linux'
  341. run: pnpm run typecheck
  342. - name: Run critical Windows production-site lane
  343. if: matrix.platform == 'windows'
  344. run: pnpm run docs:build
  345. # Manual comparison of the intended low-fanout topology. Linux runs the
  346. # complete unsharded primary aggregate with bounded in-runner parallelism;
  347. # Windows runs both blocking build targets concurrently through run-gates.
  348. consolidated-runner-benchmark:
  349. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  350. # Default measures the repository's own fleet tiers; under the matching
  351. # platform's blacksmith failover value the tiers Blacksmith offers (up to
  352. # 32 vCPU) move onto their Blacksmith equivalents, while the 64/96-core
  353. # rows keep the fleet labels because Blacksmith has no such tier.
  354. runs-on: >-
  355. ${{ (matrix.platform == 'linux' && vars.DSH_CI_FAILOVER_LINUX == 'blacksmith'
  356. || matrix.platform == 'windows' && vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith')
  357. && matrix.blacksmith
  358. || matrix.runner }}
  359. timeout-minutes: 15
  360. strategy:
  361. fail-fast: false
  362. max-parallel: 12
  363. matrix:
  364. include:
  365. - platform: linux
  366. cores: '4'
  367. runner: dsh-ubuntu-24-04-4core
  368. blacksmith: blacksmith-4vcpu-ubuntu-2404
  369. workers: '4'
  370. - platform: linux
  371. cores: '8'
  372. runner: dsh-ubuntu-24-04-8core
  373. blacksmith: blacksmith-8vcpu-ubuntu-2404
  374. workers: '8'
  375. - platform: linux
  376. cores: '16'
  377. runner: dsh-ubuntu-24-04-16core
  378. blacksmith: blacksmith-16vcpu-ubuntu-2404
  379. workers: '16'
  380. - platform: linux
  381. cores: '32'
  382. runner: dsh-ubuntu-24-04-32core
  383. blacksmith: blacksmith-32vcpu-ubuntu-2404
  384. workers: '32'
  385. - platform: linux
  386. cores: '64'
  387. runner: dsh-ubuntu-24-04-64core
  388. blacksmith: ''
  389. workers: '32'
  390. - platform: linux
  391. cores: '96'
  392. runner: dsh-ubuntu-24-04-96core
  393. blacksmith: ''
  394. workers: '32'
  395. - platform: windows
  396. cores: '4'
  397. runner: dsh-windows-2025-4core
  398. blacksmith: blacksmith-4vcpu-windows-2025
  399. workers: '2'
  400. - platform: windows
  401. cores: '8'
  402. runner: dsh-windows-2025-8core
  403. blacksmith: blacksmith-8vcpu-windows-2025
  404. workers: '2'
  405. - platform: windows
  406. cores: '16'
  407. runner: dsh-windows-2025-16core
  408. blacksmith: blacksmith-16vcpu-windows-2025
  409. workers: '2'
  410. - platform: windows
  411. cores: '32'
  412. runner: dsh-windows-2025-32core
  413. blacksmith: blacksmith-32vcpu-windows-2025
  414. workers: '2'
  415. - platform: windows
  416. cores: '64'
  417. runner: dsh-windows-2025-64core
  418. blacksmith: ''
  419. workers: '2'
  420. - platform: windows
  421. cores: '96'
  422. runner: dsh-windows-2025-96core
  423. blacksmith: ''
  424. workers: '2'
  425. steps:
  426. - uses: actions/checkout@v6
  427. - uses: pnpm/action-setup@v4
  428. with:
  429. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  430. # Unlike the larger-runner suite, both platforms cache the store here:
  431. # the consolidated topology measures cache mechanics as workload.
  432. - uses: actions/setup-node@v6
  433. with:
  434. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  435. cache: pnpm
  436. - name: Report runner capacity
  437. run: >-
  438. node -e "const os = require('node:os');
  439. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  440. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  441. - name: Install and prepare Linux
  442. if: matrix.platform == 'linux'
  443. run: |
  444. pnpm install --frozen-lockfile &
  445. install_pid=$!
  446. bash scripts/prepare-ci-bubblewrap.sh &
  447. sandbox_pid=$!
  448. install_status=0
  449. wait "$install_pid" || install_status=$?
  450. sandbox_status=0
  451. wait "$sandbox_pid" || sandbox_status=$?
  452. if (( install_status != 0 )); then exit "$install_status"; fi
  453. exit "$sandbox_status"
  454. - name: Install (immutable)
  455. if: matrix.platform == 'windows'
  456. shell: pwsh
  457. run: pnpm install --frozen-lockfile
  458. - name: Run complete unsharded primary Node CI concurrently
  459. if: matrix.platform == 'linux'
  460. env:
  461. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  462. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  463. DSH_OXLINT_THREADS: ${{ matrix.workers }}
  464. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  465. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  466. run: pnpm run check:ci
  467. - name: Run blocking Windows builds concurrently
  468. if: matrix.platform == 'windows'
  469. shell: pwsh
  470. env:
  471. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  472. run: pnpm run check:ci:windows-blocking