ci-master.yml 18 KB

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