ci.yml 35 KB

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