ci.yml 32 KB

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