ci.yml 37 KB

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