ci-master.yml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  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. - uses: pnpm/action-setup@v4
  133. with:
  134. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  135. - uses: actions/setup-node@v6
  136. with:
  137. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  138. - name: Configure persistent pnpm store
  139. run: echo "PNPM_CONFIG_STORE_DIR=$HOME/.local/share/pnpm/store" >> "$GITHUB_ENV"
  140. - name: Install (immutable)
  141. run: pnpm install --frozen-lockfile
  142. # The persistent VM image owns Playwright's Linux system packages; this
  143. # step also proves that browser provisioning remains usable for failover.
  144. - name: Install Playwright Chromium
  145. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install chromium
  146. - name: Prepare bubblewrap (unrestrict userns)
  147. run: bash scripts/prepare-ci-bubblewrap.sh
  148. - name: Run complete unsharded primary Node CI serially
  149. env:
  150. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  151. DSH_COVERAGE_MAX_WORKERS: '1'
  152. DSH_E2E_MAX_WORKERS: '1'
  153. DSH_GATE_CONCURRENCY: '1'
  154. DSH_OXLINT_THREADS: '1'
  155. DSH_PUBLINT_CONCURRENCY: '1'
  156. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  157. run: pnpm run check:ci:linux-primary
  158. # TODO(hosted-serial-ci): Re-enable the one remaining disabled hosted serial
  159. # reference job (serial-macos) before release. Re-enabling serial-macos does
  160. # not restore a Linux hosted-cache producer: decide whether to add a master
  161. # seeder or remove the restore-only steps if cold starts become a concern.
  162. serial-macos:
  163. if: false
  164. name: serial / macos
  165. runs-on: macos-latest
  166. steps:
  167. - uses: actions/checkout@v6
  168. - uses: pnpm/action-setup@v4
  169. with:
  170. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  171. - uses: actions/setup-node@v6
  172. with:
  173. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  174. - name: Install (immutable)
  175. run: pnpm install --frozen-lockfile
  176. - name: Run complete unsharded primary Node CI serially
  177. env:
  178. DSH_COVERAGE_MAX_WORKERS: '1'
  179. DSH_E2E_MAX_WORKERS: '1'
  180. DSH_GATE_CONCURRENCY: '1'
  181. DSH_PUBLINT_CONCURRENCY: '1'
  182. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  183. run: pnpm run check:ci
  184. # Hot-standby drill for the in-house self-hosted Windows pool: every master
  185. # move re-runs the complete unsharded Windows gate inventory on the persistent
  186. # VM, continuously proving that environment can take over the required
  187. # `windows` lane if the hosted pool degrades (the switch is setting the
  188. # writer-manageable DSH_CI_FAILOVER_WINDOWS variable — see the failover
  189. # runbook, no merge required). Push-triggered, so this lane always executes
  190. # the base branch's own workflow definition. This workflow never listens to
  191. # pull_request, so the drill does not appear in PR checks. No cache steps
  192. # because the VM's persistent pnpm store and tool caches make them redundant
  193. # (and saving here would poison the hosted cache namespace with self-hosted
  194. # paths).
  195. serial-windows:
  196. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  197. name: serial / windows (self-hosted standby)
  198. runs-on: [self-hosted, dsh-win-ci, windows]
  199. timeout-minutes: 120
  200. steps:
  201. - uses: actions/checkout@v6
  202. - name: Enable Developer Mode (symlink support)
  203. shell: pwsh
  204. run: >-
  205. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  206. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  207. - uses: pnpm/action-setup@v4
  208. with:
  209. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  210. - uses: actions/setup-node@v6
  211. with:
  212. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  213. - name: Configure persistent pnpm store
  214. shell: pwsh
  215. # The store must share the ReFS workspace volume for the clone
  216. # import method below; LOCALAPPDATA (C:) would cross volumes and
  217. # break block clone. See 2026-08-30-windows-refs-store-block-clone-install.
  218. run: |
  219. $storeRoot = "F:\.pnpm-store"
  220. echo "PNPM_CONFIG_STORE_DIR=$storeRoot" >> $env:GITHUB_ENV
  221. - name: Install (immutable)
  222. shell: pwsh
  223. # See 2026-08-30-windows-refs-store-block-clone-install for the
  224. # ReFS block-clone rationale; use clone only on ReFS.
  225. run: >-
  226. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  227. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  228. if ($fs -eq 'ReFS') {
  229. corepack pnpm install --frozen-lockfile --package-import-method=clone
  230. } else {
  231. pnpm install --frozen-lockfile
  232. }
  233. - name: Run complete unsharded Windows gate inventory serially
  234. shell: pwsh
  235. env:
  236. DSH_COVERAGE_MAX_WORKERS: '1'
  237. DSH_COVERAGE_TEST_TIMEOUT_MS: '90000'
  238. DSH_GATE_CONCURRENCY: '1'
  239. DSH_PUBLINT_CONCURRENCY: '1'
  240. run: pnpm run check:ci:windows-complete
  241. # Manual, bounded comparison of the actual critical Linux and Windows lanes.
  242. # The named pools are restricted at the organization level to this repository.
  243. larger-runner-benchmark:
  244. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'larger-runner-benchmark'
  245. runs-on: ${{ matrix.runner }}
  246. timeout-minutes: 15
  247. strategy:
  248. fail-fast: false
  249. max-parallel: 12
  250. matrix:
  251. include:
  252. - platform: linux
  253. cores: '4'
  254. runner: dsh-ubuntu-24-04-4core
  255. workload: typecheck
  256. - platform: linux
  257. cores: '8'
  258. runner: dsh-ubuntu-24-04-8core
  259. workload: typecheck
  260. - platform: linux
  261. cores: '16'
  262. runner: dsh-ubuntu-24-04-16core
  263. workload: typecheck
  264. - platform: linux
  265. cores: '32'
  266. runner: dsh-ubuntu-24-04-32core
  267. workload: typecheck
  268. - platform: linux
  269. cores: '64'
  270. runner: dsh-ubuntu-24-04-64core
  271. workload: typecheck
  272. - platform: linux
  273. cores: '96'
  274. runner: dsh-ubuntu-24-04-96core
  275. workload: typecheck
  276. - platform: windows
  277. cores: '4'
  278. runner: dsh-windows-2025-4core
  279. workload: production-site
  280. - platform: windows
  281. cores: '8'
  282. runner: dsh-windows-2025-8core
  283. workload: production-site
  284. - platform: windows
  285. cores: '16'
  286. runner: dsh-windows-2025-16core
  287. workload: production-site
  288. - platform: windows
  289. cores: '32'
  290. runner: dsh-windows-2025-32core
  291. workload: production-site
  292. - platform: windows
  293. cores: '64'
  294. runner: dsh-windows-2025-64core
  295. workload: production-site
  296. - platform: windows
  297. cores: '96'
  298. runner: dsh-windows-2025-96core
  299. workload: production-site
  300. steps:
  301. - uses: actions/checkout@v6
  302. - uses: pnpm/action-setup@v4
  303. with:
  304. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  305. # The benchmark's Windows lanes deliberately skip the store cache like
  306. # the independent native Windows job; an empty input disables caching.
  307. - uses: actions/setup-node@v6
  308. with:
  309. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  310. cache: ${{ matrix.platform == 'linux' && 'pnpm' || '' }}
  311. - name: Report runner capacity
  312. run: >-
  313. node -e "const os = require('node:os');
  314. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  315. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  316. - name: Install (immutable)
  317. run: pnpm install --frozen-lockfile
  318. - name: Run critical Linux typecheck lane
  319. if: matrix.platform == 'linux'
  320. run: pnpm run typecheck
  321. - name: Run critical Windows production-site lane
  322. if: matrix.platform == 'windows'
  323. run: pnpm run docs:build
  324. # Manual comparison of the intended low-fanout topology. Linux runs the
  325. # complete unsharded primary aggregate with bounded in-runner parallelism;
  326. # Windows runs both blocking build targets concurrently through run-gates.
  327. consolidated-runner-benchmark:
  328. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  329. runs-on: ${{ matrix.runner }}
  330. timeout-minutes: 15
  331. strategy:
  332. fail-fast: false
  333. max-parallel: 12
  334. matrix:
  335. include:
  336. - platform: linux
  337. cores: '4'
  338. runner: dsh-ubuntu-24-04-4core
  339. workers: '4'
  340. - platform: linux
  341. cores: '8'
  342. runner: dsh-ubuntu-24-04-8core
  343. workers: '8'
  344. - platform: linux
  345. cores: '16'
  346. runner: dsh-ubuntu-24-04-16core
  347. workers: '16'
  348. - platform: linux
  349. cores: '32'
  350. runner: dsh-ubuntu-24-04-32core
  351. workers: '32'
  352. - platform: linux
  353. cores: '64'
  354. runner: dsh-ubuntu-24-04-64core
  355. workers: '32'
  356. - platform: linux
  357. cores: '96'
  358. runner: dsh-ubuntu-24-04-96core
  359. workers: '32'
  360. - platform: windows
  361. cores: '4'
  362. runner: dsh-windows-2025-4core
  363. workers: '2'
  364. - platform: windows
  365. cores: '8'
  366. runner: dsh-windows-2025-8core
  367. workers: '2'
  368. - platform: windows
  369. cores: '16'
  370. runner: dsh-windows-2025-16core
  371. workers: '2'
  372. - platform: windows
  373. cores: '32'
  374. runner: dsh-windows-2025-32core
  375. workers: '2'
  376. - platform: windows
  377. cores: '64'
  378. runner: dsh-windows-2025-64core
  379. workers: '2'
  380. - platform: windows
  381. cores: '96'
  382. runner: dsh-windows-2025-96core
  383. workers: '2'
  384. steps:
  385. - uses: actions/checkout@v6
  386. - uses: pnpm/action-setup@v4
  387. with:
  388. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  389. # Unlike the larger-runner suite, both platforms cache the store here:
  390. # the consolidated topology measures cache mechanics as workload.
  391. - uses: actions/setup-node@v6
  392. with:
  393. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  394. cache: pnpm
  395. - name: Report runner capacity
  396. run: >-
  397. node -e "const os = require('node:os');
  398. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  399. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  400. - name: Install and prepare Linux
  401. if: matrix.platform == 'linux'
  402. run: |
  403. pnpm install --frozen-lockfile &
  404. install_pid=$!
  405. bash scripts/prepare-ci-bubblewrap.sh &
  406. sandbox_pid=$!
  407. install_status=0
  408. wait "$install_pid" || install_status=$?
  409. sandbox_status=0
  410. wait "$sandbox_pid" || sandbox_status=$?
  411. if (( install_status != 0 )); then exit "$install_status"; fi
  412. exit "$sandbox_status"
  413. - name: Install (immutable)
  414. if: matrix.platform == 'windows'
  415. shell: pwsh
  416. run: pnpm install --frozen-lockfile
  417. - name: Run complete unsharded primary Node CI concurrently
  418. if: matrix.platform == 'linux'
  419. env:
  420. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  421. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  422. DSH_OXLINT_THREADS: ${{ matrix.workers }}
  423. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  424. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  425. run: pnpm run check:ci
  426. - name: Run blocking Windows builds concurrently
  427. if: matrix.platform == 'windows'
  428. shell: pwsh
  429. env:
  430. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  431. run: pnpm run check:ci:windows-blocking