ci-master.yml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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. # A master push may carry only the two self-hosted standby drills and the Wine
  16. # apt cache seeder; those 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. # Master seeds the Wine apt-archive cache in the default-branch scope,
  32. # which every pull request's windows job can restore; saves from
  33. # pull-request runs are scoped to their own merge ref and help nobody
  34. # else. Runs in seconds when the image version already has a cache.
  35. wine-apt-cache:
  36. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  37. name: wine apt cache
  38. runs-on: ubuntu-latest
  39. timeout-minutes: 10
  40. steps:
  41. - name: Compose Wine apt cache key
  42. id: wine-cache-key
  43. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  44. - uses: actions/cache@v4
  45. id: wine-cache
  46. with:
  47. path: ~/wine-debs
  48. key: ${{ steps.wine-cache-key.outputs.key }}
  49. - name: Download the Wine dependency closure
  50. if: steps.wine-cache.outputs.cache-hit != 'true'
  51. run: |
  52. sudo apt-get update
  53. sudo apt-get install -y --no-install-recommends --download-only wine
  54. mkdir -p "$HOME/wine-debs"
  55. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/"
  56. du -sh "$HOME/wine-debs"
  57. # Hot-standby drill for the in-house self-hosted pool: every master move
  58. # re-runs the complete unsharded aggregate on the persistent 64-core VM,
  59. # continuously proving that environment can take over a required lane if
  60. # the hosted pools degrade (the switch is then setting the writer-manageable
  61. # DSH_CI_FAILOVER_LINUX variable — see the failover runbook, no merge required).
  62. # Push-triggered, so this lane always executes the base branch's own
  63. # workflow definition. This workflow never listens to pull_request, so the
  64. # drill does not appear in PR checks. No cache steps because the VM's
  65. # persistent pnpm store and tool caches make them redundant (and saving here
  66. # would poison the hosted cache namespace with self-hosted paths).
  67. serial-linux-selfhosted:
  68. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  69. name: serial / linux (self-hosted standby)
  70. runs-on: [self-hosted, linux, x64, vm-backup]
  71. steps:
  72. # DSH_ARCHIVE_BASE_REF below compares the frozen-archive gate against
  73. # github.event.before, so full history is required: depth 2 would miss it
  74. # on multi-commit or force pushes; full fetch is cheap here because
  75. # checkout resolves against the VM's local mirror.
  76. - uses: actions/checkout@v6
  77. with:
  78. fetch-depth: 0
  79. - uses: pnpm/action-setup@v4
  80. with:
  81. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  82. - uses: actions/setup-node@v6
  83. with:
  84. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  85. - name: Configure persistent pnpm store
  86. run: echo "PNPM_CONFIG_STORE_DIR=$HOME/.local/share/pnpm/store" >> "$GITHUB_ENV"
  87. - name: Install (immutable)
  88. run: pnpm install --frozen-lockfile
  89. # The persistent VM image owns Playwright's Linux system packages; this
  90. # step also proves that browser provisioning remains usable for failover.
  91. - name: Install Playwright Chromium
  92. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install chromium
  93. - name: Prepare bubblewrap (unrestrict userns)
  94. run: bash scripts/prepare-ci-bubblewrap.sh
  95. - name: Run complete unsharded primary Node CI serially
  96. env:
  97. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  98. DSH_COVERAGE_MAX_WORKERS: '1'
  99. DSH_E2E_MAX_WORKERS: '1'
  100. DSH_GATE_CONCURRENCY: '1'
  101. DSH_OXLINT_THREADS: '1'
  102. DSH_PUBLINT_CONCURRENCY: '1'
  103. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  104. run: pnpm run check:ci:linux-primary
  105. # TODO(hosted-serial-ci): Re-enable the one remaining disabled hosted serial
  106. # reference job (serial-macos) before release. Re-enabling serial-macos does
  107. # not restore a Linux hosted-cache producer: decide whether to add a master
  108. # seeder or remove the restore-only steps if cold starts become a concern.
  109. serial-macos:
  110. if: false
  111. name: serial / macos
  112. runs-on: macos-latest
  113. steps:
  114. - uses: actions/checkout@v6
  115. - uses: pnpm/action-setup@v4
  116. with:
  117. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  118. - uses: actions/setup-node@v6
  119. with:
  120. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  121. - name: Install (immutable)
  122. run: pnpm install --frozen-lockfile
  123. - name: Run complete unsharded primary Node CI serially
  124. env:
  125. DSH_COVERAGE_MAX_WORKERS: '1'
  126. DSH_E2E_MAX_WORKERS: '1'
  127. DSH_GATE_CONCURRENCY: '1'
  128. DSH_PUBLINT_CONCURRENCY: '1'
  129. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  130. run: pnpm run check:ci
  131. # Hot-standby drill for the in-house self-hosted Windows pool: every master
  132. # move re-runs the complete unsharded Windows gate inventory on the persistent
  133. # VM, continuously proving that environment can take over the required
  134. # `windows` lane if the hosted pool degrades (the switch is setting the
  135. # writer-manageable DSH_CI_FAILOVER_WINDOWS variable — see the failover
  136. # runbook, no merge required). Push-triggered, so this lane always executes
  137. # the base branch's own workflow definition. This workflow never listens to
  138. # pull_request, so the drill does not appear in PR checks. No cache steps
  139. # because the VM's persistent pnpm store and tool caches make them redundant
  140. # (and saving here would poison the hosted cache namespace with self-hosted
  141. # paths).
  142. serial-windows:
  143. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  144. name: serial / windows (self-hosted standby)
  145. runs-on: [self-hosted, dsh-win-ci, windows]
  146. timeout-minutes: 120
  147. steps:
  148. - uses: actions/checkout@v6
  149. - name: Enable Developer Mode (symlink support)
  150. shell: pwsh
  151. run: >-
  152. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  153. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  154. - uses: pnpm/action-setup@v4
  155. with:
  156. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  157. - uses: actions/setup-node@v6
  158. with:
  159. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  160. - name: Configure persistent pnpm store
  161. shell: pwsh
  162. # The store must share the ReFS workspace volume for the clone
  163. # import method below; LOCALAPPDATA (C:) would cross volumes and
  164. # break block clone. See 2026-08-30-windows-refs-store-block-clone-install.
  165. run: |
  166. $storeRoot = "F:\.pnpm-store"
  167. echo "PNPM_CONFIG_STORE_DIR=$storeRoot" >> $env:GITHUB_ENV
  168. - name: Install (immutable)
  169. shell: pwsh
  170. # See 2026-08-30-windows-refs-store-block-clone-install for the
  171. # ReFS block-clone rationale; use clone only on ReFS.
  172. run: >-
  173. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  174. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  175. if ($fs -eq 'ReFS') {
  176. corepack pnpm install --frozen-lockfile --package-import-method=clone
  177. } else {
  178. pnpm install --frozen-lockfile
  179. }
  180. - name: Run complete unsharded Windows gate inventory serially
  181. shell: pwsh
  182. env:
  183. DSH_COVERAGE_MAX_WORKERS: '1'
  184. DSH_COVERAGE_TEST_TIMEOUT_MS: '90000'
  185. DSH_GATE_CONCURRENCY: '1'
  186. DSH_PUBLINT_CONCURRENCY: '1'
  187. run: pnpm run check:ci:windows-complete
  188. # Manual, bounded comparison of the actual critical Linux and Windows lanes.
  189. # The named pools are restricted at the organization level to this repository.
  190. larger-runner-benchmark:
  191. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'larger-runner-benchmark'
  192. runs-on: ${{ matrix.runner }}
  193. timeout-minutes: 15
  194. strategy:
  195. fail-fast: false
  196. max-parallel: 12
  197. matrix:
  198. include:
  199. - platform: linux
  200. cores: '4'
  201. runner: dsh-ubuntu-24-04-4core
  202. workload: typecheck
  203. - platform: linux
  204. cores: '8'
  205. runner: dsh-ubuntu-24-04-8core
  206. workload: typecheck
  207. - platform: linux
  208. cores: '16'
  209. runner: dsh-ubuntu-24-04-16core
  210. workload: typecheck
  211. - platform: linux
  212. cores: '32'
  213. runner: dsh-ubuntu-24-04-32core
  214. workload: typecheck
  215. - platform: linux
  216. cores: '64'
  217. runner: dsh-ubuntu-24-04-64core
  218. workload: typecheck
  219. - platform: linux
  220. cores: '96'
  221. runner: dsh-ubuntu-24-04-96core
  222. workload: typecheck
  223. - platform: windows
  224. cores: '4'
  225. runner: dsh-windows-2025-4core
  226. workload: production-site
  227. - platform: windows
  228. cores: '8'
  229. runner: dsh-windows-2025-8core
  230. workload: production-site
  231. - platform: windows
  232. cores: '16'
  233. runner: dsh-windows-2025-16core
  234. workload: production-site
  235. - platform: windows
  236. cores: '32'
  237. runner: dsh-windows-2025-32core
  238. workload: production-site
  239. - platform: windows
  240. cores: '64'
  241. runner: dsh-windows-2025-64core
  242. workload: production-site
  243. - platform: windows
  244. cores: '96'
  245. runner: dsh-windows-2025-96core
  246. workload: production-site
  247. steps:
  248. - uses: actions/checkout@v6
  249. - uses: pnpm/action-setup@v4
  250. with:
  251. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  252. # The benchmark's Windows lanes deliberately skip the store cache like
  253. # the independent native Windows job; an empty input disables caching.
  254. - uses: actions/setup-node@v6
  255. with:
  256. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  257. cache: ${{ matrix.platform == 'linux' && 'pnpm' || '' }}
  258. - name: Report runner capacity
  259. run: >-
  260. node -e "const os = require('node:os');
  261. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  262. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  263. - name: Install (immutable)
  264. run: pnpm install --frozen-lockfile
  265. - name: Run critical Linux typecheck lane
  266. if: matrix.platform == 'linux'
  267. run: pnpm run typecheck
  268. - name: Run critical Windows production-site lane
  269. if: matrix.platform == 'windows'
  270. run: pnpm run docs:build
  271. # Manual comparison of the intended low-fanout topology. Linux runs the
  272. # complete unsharded primary aggregate with bounded in-runner parallelism;
  273. # Windows runs both blocking build targets concurrently through run-gates.
  274. consolidated-runner-benchmark:
  275. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  276. runs-on: ${{ matrix.runner }}
  277. timeout-minutes: 15
  278. strategy:
  279. fail-fast: false
  280. max-parallel: 12
  281. matrix:
  282. include:
  283. - platform: linux
  284. cores: '4'
  285. runner: dsh-ubuntu-24-04-4core
  286. workers: '4'
  287. - platform: linux
  288. cores: '8'
  289. runner: dsh-ubuntu-24-04-8core
  290. workers: '8'
  291. - platform: linux
  292. cores: '16'
  293. runner: dsh-ubuntu-24-04-16core
  294. workers: '16'
  295. - platform: linux
  296. cores: '32'
  297. runner: dsh-ubuntu-24-04-32core
  298. workers: '32'
  299. - platform: linux
  300. cores: '64'
  301. runner: dsh-ubuntu-24-04-64core
  302. workers: '32'
  303. - platform: linux
  304. cores: '96'
  305. runner: dsh-ubuntu-24-04-96core
  306. workers: '32'
  307. - platform: windows
  308. cores: '4'
  309. runner: dsh-windows-2025-4core
  310. workers: '2'
  311. - platform: windows
  312. cores: '8'
  313. runner: dsh-windows-2025-8core
  314. workers: '2'
  315. - platform: windows
  316. cores: '16'
  317. runner: dsh-windows-2025-16core
  318. workers: '2'
  319. - platform: windows
  320. cores: '32'
  321. runner: dsh-windows-2025-32core
  322. workers: '2'
  323. - platform: windows
  324. cores: '64'
  325. runner: dsh-windows-2025-64core
  326. workers: '2'
  327. - platform: windows
  328. cores: '96'
  329. runner: dsh-windows-2025-96core
  330. workers: '2'
  331. steps:
  332. - uses: actions/checkout@v6
  333. - uses: pnpm/action-setup@v4
  334. with:
  335. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  336. # Unlike the larger-runner suite, both platforms cache the store here:
  337. # the consolidated topology measures cache mechanics as workload.
  338. - uses: actions/setup-node@v6
  339. with:
  340. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  341. cache: pnpm
  342. - name: Report runner capacity
  343. run: >-
  344. node -e "const os = require('node:os');
  345. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  346. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  347. - name: Install and prepare Linux
  348. if: matrix.platform == 'linux'
  349. run: |
  350. pnpm install --frozen-lockfile &
  351. install_pid=$!
  352. bash scripts/prepare-ci-bubblewrap.sh &
  353. sandbox_pid=$!
  354. install_status=0
  355. wait "$install_pid" || install_status=$?
  356. sandbox_status=0
  357. wait "$sandbox_pid" || sandbox_status=$?
  358. if (( install_status != 0 )); then exit "$install_status"; fi
  359. exit "$sandbox_status"
  360. - name: Install (immutable)
  361. if: matrix.platform == 'windows'
  362. shell: pwsh
  363. run: pnpm install --frozen-lockfile
  364. - name: Run complete unsharded primary Node CI concurrently
  365. if: matrix.platform == 'linux'
  366. env:
  367. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  368. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  369. DSH_OXLINT_THREADS: ${{ matrix.workers }}
  370. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  371. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  372. run: pnpm run check:ci
  373. - name: Run blocking Windows builds concurrently
  374. if: matrix.platform == 'windows'
  375. shell: pwsh
  376. env:
  377. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  378. run: pnpm run check:ci:windows-blocking