ci-master.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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
  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
  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
  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. run: |
  163. $storeRoot = "$env:LOCALAPPDATA\pnpm\store"
  164. echo "PNPM_CONFIG_STORE_DIR=$storeRoot" >> $env:GITHUB_ENV
  165. - name: Install (immutable)
  166. shell: pwsh
  167. run: pnpm install --frozen-lockfile
  168. - name: Run complete unsharded Windows gate inventory serially
  169. shell: pwsh
  170. env:
  171. DSH_COVERAGE_MAX_WORKERS: '1'
  172. DSH_GATE_CONCURRENCY: '1'
  173. DSH_PUBLINT_CONCURRENCY: '1'
  174. run: pnpm run check:ci:windows-complete
  175. # Manual, bounded comparison of the actual critical Linux and Windows lanes.
  176. # The named pools are restricted at the organization level to this repository.
  177. larger-runner-benchmark:
  178. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'larger-runner-benchmark'
  179. runs-on: ${{ matrix.runner }}
  180. timeout-minutes: 15
  181. strategy:
  182. fail-fast: false
  183. max-parallel: 12
  184. matrix:
  185. include:
  186. - platform: linux
  187. cores: '4'
  188. runner: dsh-ubuntu-24-04-4core
  189. workload: typecheck
  190. - platform: linux
  191. cores: '8'
  192. runner: dsh-ubuntu-24-04-8core
  193. workload: typecheck
  194. - platform: linux
  195. cores: '16'
  196. runner: dsh-ubuntu-24-04-16core
  197. workload: typecheck
  198. - platform: linux
  199. cores: '32'
  200. runner: dsh-ubuntu-24-04-32core
  201. workload: typecheck
  202. - platform: linux
  203. cores: '64'
  204. runner: dsh-ubuntu-24-04-64core
  205. workload: typecheck
  206. - platform: linux
  207. cores: '96'
  208. runner: dsh-ubuntu-24-04-96core
  209. workload: typecheck
  210. - platform: windows
  211. cores: '4'
  212. runner: dsh-windows-2025-4core
  213. workload: production-site
  214. - platform: windows
  215. cores: '8'
  216. runner: dsh-windows-2025-8core
  217. workload: production-site
  218. - platform: windows
  219. cores: '16'
  220. runner: dsh-windows-2025-16core
  221. workload: production-site
  222. - platform: windows
  223. cores: '32'
  224. runner: dsh-windows-2025-32core
  225. workload: production-site
  226. - platform: windows
  227. cores: '64'
  228. runner: dsh-windows-2025-64core
  229. workload: production-site
  230. - platform: windows
  231. cores: '96'
  232. runner: dsh-windows-2025-96core
  233. workload: production-site
  234. steps:
  235. - uses: actions/checkout@v6
  236. - uses: pnpm/action-setup@v4
  237. with:
  238. dest: ${{ runner.temp }}/setup-pnpm
  239. # The benchmark's Windows lanes deliberately skip the store cache like
  240. # the independent native Windows job; an empty input disables caching.
  241. - uses: actions/setup-node@v6
  242. with:
  243. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  244. cache: ${{ matrix.platform == 'linux' && 'pnpm' || '' }}
  245. - name: Report runner capacity
  246. run: >-
  247. node -e "const os = require('node:os');
  248. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  249. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  250. - name: Install (immutable)
  251. run: pnpm install --frozen-lockfile
  252. - name: Run critical Linux typecheck lane
  253. if: matrix.platform == 'linux'
  254. run: pnpm run typecheck
  255. - name: Run critical Windows production-site lane
  256. if: matrix.platform == 'windows'
  257. run: pnpm run docs:build
  258. # Manual comparison of the intended low-fanout topology. Linux runs the
  259. # complete unsharded primary aggregate with bounded in-runner parallelism;
  260. # Windows runs both blocking build targets concurrently through run-gates.
  261. consolidated-runner-benchmark:
  262. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  263. runs-on: ${{ matrix.runner }}
  264. timeout-minutes: 15
  265. strategy:
  266. fail-fast: false
  267. max-parallel: 12
  268. matrix:
  269. include:
  270. - platform: linux
  271. cores: '4'
  272. runner: dsh-ubuntu-24-04-4core
  273. workers: '4'
  274. - platform: linux
  275. cores: '8'
  276. runner: dsh-ubuntu-24-04-8core
  277. workers: '8'
  278. - platform: linux
  279. cores: '16'
  280. runner: dsh-ubuntu-24-04-16core
  281. workers: '16'
  282. - platform: linux
  283. cores: '32'
  284. runner: dsh-ubuntu-24-04-32core
  285. workers: '32'
  286. - platform: linux
  287. cores: '64'
  288. runner: dsh-ubuntu-24-04-64core
  289. workers: '32'
  290. - platform: linux
  291. cores: '96'
  292. runner: dsh-ubuntu-24-04-96core
  293. workers: '32'
  294. - platform: windows
  295. cores: '4'
  296. runner: dsh-windows-2025-4core
  297. workers: '2'
  298. - platform: windows
  299. cores: '8'
  300. runner: dsh-windows-2025-8core
  301. workers: '2'
  302. - platform: windows
  303. cores: '16'
  304. runner: dsh-windows-2025-16core
  305. workers: '2'
  306. - platform: windows
  307. cores: '32'
  308. runner: dsh-windows-2025-32core
  309. workers: '2'
  310. - platform: windows
  311. cores: '64'
  312. runner: dsh-windows-2025-64core
  313. workers: '2'
  314. - platform: windows
  315. cores: '96'
  316. runner: dsh-windows-2025-96core
  317. workers: '2'
  318. steps:
  319. - uses: actions/checkout@v6
  320. - uses: pnpm/action-setup@v4
  321. with:
  322. dest: ${{ runner.temp }}/setup-pnpm
  323. # Unlike the larger-runner suite, both platforms cache the store here:
  324. # the consolidated topology measures cache mechanics as workload.
  325. - uses: actions/setup-node@v6
  326. with:
  327. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  328. cache: pnpm
  329. - name: Report runner capacity
  330. run: >-
  331. node -e "const os = require('node:os');
  332. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  333. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  334. - name: Install and prepare Linux
  335. if: matrix.platform == 'linux'
  336. run: |
  337. pnpm install --frozen-lockfile &
  338. install_pid=$!
  339. bash scripts/prepare-ci-bubblewrap.sh &
  340. sandbox_pid=$!
  341. install_status=0
  342. wait "$install_pid" || install_status=$?
  343. sandbox_status=0
  344. wait "$sandbox_pid" || sandbox_status=$?
  345. if (( install_status != 0 )); then exit "$install_status"; fi
  346. exit "$sandbox_status"
  347. - name: Install (immutable)
  348. if: matrix.platform == 'windows'
  349. shell: pwsh
  350. run: pnpm install --frozen-lockfile
  351. - name: Run complete unsharded primary Node CI concurrently
  352. if: matrix.platform == 'linux'
  353. env:
  354. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  355. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  356. DSH_OXLINT_THREADS: ${{ matrix.workers }}
  357. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  358. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  359. run: pnpm run check:ci
  360. - name: Run blocking Windows builds concurrently
  361. if: matrix.platform == 'windows'
  362. shell: pwsh
  363. env:
  364. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  365. run: pnpm run check:ci:windows-blocking