1
0

ci.yml 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  1. name: CI
  2. on:
  3. push:
  4. branches: [master]
  5. pull_request:
  6. workflow_dispatch:
  7. inputs:
  8. suite:
  9. description: Manual CI suite to run
  10. required: true
  11. default: larger-runner-benchmark
  12. type: choice
  13. options:
  14. - larger-runner-benchmark
  15. - consolidated-runner-benchmark
  16. # Cancel a superseded run on every event EXCEPT push. A push run carries the two
  17. # self-hosted standby drills, which take longer than the interval between master
  18. # merges, so cancelling supersedes a drill before it reaches a verdict and the
  19. # lane yields no readiness evidence. Must be decided here: cancellation applies
  20. # to the whole superseded run, so a job-level group cannot exempt its job.
  21. # Negated rather than `== 'pull_request'` so workflow_dispatch keeps cancelling:
  22. # a re-dispatched runner benchmark holds up to 12 larger runners for 15 minutes
  23. # and shares this group with the drills on master, so queueing it would delay
  24. # them. The guarantee is narrow — evaluated against the newly triggered run, so a
  25. # dispatch on master still cancels a mid-flight drill, and a newer pending push
  26. # displaces an older one. Bounds and rationale:
  27. # .agents/notes/implemented/process/2026-07-26-ci-failover-runbook.md
  28. concurrency:
  29. group: ${{ github.workflow }}-${{ github.ref }}
  30. cancel-in-progress: ${{ github.event_name != 'push' }}
  31. permissions:
  32. contents: read
  33. env:
  34. PRIMARY_NODE_VERSION: '24'
  35. # CI runs must never report to the production telemetry endpoint baked
  36. # into apps/cli/cordis.yml (AppCLIEntry disables the row when set).
  37. DSH_TELEMETRY_DISABLED: '1'
  38. jobs:
  39. # TODO(hosted-serial-ci): Re-enable the one remaining disabled hosted serial
  40. # reference job (serial-macos) before release. The self-hosted standby lane
  41. # below remains active on every master push. Re-enabling serial-macos does not
  42. # restore a Linux hosted-cache producer: decide whether to add a master seeder
  43. # or remove the restore-only steps if cold starts become a concern.
  44. # Three enterprise jobs isolate coverage, static analysis, and the
  45. # build-backed consumer tail. The consumer job owns the only Linux build so
  46. # all three jobs enter runner allocation independently.
  47. #
  48. # FAILOVER (Linux): each Linux enterprise job resolves its pool through the
  49. # DSH_CI_FAILOVER_LINUX repository variable. Unset (normal), the expressions
  50. # pick the hosted enterprise pools below. Setting the variable to
  51. # 'selfhosted' (repo Settings → Actions → Variables; writer-manageable
  52. # repository state — not PR-editable, no merge required) retargets all
  53. # three onto the in-house
  54. # vm-backup pool and re-running the failed jobs is the entire switch —
  55. # see .agents/notes/implemented/process/2026-07-26-ci-failover-runbook.md. The
  56. # in-house pool's readiness is re-proven on every master push by the
  57. # serial-linux-selfhosted standby lane below. The Windows failover switch is
  58. # the separate DSH_CI_FAILOVER_WINDOWS variable on the windows-native job below.
  59. node-24:
  60. if: github.event_name == 'pull_request'
  61. runs-on: >-
  62. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  63. && github.event.pull_request.user.login != 'dependabot[bot]'
  64. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  65. || 'dsh-ubuntu-24-04-16core' }}
  66. name: node 24 / static
  67. env:
  68. DSH_GATE_CONCURRENCY: '8'
  69. steps:
  70. # Fetch complete history so the archive gate can read the trusted PR base from a reused shallow checkout.
  71. - uses: actions/checkout@v6
  72. with:
  73. fetch-depth: 0
  74. persist-credentials: false
  75. - uses: pnpm/action-setup@v4
  76. with:
  77. dest: ${{ runner.temp }}/setup-pnpm
  78. - uses: actions/setup-node@v6
  79. with:
  80. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  81. - name: Configure pnpm store path
  82. id: pnpm-store
  83. run: |
  84. store_root="$HOME/.local/share/pnpm/store"
  85. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  86. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  87. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  88. # Pull requests consume the default-branch cache but do not put cache
  89. # compression and upload on the paid latency-critical path. Skipped
  90. # under failover — see the coverage lane's identical rationale.
  91. - uses: actions/cache/restore@v4
  92. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  93. with:
  94. path: ${{ steps.pnpm-store.outputs.path }}
  95. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  96. restore-keys: |
  97. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  98. - name: Install (immutable)
  99. run: pnpm install --frozen-lockfile
  100. - name: Run static gates
  101. env:
  102. DSH_ARCHIVE_BASE_REF: ${{ github.event.pull_request.base.sha }}
  103. run: pnpm run check:ci:static
  104. node-24-coverage:
  105. if: github.event_name == 'pull_request'
  106. runs-on: >-
  107. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  108. && github.event.pull_request.user.login != 'dependabot[bot]'
  109. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  110. || 'dsh-ubuntu-24-04-16core' }}
  111. name: node 24 / coverage
  112. env:
  113. # Partitioning replaces the instrumented share; this budget gives the
  114. # exempt-heavy gate two workers on both hosted and failover runners.
  115. DSH_COVERAGE_MAX_WORKERS: '6'
  116. DSH_COVERAGE_PARTITIONS: '4'
  117. DSH_GATE_CONCURRENCY: '3'
  118. steps:
  119. - uses: actions/checkout@v6
  120. with:
  121. persist-credentials: false
  122. - uses: pnpm/action-setup@v4
  123. with:
  124. dest: ${{ runner.temp }}/setup-pnpm
  125. - uses: actions/setup-node@v6
  126. with:
  127. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  128. - name: Configure pnpm store path
  129. id: pnpm-store
  130. run: |
  131. store_root="$HOME/.local/share/pnpm/store"
  132. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  133. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  134. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  135. # Skipped under failover: the self-hosted VM's persistent pnpm store
  136. # already serves warm installs, while restoring the hosted archive
  137. # would spend ~52 s pulling ~180 MB into that populated store.
  138. - uses: actions/cache/restore@v4
  139. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  140. with:
  141. path: ${{ steps.pnpm-store.outputs.path }}
  142. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  143. restore-keys: |
  144. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  145. - name: Install dependencies and prepare bubblewrap
  146. run: |
  147. pnpm install --frozen-lockfile &
  148. install_pid=$!
  149. bash scripts/prepare-ci-bubblewrap.sh &
  150. sandbox_pid=$!
  151. install_status=0
  152. wait "$install_pid" || install_status=$?
  153. sandbox_status=0
  154. wait "$sandbox_pid" || sandbox_status=$?
  155. if (( install_status != 0 )); then exit "$install_status"; fi
  156. exit "$sandbox_status"
  157. - name: Run exhaustive coverage
  158. run: pnpm run check:ci:coverage
  159. node-24-consumers:
  160. if: github.event_name == 'pull_request'
  161. runs-on: >-
  162. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  163. && github.event.pull_request.user.login != 'dependabot[bot]'
  164. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  165. || 'dsh-ubuntu-24-04-16core' }}
  166. name: node 24 / snapshots and artifacts
  167. env:
  168. DSH_GATE_CONCURRENCY: '8'
  169. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  170. DSH_OXLINT_THREADS: '8'
  171. DSH_PUBLINT_CONCURRENCY: '8'
  172. DSH_WEB_SNAPSHOT_WORKERS: '6'
  173. # Failover halves snapshot concurrency for the shared 64-core VM.
  174. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '12' || '32' }}
  175. steps:
  176. - uses: actions/checkout@v6
  177. with:
  178. persist-credentials: false
  179. - uses: pnpm/action-setup@v4
  180. with:
  181. dest: ${{ runner.temp }}/setup-pnpm
  182. - uses: actions/setup-node@v6
  183. with:
  184. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  185. - name: Configure pnpm store path
  186. id: pnpm-store
  187. run: |
  188. store_root="$HOME/.local/share/pnpm/store"
  189. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  190. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  191. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  192. # Pull requests restore the pnpm store and Playwright caches without paying
  193. # compression and upload on the required path. No master job saves these
  194. # hosted cache keys, so each restore-keys fallback hits the matching archived
  195. # entry until it evicts, after which the store is cold. Skipped under failover
  196. # — the self-hosted VM's persistent store is already warm.
  197. - uses: actions/cache/restore@v4
  198. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  199. with:
  200. path: ${{ steps.pnpm-store.outputs.path }}
  201. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  202. restore-keys: |
  203. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  204. # Skipped under failover: the VM's persistent browser cache is already warm.
  205. - uses: actions/cache/restore@v4
  206. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  207. with:
  208. path: ~/.cache/ms-playwright
  209. key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
  210. restore-keys: |
  211. ${{ runner.os }}-playwright-
  212. - name: Install dependencies and prepare bubblewrap
  213. run: |
  214. pnpm install --frozen-lockfile &
  215. install_pid=$!
  216. bash scripts/prepare-ci-bubblewrap.sh &
  217. sandbox_pid=$!
  218. install_status=0
  219. wait "$install_pid" || install_status=$?
  220. sandbox_status=0
  221. wait "$sandbox_pid" || sandbox_status=$?
  222. if (( install_status != 0 )); then exit "$install_status"; fi
  223. exit "$sandbox_status"
  224. - name: Install Playwright Chromium and hosted dependencies
  225. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  226. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install --with-deps chromium
  227. # The persistent VM image owns Playwright's Linux system packages; do
  228. # not mutate the shared host with apt on every failover run.
  229. - name: Install Playwright Chromium on the failover VM
  230. if: vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]'
  231. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install chromium
  232. - name: Run compatibility, snapshot, and artifact gates
  233. run: pnpm run check:ci:consumers
  234. node-compat:
  235. if: github.event_name == 'pull_request'
  236. # Each compatibility contract receives an independent standard hosted job.
  237. runs-on: ${{ matrix.runner }}
  238. name: ${{ matrix.name }}
  239. env:
  240. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  241. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  242. strategy:
  243. fail-fast: false
  244. matrix:
  245. include:
  246. - node: '22.19'
  247. name: node 22.19
  248. runner: ubuntu-latest
  249. gate_concurrency: '1'
  250. - node: 26
  251. name: node 26
  252. runner: ubuntu-latest
  253. gate_concurrency: '1'
  254. steps:
  255. - uses: actions/checkout@v6
  256. - uses: pnpm/action-setup@v4
  257. with:
  258. dest: ${{ runner.temp }}/setup-pnpm
  259. - uses: actions/setup-node@v6
  260. with:
  261. node-version: ${{ matrix.node }}
  262. cache: pnpm
  263. - name: Install (immutable)
  264. run: pnpm install --frozen-lockfile
  265. - name: Run compatibility smokes
  266. env:
  267. DSH_BUILD_CLIENT_PROFILE: official
  268. run: pnpm run check:node-compat
  269. python-sdk:
  270. if: github.event_name == 'pull_request'
  271. runs-on: ubuntu-latest
  272. name: python 3.10 / keyless SDK
  273. steps:
  274. - uses: actions/checkout@v6
  275. - uses: actions/setup-python@v6.3.0
  276. with:
  277. python-version: '3.10'
  278. cache: pip
  279. - name: Install uv
  280. run: python -m pip install uv==0.11.23
  281. - name: Run complete keyless Python suite
  282. run: uv run --python 3.10 --group test --project python/sdk pytest
  283. # One native target makes the complete release-shaped Python path required
  284. # without duplicating platform-independent behavior across the release matrix.
  285. # The reusable builder owns the executable, snapshot, wheel, clean-install,
  286. # GLIBC, and manylinux checks; release validation retains all native targets.
  287. python-runtime:
  288. if: github.event_name == 'pull_request'
  289. name: python runtime / release-shaped Linux x64
  290. uses: ./.github/workflows/build-exe-for-python-sdk.yml
  291. with:
  292. targets: node24-linux-x64
  293. ci: true
  294. # The required pull-request Windows signal: the two blocking win32 surfaces
  295. # (workspace build, production site) execute with real, checksum-verified
  296. # Windows Node under Wine on standard hosted Linux. The independent
  297. # windows-native job below keeps the complete native-kernel inventory —
  298. # including the observational portability gates this lane does not run —
  299. # on real Windows. This job only provisions runner state (caches,
  300. # apt); scripts/wine-windows-gates.sh owns the gate logic and is the same
  301. # script the optional local gate `pnpm run check:windows-wine` runs.
  302. # Current topology and fidelity limits live in
  303. # .agents/notes/implemented/process/2026-08-08-native-windows-pull-request-ci.md
  304. windows:
  305. if: github.event_name == 'pull_request'
  306. runs-on: ubuntu-latest
  307. name: windows node 24 / wine blocking
  308. timeout-minutes: 15
  309. steps:
  310. - uses: actions/checkout@v6
  311. with:
  312. persist-credentials: false
  313. - uses: pnpm/action-setup@v4
  314. with:
  315. dest: ${{ runner.temp }}/setup-pnpm
  316. - uses: actions/setup-node@v6
  317. with:
  318. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  319. - name: Configure pnpm store path
  320. id: pnpm-store
  321. run: |
  322. store_root="$HOME/.local/share/pnpm/store"
  323. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  324. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  325. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  326. - uses: actions/cache/restore@v4
  327. with:
  328. path: ${{ steps.pnpm-store.outputs.path }}
  329. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  330. restore-keys: |
  331. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  332. # Master's wine-apt-cache job seeds the default-branch scope every pull
  333. # request can read; a save from this job only reaches reruns of the
  334. # same merge ref.
  335. - name: Compose Wine apt cache key
  336. id: wine-cache-key
  337. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  338. - uses: actions/cache@v4
  339. with:
  340. path: ~/wine-debs
  341. key: ${{ steps.wine-cache-key.outputs.key }}
  342. # Runner provisioning only — a developer machine installs Wine through
  343. # its own package manager; the gate script assumes a wine binary and
  344. # fails loud without one. Wine from the apt cache when present; else
  345. # download the full dependency closure once and keep it for the next
  346. # run. The `wine` dispatcher package (not bare `wine64`) is what puts a
  347. # binary on PATH.
  348. - name: Install Wine
  349. run: |
  350. if compgen -G "$HOME/wine-debs/*.deb" > /dev/null; then
  351. # The restored archive is the full --download-only closure of
  352. # `wine` for this runner image, so installing the .debs directly
  353. # with dpkg needs no repository access. apt-get would instead
  354. # re-download the same 100+ MB closure from the mirror, which has
  355. # stalled the job past its budget on a degraded runner network.
  356. # If the archive cannot satisfy the closure, fall back to the apt
  357. # network install.
  358. if ! sudo DEBIAN_FRONTEND=noninteractive dpkg -i "$HOME"/wine-debs/*.deb; then
  359. sudo DEBIAN_FRONTEND=noninteractive dpkg --configure -a || true
  360. sudo apt-get install -y --no-install-recommends "$HOME"/wine-debs/*.deb
  361. fi
  362. else
  363. sudo apt-get update
  364. sudo apt-get install -y --no-install-recommends --download-only wine
  365. mkdir -p "$HOME/wine-debs"
  366. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/" 2>/dev/null || true
  367. sudo apt-get install -y --no-install-recommends wine
  368. fi
  369. - name: Run the Wine Windows gates
  370. run: bash scripts/wine-windows-gates.sh
  371. - name: Shut down wineserver
  372. if: always()
  373. run: wineserver -k 2>/dev/null || true
  374. # Master seeds the Wine apt-archive cache in the default-branch scope,
  375. # which every pull request's windows job can restore; saves from
  376. # pull-request runs are scoped to their own merge ref and help nobody
  377. # else. Runs in seconds when the image version already has a cache.
  378. wine-apt-cache:
  379. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  380. name: wine apt cache
  381. runs-on: ubuntu-latest
  382. timeout-minutes: 10
  383. steps:
  384. - name: Compose Wine apt cache key
  385. id: wine-cache-key
  386. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  387. - uses: actions/cache@v4
  388. id: wine-cache
  389. with:
  390. path: ~/wine-debs
  391. key: ${{ steps.wine-cache-key.outputs.key }}
  392. - name: Download the Wine dependency closure
  393. if: steps.wine-cache.outputs.cache-hit != 'true'
  394. run: |
  395. sudo apt-get update
  396. sudo apt-get install -y --no-install-recommends --download-only wine
  397. mkdir -p "$HOME/wine-debs"
  398. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/"
  399. du -sh "$HOME/wine-debs"
  400. # Every pull request also gets a real Windows-kernel signal. This job keeps
  401. # its own unmasked conclusion but is deliberately absent from
  402. # all-checks-passed.needs, so it never delays or changes that required
  403. # verdict. Under normal operation it runs on the hosted larger runner; under
  404. # Windows failover (DSH_CI_FAILOVER_WINDOWS=selfhosted) it retargets onto the
  405. # in-house self-hosted Windows pool. Dependabot PRs are excluded from the
  406. # self-hosted pool and stay queued for the hosted runner — see the failover
  407. # runbook. This Windows switch is independent of the Linux
  408. # DSH_CI_FAILOVER_LINUX variable that retargets the three required Linux jobs
  409. # and the all-checks-passed verdict above.
  410. windows-native:
  411. if: github.event_name == 'pull_request'
  412. runs-on: >-
  413. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  414. && github.event.pull_request.user.login != 'dependabot[bot]'
  415. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  416. || 'dsh-windows-2025-16core' }}
  417. name: windows node 24 / native complete
  418. timeout-minutes: 120
  419. env:
  420. DSH_COVERAGE_MAX_WORKERS: '6'
  421. DSH_COVERAGE_PARTITIONS: '8'
  422. # Instrumented process and polling fixtures can exceed Vitest's defaults
  423. # under the complete lane's concurrent gate load.
  424. DSH_COVERAGE_TEST_TIMEOUT_MS: '30000'
  425. DSH_GATE_CONCURRENCY: '4'
  426. DSH_PUBLINT_CONCURRENCY: '8'
  427. steps:
  428. - uses: actions/checkout@v6
  429. with:
  430. persist-credentials: false
  431. - name: Enable Developer Mode (symlink support)
  432. shell: pwsh
  433. run: >-
  434. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  435. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  436. - uses: pnpm/action-setup@v4
  437. with:
  438. dest: ${{ runner.temp }}/setup-pnpm
  439. - uses: actions/setup-node@v6
  440. with:
  441. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  442. # Extracting the many-file pnpm store cache is slower than a clean
  443. # install on hosted Windows runners, and saving it adds latency after
  444. # the gates. The self-hosted VM's persistent store makes caching
  445. # redundant.
  446. - name: Install (immutable)
  447. shell: pwsh
  448. run: pnpm install --frozen-lockfile
  449. - name: Run complete native Windows gate inventory
  450. shell: pwsh
  451. run: pnpm run check:ci:windows-complete
  452. # Hot-standby drill for the in-house self-hosted pool: every master move
  453. # re-runs the complete unsharded aggregate on the persistent 64-core VM,
  454. # continuously proving that environment can take over a required lane if
  455. # the hosted pools degrade (the switch is then setting the writer-manageable
  456. # DSH_CI_FAILOVER_LINUX variable — see the failover runbook, no merge required).
  457. # Push-triggered, so this lane always executes the base branch's own
  458. # workflow definition. (Under failover, pull_request jobs do reach these
  459. # runners with the PR merge ref's workflow — the boundary there is
  460. # repository membership: private, forking disabled, Dependabot excluded.)
  461. # Non-blocking for
  462. # pull requests; no cache steps because the VM's persistent pnpm store and
  463. # tool caches make them redundant (and saving here would poison the hosted
  464. # cache namespace with self-hosted paths).
  465. serial-linux-selfhosted:
  466. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  467. name: serial / linux (self-hosted standby)
  468. runs-on: [self-hosted, linux, x64, vm-backup]
  469. steps:
  470. # DSH_ARCHIVE_BASE_REF below compares the frozen-archive gate against
  471. # github.event.before, so full history is required: depth 2 would miss it
  472. # on multi-commit or force pushes; full fetch is cheap here because
  473. # checkout resolves against the VM's local mirror.
  474. - uses: actions/checkout@v6
  475. with:
  476. fetch-depth: 0
  477. - uses: pnpm/action-setup@v4
  478. with:
  479. dest: ${{ runner.temp }}/setup-pnpm
  480. - uses: actions/setup-node@v6
  481. with:
  482. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  483. - name: Configure persistent pnpm store
  484. run: echo "PNPM_CONFIG_STORE_DIR=$HOME/.local/share/pnpm/store" >> "$GITHUB_ENV"
  485. - name: Install (immutable)
  486. run: pnpm install --frozen-lockfile
  487. # The persistent VM image owns Playwright's Linux system packages; this
  488. # step also proves that browser provisioning remains usable for failover.
  489. - name: Install Playwright Chromium
  490. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install chromium
  491. - name: Prepare bubblewrap (unrestrict userns)
  492. run: bash scripts/prepare-ci-bubblewrap.sh
  493. - name: Run complete unsharded primary Node CI serially
  494. env:
  495. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  496. DSH_COVERAGE_MAX_WORKERS: '1'
  497. DSH_E2E_MAX_WORKERS: '1'
  498. DSH_GATE_CONCURRENCY: '1'
  499. DSH_OXLINT_THREADS: '1'
  500. DSH_PUBLINT_CONCURRENCY: '1'
  501. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  502. run: pnpm run check:ci:linux-primary
  503. # The one remaining disabled hosted serial reference job; see
  504. # TODO(hosted-serial-ci) above.
  505. serial-macos:
  506. if: false
  507. name: serial / macos
  508. runs-on: macos-latest
  509. steps:
  510. - uses: actions/checkout@v6
  511. - uses: pnpm/action-setup@v4
  512. with:
  513. dest: ${{ runner.temp }}/setup-pnpm
  514. - uses: actions/setup-node@v6
  515. with:
  516. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  517. - name: Install (immutable)
  518. run: pnpm install --frozen-lockfile
  519. - name: Run complete unsharded primary Node CI serially
  520. env:
  521. DSH_COVERAGE_MAX_WORKERS: '1'
  522. DSH_E2E_MAX_WORKERS: '1'
  523. DSH_GATE_CONCURRENCY: '1'
  524. DSH_PUBLINT_CONCURRENCY: '1'
  525. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  526. run: pnpm run check:ci
  527. # Hot-standby drill for the in-house self-hosted Windows pool: every master
  528. # move re-runs the complete unsharded Windows gate inventory on the persistent
  529. # VM, continuously proving that environment can take over the required
  530. # `windows` lane if the hosted pool degrades (the switch is setting the
  531. # writer-manageable DSH_CI_FAILOVER_WINDOWS variable — see the failover
  532. # runbook, no merge required). Push-triggered, so this lane always executes
  533. # the base branch's own workflow definition. Non-blocking for pull requests;
  534. # absent from all-checks-passed.needs by design — the required `windows` job
  535. # owns the PR verdict. No cache steps because the VM's persistent pnpm store
  536. # and tool caches make them redundant (and saving here would poison the
  537. # hosted cache namespace with self-hosted paths).
  538. serial-windows:
  539. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  540. name: serial / windows (self-hosted standby)
  541. runs-on: [self-hosted, dsh-win-ci, windows]
  542. timeout-minutes: 120
  543. steps:
  544. - uses: actions/checkout@v6
  545. - name: Enable Developer Mode (symlink support)
  546. shell: pwsh
  547. run: >-
  548. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  549. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  550. - uses: pnpm/action-setup@v4
  551. with:
  552. dest: ${{ runner.temp }}/setup-pnpm
  553. - uses: actions/setup-node@v6
  554. with:
  555. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  556. - name: Configure persistent pnpm store
  557. shell: pwsh
  558. run: |
  559. $storeRoot = "$env:LOCALAPPDATA\pnpm\store"
  560. echo "PNPM_CONFIG_STORE_DIR=$storeRoot" >> $env:GITHUB_ENV
  561. - name: Install (immutable)
  562. shell: pwsh
  563. run: pnpm install --frozen-lockfile
  564. - name: Run complete unsharded Windows gate inventory serially
  565. shell: pwsh
  566. env:
  567. DSH_COVERAGE_MAX_WORKERS: '1'
  568. DSH_GATE_CONCURRENCY: '1'
  569. DSH_PUBLINT_CONCURRENCY: '1'
  570. run: pnpm run check:ci:windows-complete
  571. # Manual, bounded comparison of the actual critical Linux and Windows lanes.
  572. # The named pools are restricted at the organization level to this repository.
  573. larger-runner-benchmark:
  574. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'larger-runner-benchmark'
  575. runs-on: ${{ matrix.runner }}
  576. timeout-minutes: 15
  577. strategy:
  578. fail-fast: false
  579. max-parallel: 12
  580. matrix:
  581. include:
  582. - platform: linux
  583. cores: '4'
  584. runner: dsh-ubuntu-24-04-4core
  585. workload: typecheck
  586. - platform: linux
  587. cores: '8'
  588. runner: dsh-ubuntu-24-04-8core
  589. workload: typecheck
  590. - platform: linux
  591. cores: '16'
  592. runner: dsh-ubuntu-24-04-16core
  593. workload: typecheck
  594. - platform: linux
  595. cores: '32'
  596. runner: dsh-ubuntu-24-04-32core
  597. workload: typecheck
  598. - platform: linux
  599. cores: '64'
  600. runner: dsh-ubuntu-24-04-64core
  601. workload: typecheck
  602. - platform: linux
  603. cores: '96'
  604. runner: dsh-ubuntu-24-04-96core
  605. workload: typecheck
  606. - platform: windows
  607. cores: '4'
  608. runner: dsh-windows-2025-4core
  609. workload: production-site
  610. - platform: windows
  611. cores: '8'
  612. runner: dsh-windows-2025-8core
  613. workload: production-site
  614. - platform: windows
  615. cores: '16'
  616. runner: dsh-windows-2025-16core
  617. workload: production-site
  618. - platform: windows
  619. cores: '32'
  620. runner: dsh-windows-2025-32core
  621. workload: production-site
  622. - platform: windows
  623. cores: '64'
  624. runner: dsh-windows-2025-64core
  625. workload: production-site
  626. - platform: windows
  627. cores: '96'
  628. runner: dsh-windows-2025-96core
  629. workload: production-site
  630. steps:
  631. - uses: actions/checkout@v6
  632. - uses: pnpm/action-setup@v4
  633. with:
  634. dest: ${{ runner.temp }}/setup-pnpm
  635. # The benchmark's Windows lanes deliberately skip the store cache like
  636. # the independent native Windows job; an empty input disables caching.
  637. - uses: actions/setup-node@v6
  638. with:
  639. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  640. cache: ${{ matrix.platform == 'linux' && 'pnpm' || '' }}
  641. - name: Report runner capacity
  642. run: >-
  643. node -e "const os = require('node:os');
  644. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  645. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  646. - name: Install (immutable)
  647. run: pnpm install --frozen-lockfile
  648. - name: Run critical Linux typecheck lane
  649. if: matrix.platform == 'linux'
  650. run: pnpm run typecheck
  651. - name: Run critical Windows production-site lane
  652. if: matrix.platform == 'windows'
  653. run: pnpm run docs:build
  654. # Manual comparison of the intended low-fanout topology. Linux runs the
  655. # complete unsharded primary aggregate with bounded in-runner parallelism;
  656. # Windows runs both blocking build targets concurrently through run-gates.
  657. consolidated-runner-benchmark:
  658. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  659. runs-on: ${{ matrix.runner }}
  660. timeout-minutes: 15
  661. strategy:
  662. fail-fast: false
  663. max-parallel: 12
  664. matrix:
  665. include:
  666. - platform: linux
  667. cores: '4'
  668. runner: dsh-ubuntu-24-04-4core
  669. workers: '4'
  670. - platform: linux
  671. cores: '8'
  672. runner: dsh-ubuntu-24-04-8core
  673. workers: '8'
  674. - platform: linux
  675. cores: '16'
  676. runner: dsh-ubuntu-24-04-16core
  677. workers: '16'
  678. - platform: linux
  679. cores: '32'
  680. runner: dsh-ubuntu-24-04-32core
  681. workers: '32'
  682. - platform: linux
  683. cores: '64'
  684. runner: dsh-ubuntu-24-04-64core
  685. workers: '32'
  686. - platform: linux
  687. cores: '96'
  688. runner: dsh-ubuntu-24-04-96core
  689. workers: '32'
  690. - platform: windows
  691. cores: '4'
  692. runner: dsh-windows-2025-4core
  693. workers: '2'
  694. - platform: windows
  695. cores: '8'
  696. runner: dsh-windows-2025-8core
  697. workers: '2'
  698. - platform: windows
  699. cores: '16'
  700. runner: dsh-windows-2025-16core
  701. workers: '2'
  702. - platform: windows
  703. cores: '32'
  704. runner: dsh-windows-2025-32core
  705. workers: '2'
  706. - platform: windows
  707. cores: '64'
  708. runner: dsh-windows-2025-64core
  709. workers: '2'
  710. - platform: windows
  711. cores: '96'
  712. runner: dsh-windows-2025-96core
  713. workers: '2'
  714. steps:
  715. - uses: actions/checkout@v6
  716. - uses: pnpm/action-setup@v4
  717. with:
  718. dest: ${{ runner.temp }}/setup-pnpm
  719. # Unlike the larger-runner suite, both platforms cache the store here:
  720. # the consolidated topology measures cache mechanics as workload.
  721. - uses: actions/setup-node@v6
  722. with:
  723. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  724. cache: pnpm
  725. - name: Report runner capacity
  726. run: >-
  727. node -e "const os = require('node:os');
  728. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  729. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  730. - name: Install and prepare Linux
  731. if: matrix.platform == 'linux'
  732. run: |
  733. pnpm install --frozen-lockfile &
  734. install_pid=$!
  735. bash scripts/prepare-ci-bubblewrap.sh &
  736. sandbox_pid=$!
  737. install_status=0
  738. wait "$install_pid" || install_status=$?
  739. sandbox_status=0
  740. wait "$sandbox_pid" || sandbox_status=$?
  741. if (( install_status != 0 )); then exit "$install_status"; fi
  742. exit "$sandbox_status"
  743. - name: Install (immutable)
  744. if: matrix.platform == 'windows'
  745. shell: pwsh
  746. run: pnpm install --frozen-lockfile
  747. - name: Run complete unsharded primary Node CI concurrently
  748. if: matrix.platform == 'linux'
  749. env:
  750. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  751. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  752. DSH_OXLINT_THREADS: ${{ matrix.workers }}
  753. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  754. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  755. run: pnpm run check:ci
  756. - name: Run blocking Windows builds concurrently
  757. if: matrix.platform == 'windows'
  758. shell: pwsh
  759. env:
  760. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  761. run: pnpm run check:ci:windows-blocking
  762. # Single stable required check for branch protection: require "all checks
  763. # passed" instead of enumerating matrix legs whose names change as lanes and
  764. # node versions evolve. Every blocking job in THIS workflow must be listed in
  765. # `needs`. The required Wine job is listed as `windows`; `windows-native` is
  766. # deliberately absent so its independent result never delays or changes this
  767. # verdict. (`needs` cannot reach across workflow files; e2e.yml stays its own
  768. # check.)
  769. # `if: always()` is load-bearing: without it a failed dependency
  770. # would SKIP this job, and GitHub counts a skipped required check as passing
  771. # — so this job always runs and fails on any non-success result, including
  772. # 'cancelled' and 'skipped'.
  773. all-checks-passed:
  774. name: all checks passed
  775. # This bookkeeping-only verdict must not depend on custom-pool
  776. # provisioning — and under Linux failover it follows the same selector as
  777. # the worker jobs it aggregates, so a standard-hosted outage cannot strand
  778. # the branch-protection verdict either. It retargets with the Linux switch
  779. # (DSH_CI_FAILOVER_LINUX), not the Windows one, because it aggregates the
  780. # required Linux workers and runs on the vm-backup pool.
  781. runs-on: >-
  782. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  783. && github.event.pull_request.user.login != 'dependabot[bot]'
  784. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  785. || 'ubuntu-latest' }}
  786. needs: [node-24, node-24-coverage, node-24-consumers, node-compat, python-sdk, python-runtime, windows]
  787. if: always() && github.event_name == 'pull_request'
  788. steps:
  789. - name: Fail if any needed job did not succeed
  790. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  791. run: |
  792. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  793. exit 1
  794. - name: All checks passed
  795. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"