ci.yml 33 KB

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