ci-master.yml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  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; LOCALAPPDATA (C:) would cross volumes and
  219. # break block clone. See 2026-08-30-windows-refs-store-block-clone-install.
  220. run: |
  221. $storeRoot = "F:\.pnpm-store"
  222. echo "PNPM_CONFIG_STORE_DIR=$storeRoot" >> $env:GITHUB_ENV
  223. - name: Install (immutable)
  224. shell: pwsh
  225. # See 2026-08-30-windows-refs-store-block-clone-install for the
  226. # ReFS block-clone rationale; use clone only on ReFS.
  227. run: >-
  228. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  229. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  230. if ($fs -eq 'ReFS') {
  231. corepack pnpm install --frozen-lockfile --package-import-method=clone
  232. } else {
  233. pnpm install --frozen-lockfile
  234. }
  235. - name: Run complete unsharded Windows gate inventory serially
  236. shell: pwsh
  237. env:
  238. DSH_COVERAGE_MAX_WORKERS: '1'
  239. DSH_COVERAGE_TEST_TIMEOUT_MS: '90000'
  240. DSH_GATE_CONCURRENCY: '1'
  241. DSH_PUBLINT_CONCURRENCY: '1'
  242. run: pnpm run check:ci:windows-complete
  243. # Manual, bounded comparison of the actual critical Linux and Windows lanes.
  244. # The named pools are restricted at the organization level to this repository.
  245. larger-runner-benchmark:
  246. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'larger-runner-benchmark'
  247. # Default measures the repository's own fleet tiers; under the matching
  248. # platform's blacksmith failover value the tiers Blacksmith offers (up to
  249. # 32 vCPU) move onto their Blacksmith equivalents, while the 64/96-core
  250. # rows keep the fleet labels because Blacksmith has no such tier.
  251. runs-on: >-
  252. ${{ (matrix.platform == 'linux' && vars.DSH_CI_FAILOVER_LINUX == 'blacksmith'
  253. || matrix.platform == 'windows' && vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith')
  254. && matrix.blacksmith
  255. || matrix.runner }}
  256. timeout-minutes: 15
  257. strategy:
  258. fail-fast: false
  259. max-parallel: 12
  260. matrix:
  261. include:
  262. - platform: linux
  263. cores: '4'
  264. runner: dsh-ubuntu-24-04-4core
  265. blacksmith: blacksmith-4vcpu-ubuntu-2404
  266. workload: typecheck
  267. - platform: linux
  268. cores: '8'
  269. runner: dsh-ubuntu-24-04-8core
  270. blacksmith: blacksmith-8vcpu-ubuntu-2404
  271. workload: typecheck
  272. - platform: linux
  273. cores: '16'
  274. runner: dsh-ubuntu-24-04-16core
  275. blacksmith: blacksmith-16vcpu-ubuntu-2404
  276. workload: typecheck
  277. - platform: linux
  278. cores: '32'
  279. runner: dsh-ubuntu-24-04-32core
  280. blacksmith: blacksmith-32vcpu-ubuntu-2404
  281. workload: typecheck
  282. - platform: linux
  283. cores: '64'
  284. runner: dsh-ubuntu-24-04-64core
  285. blacksmith: ''
  286. workload: typecheck
  287. - platform: linux
  288. cores: '96'
  289. runner: dsh-ubuntu-24-04-96core
  290. blacksmith: ''
  291. workload: typecheck
  292. - platform: windows
  293. cores: '4'
  294. runner: dsh-windows-2025-4core
  295. blacksmith: blacksmith-4vcpu-windows-2025
  296. workload: production-site
  297. - platform: windows
  298. cores: '8'
  299. runner: dsh-windows-2025-8core
  300. blacksmith: blacksmith-8vcpu-windows-2025
  301. workload: production-site
  302. - platform: windows
  303. cores: '16'
  304. runner: dsh-windows-2025-16core
  305. blacksmith: blacksmith-16vcpu-windows-2025
  306. workload: production-site
  307. - platform: windows
  308. cores: '32'
  309. runner: dsh-windows-2025-32core
  310. blacksmith: blacksmith-32vcpu-windows-2025
  311. workload: production-site
  312. - platform: windows
  313. cores: '64'
  314. runner: dsh-windows-2025-64core
  315. blacksmith: ''
  316. workload: production-site
  317. - platform: windows
  318. cores: '96'
  319. runner: dsh-windows-2025-96core
  320. blacksmith: ''
  321. workload: production-site
  322. steps:
  323. - uses: actions/checkout@v6
  324. - uses: pnpm/action-setup@v4
  325. with:
  326. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  327. # The benchmark's Windows lanes deliberately skip the store cache like
  328. # the independent native Windows job; an empty input disables caching.
  329. - uses: actions/setup-node@v6
  330. with:
  331. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  332. cache: ${{ matrix.platform == 'linux' && 'pnpm' || '' }}
  333. - name: Report runner capacity
  334. run: >-
  335. node -e "const os = require('node:os');
  336. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  337. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  338. - name: Install (immutable)
  339. run: pnpm install --frozen-lockfile
  340. - name: Run critical Linux typecheck lane
  341. if: matrix.platform == 'linux'
  342. run: pnpm run typecheck
  343. - name: Run critical Windows production-site lane
  344. if: matrix.platform == 'windows'
  345. run: pnpm run docs:build
  346. # Manual comparison of the intended low-fanout topology. Linux runs the
  347. # complete unsharded primary aggregate with bounded in-runner parallelism;
  348. # Windows runs both blocking build targets concurrently through run-gates.
  349. consolidated-runner-benchmark:
  350. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  351. # Default measures the repository's own fleet tiers; under the matching
  352. # platform's blacksmith failover value the tiers Blacksmith offers (up to
  353. # 32 vCPU) move onto their Blacksmith equivalents, while the 64/96-core
  354. # rows keep the fleet labels because Blacksmith has no such tier.
  355. runs-on: >-
  356. ${{ (matrix.platform == 'linux' && vars.DSH_CI_FAILOVER_LINUX == 'blacksmith'
  357. || matrix.platform == 'windows' && vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith')
  358. && matrix.blacksmith
  359. || matrix.runner }}
  360. timeout-minutes: 15
  361. strategy:
  362. fail-fast: false
  363. max-parallel: 12
  364. matrix:
  365. include:
  366. - platform: linux
  367. cores: '4'
  368. runner: dsh-ubuntu-24-04-4core
  369. blacksmith: blacksmith-4vcpu-ubuntu-2404
  370. workers: '4'
  371. - platform: linux
  372. cores: '8'
  373. runner: dsh-ubuntu-24-04-8core
  374. blacksmith: blacksmith-8vcpu-ubuntu-2404
  375. workers: '8'
  376. - platform: linux
  377. cores: '16'
  378. runner: dsh-ubuntu-24-04-16core
  379. blacksmith: blacksmith-16vcpu-ubuntu-2404
  380. workers: '16'
  381. - platform: linux
  382. cores: '32'
  383. runner: dsh-ubuntu-24-04-32core
  384. blacksmith: blacksmith-32vcpu-ubuntu-2404
  385. workers: '32'
  386. - platform: linux
  387. cores: '64'
  388. runner: dsh-ubuntu-24-04-64core
  389. blacksmith: ''
  390. workers: '32'
  391. - platform: linux
  392. cores: '96'
  393. runner: dsh-ubuntu-24-04-96core
  394. blacksmith: ''
  395. workers: '32'
  396. - platform: windows
  397. cores: '4'
  398. runner: dsh-windows-2025-4core
  399. blacksmith: blacksmith-4vcpu-windows-2025
  400. workers: '2'
  401. - platform: windows
  402. cores: '8'
  403. runner: dsh-windows-2025-8core
  404. blacksmith: blacksmith-8vcpu-windows-2025
  405. workers: '2'
  406. - platform: windows
  407. cores: '16'
  408. runner: dsh-windows-2025-16core
  409. blacksmith: blacksmith-16vcpu-windows-2025
  410. workers: '2'
  411. - platform: windows
  412. cores: '32'
  413. runner: dsh-windows-2025-32core
  414. blacksmith: blacksmith-32vcpu-windows-2025
  415. workers: '2'
  416. - platform: windows
  417. cores: '64'
  418. runner: dsh-windows-2025-64core
  419. blacksmith: ''
  420. workers: '2'
  421. - platform: windows
  422. cores: '96'
  423. runner: dsh-windows-2025-96core
  424. blacksmith: ''
  425. workers: '2'
  426. steps:
  427. - uses: actions/checkout@v6
  428. - uses: pnpm/action-setup@v4
  429. with:
  430. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  431. # Unlike the larger-runner suite, both platforms cache the store here:
  432. # the consolidated topology measures cache mechanics as workload.
  433. - uses: actions/setup-node@v6
  434. with:
  435. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  436. cache: pnpm
  437. - name: Report runner capacity
  438. run: >-
  439. node -e "const os = require('node:os');
  440. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  441. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  442. - name: Install and prepare Linux
  443. if: matrix.platform == 'linux'
  444. run: |
  445. pnpm install --frozen-lockfile &
  446. install_pid=$!
  447. bash scripts/prepare-ci-bubblewrap.sh &
  448. sandbox_pid=$!
  449. install_status=0
  450. wait "$install_pid" || install_status=$?
  451. sandbox_status=0
  452. wait "$sandbox_pid" || sandbox_status=$?
  453. if (( install_status != 0 )); then exit "$install_status"; fi
  454. exit "$sandbox_status"
  455. - name: Install (immutable)
  456. if: matrix.platform == 'windows'
  457. shell: pwsh
  458. run: pnpm install --frozen-lockfile
  459. - name: Run complete unsharded primary Node CI concurrently
  460. if: matrix.platform == 'linux'
  461. env:
  462. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  463. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  464. DSH_OXLINT_THREADS: ${{ matrix.workers }}
  465. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  466. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  467. run: pnpm run check:ci
  468. - name: Run blocking Windows builds concurrently
  469. if: matrix.platform == 'windows'
  470. shell: pwsh
  471. env:
  472. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  473. run: pnpm run check:ci:windows-blocking