ci.yml 34 KB

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