ci-master.yml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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. runs-on: ${{ matrix.runner }}
  248. timeout-minutes: 15
  249. strategy:
  250. fail-fast: false
  251. max-parallel: 12
  252. matrix:
  253. include:
  254. - platform: linux
  255. cores: '4'
  256. runner: dsh-ubuntu-24-04-4core
  257. workload: typecheck
  258. - platform: linux
  259. cores: '8'
  260. runner: dsh-ubuntu-24-04-8core
  261. workload: typecheck
  262. - platform: linux
  263. cores: '16'
  264. runner: dsh-ubuntu-24-04-16core
  265. workload: typecheck
  266. - platform: linux
  267. cores: '32'
  268. runner: dsh-ubuntu-24-04-32core
  269. workload: typecheck
  270. - platform: linux
  271. cores: '64'
  272. runner: dsh-ubuntu-24-04-64core
  273. workload: typecheck
  274. - platform: linux
  275. cores: '96'
  276. runner: dsh-ubuntu-24-04-96core
  277. workload: typecheck
  278. - platform: windows
  279. cores: '4'
  280. runner: dsh-windows-2025-4core
  281. workload: production-site
  282. - platform: windows
  283. cores: '8'
  284. runner: dsh-windows-2025-8core
  285. workload: production-site
  286. - platform: windows
  287. cores: '16'
  288. runner: dsh-windows-2025-16core
  289. workload: production-site
  290. - platform: windows
  291. cores: '32'
  292. runner: dsh-windows-2025-32core
  293. workload: production-site
  294. - platform: windows
  295. cores: '64'
  296. runner: dsh-windows-2025-64core
  297. workload: production-site
  298. - platform: windows
  299. cores: '96'
  300. runner: dsh-windows-2025-96core
  301. workload: production-site
  302. steps:
  303. - uses: actions/checkout@v6
  304. - uses: pnpm/action-setup@v4
  305. with:
  306. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  307. # The benchmark's Windows lanes deliberately skip the store cache like
  308. # the independent native Windows job; an empty input disables caching.
  309. - uses: actions/setup-node@v6
  310. with:
  311. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  312. cache: ${{ matrix.platform == 'linux' && 'pnpm' || '' }}
  313. - name: Report runner capacity
  314. run: >-
  315. node -e "const os = require('node:os');
  316. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  317. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  318. - name: Install (immutable)
  319. run: pnpm install --frozen-lockfile
  320. - name: Run critical Linux typecheck lane
  321. if: matrix.platform == 'linux'
  322. run: pnpm run typecheck
  323. - name: Run critical Windows production-site lane
  324. if: matrix.platform == 'windows'
  325. run: pnpm run docs:build
  326. # Manual comparison of the intended low-fanout topology. Linux runs the
  327. # complete unsharded primary aggregate with bounded in-runner parallelism;
  328. # Windows runs both blocking build targets concurrently through run-gates.
  329. consolidated-runner-benchmark:
  330. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  331. runs-on: ${{ matrix.runner }}
  332. timeout-minutes: 15
  333. strategy:
  334. fail-fast: false
  335. max-parallel: 12
  336. matrix:
  337. include:
  338. - platform: linux
  339. cores: '4'
  340. runner: dsh-ubuntu-24-04-4core
  341. workers: '4'
  342. - platform: linux
  343. cores: '8'
  344. runner: dsh-ubuntu-24-04-8core
  345. workers: '8'
  346. - platform: linux
  347. cores: '16'
  348. runner: dsh-ubuntu-24-04-16core
  349. workers: '16'
  350. - platform: linux
  351. cores: '32'
  352. runner: dsh-ubuntu-24-04-32core
  353. workers: '32'
  354. - platform: linux
  355. cores: '64'
  356. runner: dsh-ubuntu-24-04-64core
  357. workers: '32'
  358. - platform: linux
  359. cores: '96'
  360. runner: dsh-ubuntu-24-04-96core
  361. workers: '32'
  362. - platform: windows
  363. cores: '4'
  364. runner: dsh-windows-2025-4core
  365. workers: '2'
  366. - platform: windows
  367. cores: '8'
  368. runner: dsh-windows-2025-8core
  369. workers: '2'
  370. - platform: windows
  371. cores: '16'
  372. runner: dsh-windows-2025-16core
  373. workers: '2'
  374. - platform: windows
  375. cores: '32'
  376. runner: dsh-windows-2025-32core
  377. workers: '2'
  378. - platform: windows
  379. cores: '64'
  380. runner: dsh-windows-2025-64core
  381. workers: '2'
  382. - platform: windows
  383. cores: '96'
  384. runner: dsh-windows-2025-96core
  385. workers: '2'
  386. steps:
  387. - uses: actions/checkout@v6
  388. - uses: pnpm/action-setup@v4
  389. with:
  390. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  391. # Unlike the larger-runner suite, both platforms cache the store here:
  392. # the consolidated topology measures cache mechanics as workload.
  393. - uses: actions/setup-node@v6
  394. with:
  395. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  396. cache: pnpm
  397. - name: Report runner capacity
  398. run: >-
  399. node -e "const os = require('node:os');
  400. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  401. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  402. - name: Install and prepare Linux
  403. if: matrix.platform == 'linux'
  404. run: |
  405. pnpm install --frozen-lockfile &
  406. install_pid=$!
  407. bash scripts/prepare-ci-bubblewrap.sh &
  408. sandbox_pid=$!
  409. install_status=0
  410. wait "$install_pid" || install_status=$?
  411. sandbox_status=0
  412. wait "$sandbox_pid" || sandbox_status=$?
  413. if (( install_status != 0 )); then exit "$install_status"; fi
  414. exit "$sandbox_status"
  415. - name: Install (immutable)
  416. if: matrix.platform == 'windows'
  417. shell: pwsh
  418. run: pnpm install --frozen-lockfile
  419. - name: Run complete unsharded primary Node CI concurrently
  420. if: matrix.platform == 'linux'
  421. env:
  422. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  423. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  424. DSH_OXLINT_THREADS: ${{ matrix.workers }}
  425. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  426. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  427. run: pnpm run check:ci
  428. - name: Run blocking Windows builds concurrently
  429. if: matrix.platform == 'windows'
  430. shell: pwsh
  431. env:
  432. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  433. run: pnpm run check:ci:windows-blocking