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