ci.yml 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985
  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. # Pull requests consume the default-branch cache but do not put cache
  55. # compression and upload on the paid latency-critical path. Skipped
  56. # under failover — see the coverage lane's identical rationale.
  57. - uses: actions/cache/restore@v4
  58. if: vars.DSH_CI_FAILOVER != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  59. with:
  60. path: /home/runner/.local/share/pnpm/store/v11
  61. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  62. restore-keys: |
  63. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  64. - uses: actions/setup-node@v6
  65. with:
  66. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  67. - name: Enable corepack and install dependencies
  68. run: |
  69. corepack enable
  70. pnpm install --frozen-lockfile
  71. - name: Run static gates
  72. env:
  73. DSH_ARCHIVE_BASE_REF: ${{ github.event.pull_request.base.sha }}
  74. run: pnpm run check:ci:static
  75. - name: Pack built tree
  76. run: >-
  77. tar -czf "$RUNNER_TEMP/node-24-built-tree.tar.gz"
  78. apps/*/lib packages/*/*/lib vendor/*/lib
  79. - uses: actions/upload-artifact@v6
  80. with:
  81. name: node-24-built-tree
  82. path: ${{ runner.temp }}/node-24-built-tree.tar.gz
  83. if-no-files-found: error
  84. retention-days: 1
  85. compression-level: 0
  86. node-24-coverage:
  87. if: github.event_name == 'pull_request'
  88. runs-on: >-
  89. ${{ vars.DSH_CI_FAILOVER == 'selfhosted'
  90. && github.event.pull_request.user.login != 'dependabot[bot]'
  91. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  92. || 'dsh-enterprise-ubuntu-24-04-32core-test' }}
  93. name: node 24 / coverage
  94. env:
  95. # Failover shrinks the worker bound: the hosted 32-core runner is
  96. # exclusive to one job, but the failover pool shares one 64-core VM
  97. # across six always-on runner instances, and the timing-sensitive
  98. # process suites have documented aggregate-contention failures.
  99. # 8 × 6 instances = 48 workers worst case on 64 cores.
  100. DSH_COVERAGE_MAX_WORKERS: ${{ vars.DSH_CI_FAILOVER == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '8' || '24' }}
  101. DSH_GATE_CONCURRENCY: '8'
  102. steps:
  103. - uses: actions/checkout@v6
  104. with:
  105. persist-credentials: false
  106. # Skipped under failover: the self-hosted VM's persistent pnpm store
  107. # serves warm installs directly, and this hosted-path restore would
  108. # spend ~52 s pulling ~180 MB into a path pnpm never reads there.
  109. - uses: actions/cache/restore@v4
  110. if: vars.DSH_CI_FAILOVER != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  111. with:
  112. path: /home/runner/.local/share/pnpm/store/v11
  113. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  114. restore-keys: |
  115. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  116. - uses: actions/setup-node@v6
  117. with:
  118. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  119. - name: Enable corepack, install dependencies, and prepare bubblewrap
  120. run: |
  121. corepack enable
  122. pnpm install --frozen-lockfile &
  123. install_pid=$!
  124. bash scripts/prepare-ci-bubblewrap.sh &
  125. sandbox_pid=$!
  126. install_status=0
  127. wait "$install_pid" || install_status=$?
  128. sandbox_status=0
  129. wait "$sandbox_pid" || sandbox_status=$?
  130. if (( install_status != 0 )); then exit "$install_status"; fi
  131. exit "$sandbox_status"
  132. - name: Run exhaustive coverage
  133. run: pnpm run check:ci:coverage
  134. node-24-consumers:
  135. needs: node-24
  136. if: github.event_name == 'pull_request'
  137. runs-on: >-
  138. ${{ vars.DSH_CI_FAILOVER == 'selfhosted'
  139. && github.event.pull_request.user.login != 'dependabot[bot]'
  140. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  141. || 'dsh-enterprise-ubuntu-latest-32core-test' }}
  142. name: node 24 / snapshots and artifacts
  143. env:
  144. DSH_ESLINT_CACHE: '1'
  145. DSH_ESLINT_CONCURRENCY: '8'
  146. DSH_GATE_CONCURRENCY: '8'
  147. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  148. DSH_PUBLINT_CONCURRENCY: '8'
  149. # Failover halves snapshot concurrency for the shared 64-core VM.
  150. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '12' || '32' }}
  151. steps:
  152. - uses: actions/checkout@v6
  153. with:
  154. persist-credentials: false
  155. - uses: actions/download-artifact@v8
  156. with:
  157. name: node-24-built-tree
  158. path: ${{ runner.temp }}
  159. - name: Restore built tree
  160. run: tar -xzf "$RUNNER_TEMP/node-24-built-tree.tar.gz"
  161. # Skipped under failover — see the coverage lane's identical rationale.
  162. - uses: actions/cache/restore@v4
  163. if: vars.DSH_CI_FAILOVER != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  164. with:
  165. path: /home/runner/.local/share/pnpm/store/v11
  166. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  167. restore-keys: |
  168. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  169. - uses: actions/cache/restore@v4
  170. with:
  171. path: .cache/eslint
  172. 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') }}
  173. restore-keys: |
  174. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-
  175. - uses: actions/setup-node@v6
  176. with:
  177. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  178. - name: Enable corepack, install dependencies, and prepare bubblewrap
  179. run: |
  180. corepack enable
  181. pnpm install --frozen-lockfile &
  182. install_pid=$!
  183. bash scripts/prepare-ci-bubblewrap.sh &
  184. sandbox_pid=$!
  185. install_status=0
  186. wait "$install_pid" || install_status=$?
  187. sandbox_status=0
  188. wait "$sandbox_pid" || sandbox_status=$?
  189. if (( install_status != 0 )); then exit "$install_status"; fi
  190. exit "$sandbox_status"
  191. - name: Run compatibility, snapshot, and artifact gates
  192. run: |
  193. pnpm run check:ci:lint &
  194. lint_pid=$!
  195. pnpm run check:node-compat &
  196. compat_pid=$!
  197. DSH_EXAMPLE_MODE=lib pnpm run test:snapshot &
  198. snapshot_pid=$!
  199. pnpm run publint &
  200. publint_pid=$!
  201. pnpm run verify-node-next-types &
  202. node_next_pid=$!
  203. pnpm run verify-built-package-invariants &
  204. built_invariants_pid=$!
  205. DSH_EXAMPLE_MODE=lib pnpm exec vitest run --config vitest.e2e.config.ts \
  206. examples/headless-agent/tests/keyless-smoke.e2e.ts \
  207. examples/tui-agent/tests/tui-keyless-smoke.e2e.ts \
  208. packages/examples/cli-demo/tests/built-bin.e2e.ts \
  209. packages/examples/acp-demo/tests/built-bin.e2e.ts \
  210. packages/ui/jsonrpc/tests/built-scope-carrier.e2e.ts \
  211. packages/workflow/workflow-workerthread/tests/built-worker.e2e.ts \
  212. packages/code-runtime/code-runtime-worker/tests/built-lib.e2e.ts &
  213. built_bin_pid=$!
  214. final_status=0
  215. capture_status() {
  216. local child_status=0
  217. wait "$1" || child_status=$?
  218. if (( final_status == 0 && child_status != 0 )); then
  219. final_status=$child_status
  220. fi
  221. }
  222. for child_pid in \
  223. "$lint_pid" "$compat_pid" "$snapshot_pid" \
  224. "$publint_pid" "$node_next_pid" "$built_invariants_pid" "$built_bin_pid"
  225. do
  226. capture_status "$child_pid"
  227. done
  228. exit "$final_status"
  229. node-compat:
  230. if: github.event_name == 'pull_request'
  231. # Each compatibility contract receives an independent standard hosted job.
  232. runs-on: ${{ matrix.runner }}
  233. name: ${{ matrix.name }}
  234. env:
  235. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  236. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  237. strategy:
  238. fail-fast: false
  239. matrix:
  240. include:
  241. - node: '22.19'
  242. name: node 22.19
  243. runner: ubuntu-latest
  244. gate_concurrency: '1'
  245. - node: 26
  246. name: node 26
  247. runner: ubuntu-latest
  248. gate_concurrency: '1'
  249. steps:
  250. - uses: actions/checkout@v6
  251. - uses: actions/setup-node@v6
  252. with:
  253. node-version: ${{ matrix.node }}
  254. - name: Enable corepack and resolve pnpm store path
  255. id: pnpm-store
  256. run: |
  257. corepack enable
  258. echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  259. - uses: actions/cache@v4
  260. with:
  261. path: ${{ steps.pnpm-store.outputs.path }}
  262. key: ${{ runner.os }}-node-${{ matrix.node }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  263. restore-keys: |
  264. ${{ runner.os }}-node-${{ matrix.node }}-pnpm-
  265. - name: Install (immutable)
  266. run: pnpm install --frozen-lockfile
  267. - name: Run compatibility smokes
  268. run: pnpm run check:node-compat
  269. python-sdk:
  270. if: github.event_name == 'pull_request'
  271. runs-on: ubuntu-latest
  272. name: python 3.10 / keyless SDK
  273. steps:
  274. - uses: actions/checkout@v6
  275. - uses: actions/setup-python@v6
  276. with:
  277. python-version: '3.10'
  278. cache: pip
  279. - name: Install uv
  280. run: python -m pip install uv==0.11.23
  281. - name: Run complete keyless Python suite
  282. run: uv run --python 3.10 --group test --project python/sdk pytest
  283. # The required pull-request Windows signal: the two blocking win32 surfaces
  284. # (workspace build, production site) execute with real, checksum-verified
  285. # Windows Node under Wine on standard hosted Linux. The master
  286. # serial-windows job below keeps the complete native-kernel inventory —
  287. # including the observational portability gates this lane does not run —
  288. # on real windows-2025. Direct tool entrypoints stand in for pnpm's cmd
  289. # shims, which a Linux-side install does not create; layout, fidelity
  290. # limits, and measured timings live in
  291. # .agents/notes/implemented/process/2026-07-27-wine-windows-gates-experiment.md
  292. windows:
  293. if: github.event_name == 'pull_request'
  294. runs-on: ubuntu-latest
  295. name: windows node 24 / wine blocking
  296. timeout-minutes: 15
  297. env:
  298. WINEDEBUG: '-all'
  299. WINEARCH: win64
  300. # Skip Wine Mono / Gecko installers: Node needs neither.
  301. WINEDLLOVERRIDES: 'mscoree,mshtml='
  302. steps:
  303. - uses: actions/checkout@v6
  304. with:
  305. persist-credentials: false
  306. - uses: actions/setup-node@v6
  307. with:
  308. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  309. - uses: actions/cache/restore@v4
  310. with:
  311. path: /home/runner/.local/share/pnpm/store/v11
  312. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  313. restore-keys: |
  314. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  315. # Master's wine-apt-cache job seeds the default-branch scope every pull
  316. # request can read; a save from this job only reaches reruns of the
  317. # same merge ref.
  318. - name: Compose Wine apt cache key
  319. id: wine-cache-key
  320. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  321. - uses: actions/cache@v4
  322. with:
  323. path: ~/wine-debs
  324. key: ${{ steps.wine-cache-key.outputs.key }}
  325. - name: Install dependencies and provision Wine concurrently
  326. run: |
  327. corepack enable
  328. # Windows-lane install-time overrides. supportedArchitectures
  329. # additionally materializes the win32-x64 platform packages
  330. # (@esbuild/win32-x64, rolldown and rollup MSVC bindings) the
  331. # Windows toolchain resolves at runtime; nodeLinker: hoisted lays
  332. # node_modules out flat with real files because Windows Node under
  333. # Wine does not realpath pnpm's isolated-layout symlinks. Neither
  334. # override is recorded in the lockfile, so --frozen-lockfile stays
  335. # valid. --ignore-scripts skips Linux lifecycle scripts no gate in
  336. # this lane loads; the win32 binaries ship prebuilt.
  337. cat >> pnpm-workspace.yaml <<'EOF'
  338. nodeLinker: hoisted
  339. supportedArchitectures:
  340. os: [current, win32]
  341. cpu: [current, x64]
  342. EOF
  343. pnpm install --frozen-lockfile --ignore-scripts &
  344. install_pid=$!
  345. provision_wine() {
  346. set -euo pipefail
  347. # Wine from the apt cache when present; else download the full
  348. # dependency closure once and keep it for the next run. The
  349. # `wine` dispatcher package (not bare `wine64`) is what puts a
  350. # binary on PATH.
  351. if compgen -G "$HOME/wine-debs/*.deb" > /dev/null; then
  352. sudo apt-get install -y --no-install-recommends "$HOME"/wine-debs/*.deb
  353. else
  354. sudo apt-get update
  355. sudo apt-get install -y --no-install-recommends --download-only wine
  356. mkdir -p "$HOME/wine-debs"
  357. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/" 2>/dev/null || true
  358. sudo apt-get install -y --no-install-recommends wine
  359. fi
  360. WINE_BIN=''
  361. for candidate in "$(command -v wine || true)" "$(command -v wine64 || true)" /usr/lib/wine/wine64; do
  362. if [ -n "$candidate" ] && [ -x "$candidate" ]; then WINE_BIN="$candidate"; break; fi
  363. done
  364. [ -n "$WINE_BIN" ] || { echo '::error::no wine binary found after install'; exit 1; }
  365. echo "WINE_BIN=$WINE_BIN" >> "$GITHUB_ENV"
  366. # Windows Node for the repo's primary line, checksum-verified
  367. # against the same dist directory.
  368. version=$(curl -fsSL https://nodejs.org/dist/index.json \
  369. | jq -r --arg p "v${PRIMARY_NODE_VERSION}." '[.[] | select(.version | startswith($p))][0].version')
  370. echo "Windows Node: $version"
  371. curl -fsSL -o "$RUNNER_TEMP/node-win.zip" \
  372. "https://nodejs.org/dist/${version}/node-${version}-win-x64.zip"
  373. curl -fsSL "https://nodejs.org/dist/${version}/SHASUMS256.txt" \
  374. | awk -v a="node-${version}-win-x64.zip" '$2 == a { print $1 " '"$RUNNER_TEMP"'/node-win.zip" }' \
  375. | sha256sum --check -
  376. unzip -q "$RUNNER_TEMP/node-win.zip" -d "$RUNNER_TEMP/node-win"
  377. echo "NODE_WIN=$RUNNER_TEMP/node-win/node-${version}-win-x64/node.exe" >> "$GITHUB_ENV"
  378. "$WINE_BIN" wineboot --init || true
  379. wineserver -w || true
  380. }
  381. provision_wine &
  382. wine_pid=$!
  383. install_status=0
  384. wait "$install_pid" || install_status=$?
  385. wine_status=0
  386. wait "$wine_pid" || wine_status=$?
  387. if (( install_status != 0 )); then exit "$install_status"; fi
  388. exit "$wine_status"
  389. - name: Resolve entrypoints, link vue, smoke Windows Node
  390. run: |
  391. # Node under Wine cannot attach stdio to the Actions runner's pipes
  392. # (Socket open EBADF at bootstrap), so every invocation runs through
  393. # this wrapper: stdio to a regular file, replayed after exit.
  394. cat > "$RUNNER_TEMP/wine-node.sh" <<'SH'
  395. #!/usr/bin/env bash
  396. set -u
  397. log="$1"; shift
  398. "$WINE_BIN" "$NODE_WIN" "$@" < /dev/null > "$log" 2>&1
  399. status=$?
  400. tail -n 300 "$log"
  401. exit "$status"
  402. SH
  403. chmod +x "$RUNNER_TEMP/wine-node.sh"
  404. resolve() {
  405. local name="$1"; shift
  406. for p in "$@"; do
  407. if [ -f "$p" ]; then echo "$name=$PWD/$p" >> "$GITHUB_ENV"; return 0; fi
  408. done
  409. echo "::error::$name not found at any of: $*"; return 1
  410. }
  411. resolve TSC_JS node_modules/typescript/bin/tsc
  412. resolve TSDOWN_JS node_modules/tsdown/dist/run.mjs
  413. resolve VITEPRESS_JS website/node_modules/vitepress/bin/vitepress.js node_modules/vitepress/bin/vitepress.js
  414. # VitePress links vue into the site's node_modules at build time;
  415. # Wine cannot CREATE Windows symlinks (ENOTSUP) but follows
  416. # pre-existing Unix ones, so lay the link down host-side.
  417. if [ -d node_modules/vue ] && [ ! -e website/node_modules/vue ]; then
  418. mkdir -p website/node_modules
  419. ln -s ../../node_modules/vue website/node_modules/vue
  420. fi
  421. "$RUNNER_TEMP/wine-node.sh" "$RUNNER_TEMP/smoke.log" -p "'smoke: ' + process.platform + ' ' + process.arch + ' ' + process.version"
  422. # The two blocking surfaces run concurrently, the same shape run-gates
  423. # gives ci-windows-blocking on native Windows: `build` = tsc -b then
  424. # tsdown, `production site` = the VitePress build. Both statuses are
  425. # captured so one failure cannot hide the other's result.
  426. - name: Run blocking Windows gates concurrently under Wine
  427. run: |
  428. build_gate() {
  429. "$RUNNER_TEMP/wine-node.sh" "$RUNNER_TEMP/tsc.log" "$TSC_JS" -b --pretty false || return $?
  430. "$RUNNER_TEMP/wine-node.sh" "$RUNNER_TEMP/tsdown.log" "$TSDOWN_JS"
  431. }
  432. site_gate() {
  433. cd website
  434. "$RUNNER_TEMP/wine-node.sh" "$RUNNER_TEMP/site.log" "$VITEPRESS_JS" build .
  435. }
  436. start=$SECONDS
  437. build_gate > "$RUNNER_TEMP/build-gate.out" 2>&1 &
  438. build_pid=$!
  439. site_gate > "$RUNNER_TEMP/site-gate.out" 2>&1 &
  440. site_pid=$!
  441. build_status=0
  442. wait "$build_pid" || build_status=$?
  443. site_status=0
  444. wait "$site_pid" || site_status=$?
  445. echo "== build gate (exit $build_status, $((SECONDS - start))s elapsed) =="
  446. tail -n 120 "$RUNNER_TEMP/build-gate.out"
  447. echo "== production site gate (exit $site_status, $((SECONDS - start))s elapsed) =="
  448. tail -n 120 "$RUNNER_TEMP/site-gate.out"
  449. if (( build_status != 0 )); then exit "$build_status"; fi
  450. exit "$site_status"
  451. - name: Shut down wineserver
  452. if: always()
  453. run: wineserver -k 2>/dev/null || true
  454. # Master seeds the Wine apt-archive cache in the default-branch scope,
  455. # which every pull request's windows job can restore; saves from
  456. # pull-request runs are scoped to their own merge ref and help nobody
  457. # else. Runs in seconds when the image version already has a cache.
  458. wine-apt-cache:
  459. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  460. name: wine apt cache
  461. runs-on: ubuntu-latest
  462. timeout-minutes: 10
  463. steps:
  464. - name: Compose Wine apt cache key
  465. id: wine-cache-key
  466. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  467. - uses: actions/cache@v4
  468. id: wine-cache
  469. with:
  470. path: ~/wine-debs
  471. key: ${{ steps.wine-cache-key.outputs.key }}
  472. - name: Download the Wine dependency closure
  473. if: steps.wine-cache.outputs.cache-hit != 'true'
  474. run: |
  475. sudo apt-get update
  476. sudo apt-get install -y --no-install-recommends --download-only wine
  477. mkdir -p "$HOME/wine-debs"
  478. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/"
  479. du -sh "$HOME/wine-debs"
  480. # Master pushes run only the serial reference jobs below.
  481. # Each host executes the complete, unsharded primary Node aggregate with one
  482. # gate worker, giving reviewers a simple cross-platform oracle for completeness
  483. # and timing.
  484. serial-linux:
  485. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  486. name: serial / linux
  487. runs-on: ubuntu-latest
  488. steps:
  489. - uses: actions/checkout@v6
  490. with:
  491. fetch-depth: 2
  492. - uses: actions/setup-node@v6
  493. with:
  494. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  495. - name: Enable corepack and resolve pnpm store path
  496. id: pnpm-store
  497. run: |
  498. corepack enable
  499. echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  500. # Master refreshes the caches that pull requests restore without saving.
  501. - uses: actions/cache@v4
  502. with:
  503. path: ${{ steps.pnpm-store.outputs.path }}
  504. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  505. restore-keys: |
  506. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  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. run: pnpm install --frozen-lockfile
  515. - name: Prepare bubblewrap (unrestrict userns)
  516. run: bash scripts/prepare-ci-bubblewrap.sh
  517. - name: Run complete unsharded primary Node CI serially
  518. env:
  519. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  520. DSH_COVERAGE_MAX_WORKERS: '1'
  521. DSH_E2E_MAX_WORKERS: '1'
  522. DSH_ESLINT_CACHE: '1'
  523. DSH_GATE_CONCURRENCY: '1'
  524. DSH_PUBLINT_CONCURRENCY: '1'
  525. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  526. run: pnpm run check:ci
  527. # Hot-standby drill for the in-house self-hosted pool: every master move
  528. # re-runs the complete unsharded aggregate on the persistent 64-core VM,
  529. # continuously proving that environment can take over a required lane if
  530. # the hosted pools degrade (the switch is then setting the writer-manageable
  531. # DSH_CI_FAILOVER variable — see the failover runbook, no merge required).
  532. # Push-triggered, so this lane always executes the base branch's own
  533. # workflow definition. (Under failover, pull_request jobs do reach these
  534. # runners with the PR merge ref's workflow — the boundary there is
  535. # repository membership: private, forking disabled, Dependabot excluded.)
  536. # Non-blocking for
  537. # pull requests; no cache steps because the VM's persistent pnpm store and
  538. # tool caches make them redundant (and saving here would poison the hosted
  539. # cache namespace with self-hosted paths).
  540. serial-linux-selfhosted:
  541. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  542. name: serial / linux (self-hosted standby)
  543. runs-on: [self-hosted, linux, x64, vm-backup]
  544. steps:
  545. # Full history + DSH_ARCHIVE_BASE_REF below: same frozen-archive
  546. # comparison as serial-linux. Depth 2 would miss github.event.before
  547. # on multi-commit or force pushes; full fetch is cheap here because
  548. # checkout resolves against the VM's local mirror.
  549. - uses: actions/checkout@v6
  550. with:
  551. fetch-depth: 0
  552. - uses: actions/setup-node@v6
  553. with:
  554. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  555. - name: Enable corepack (pnpm)
  556. run: corepack enable
  557. - name: Install (immutable)
  558. run: pnpm install --frozen-lockfile
  559. - name: Prepare bubblewrap (unrestrict userns)
  560. run: bash scripts/prepare-ci-bubblewrap.sh
  561. - name: Run complete unsharded primary Node CI serially
  562. env:
  563. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  564. DSH_COVERAGE_MAX_WORKERS: '1'
  565. DSH_E2E_MAX_WORKERS: '1'
  566. DSH_ESLINT_CACHE: '1'
  567. DSH_GATE_CONCURRENCY: '1'
  568. DSH_PUBLINT_CONCURRENCY: '1'
  569. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  570. run: pnpm run check:ci
  571. serial-macos:
  572. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  573. name: serial / macos
  574. runs-on: macos-latest
  575. steps:
  576. - uses: actions/checkout@v6
  577. - uses: actions/setup-node@v6
  578. with:
  579. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  580. - name: Enable corepack (pnpm)
  581. run: corepack enable
  582. - name: Install (immutable)
  583. run: pnpm install --frozen-lockfile
  584. - name: Run complete unsharded primary Node CI serially
  585. env:
  586. DSH_COVERAGE_MAX_WORKERS: '1'
  587. DSH_E2E_MAX_WORKERS: '1'
  588. DSH_GATE_CONCURRENCY: '1'
  589. DSH_PUBLINT_CONCURRENCY: '1'
  590. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  591. run: pnpm run check:ci
  592. serial-windows:
  593. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  594. name: serial / windows
  595. runs-on: windows-2025
  596. steps:
  597. - uses: actions/checkout@v6
  598. - name: Enable Developer Mode (symlink support)
  599. shell: pwsh
  600. run: >-
  601. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  602. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  603. - uses: actions/setup-node@v6
  604. with:
  605. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  606. - name: Enable corepack (pnpm)
  607. shell: pwsh
  608. run: corepack enable
  609. # Master refreshes the small cache that pull requests restore without
  610. # putting package-store extraction back on the Windows critical path.
  611. - uses: actions/cache@v4
  612. with:
  613. path: .cache/eslint
  614. 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') }}
  615. restore-keys: |
  616. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-
  617. - name: Install (immutable)
  618. shell: pwsh
  619. run: pnpm install --frozen-lockfile
  620. - name: Run complete unsharded primary Node CI serially
  621. shell: pwsh
  622. env:
  623. DSH_COVERAGE_MAX_WORKERS: '1'
  624. DSH_E2E_MAX_WORKERS: '1'
  625. DSH_ESLINT_CACHE: '1'
  626. DSH_GATE_CONCURRENCY: '1'
  627. DSH_PUBLINT_CONCURRENCY: '1'
  628. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  629. run: pnpm run check:ci
  630. # Manual, bounded comparison of the actual critical Linux and Windows lanes.
  631. # The named pools are restricted at the organization level to this repository.
  632. larger-runner-benchmark:
  633. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'larger-runner-benchmark'
  634. runs-on: ${{ matrix.runner }}
  635. timeout-minutes: 15
  636. strategy:
  637. fail-fast: false
  638. max-parallel: 12
  639. matrix:
  640. include:
  641. - platform: linux
  642. cores: '4'
  643. runner: dsh-ubuntu-24-04-4core
  644. workload: typecheck
  645. - platform: linux
  646. cores: '8'
  647. runner: dsh-ubuntu-24-04-8core
  648. workload: typecheck
  649. - platform: linux
  650. cores: '16'
  651. runner: dsh-ubuntu-24-04-16core
  652. workload: typecheck
  653. - platform: linux
  654. cores: '32'
  655. runner: dsh-ubuntu-24-04-32core
  656. workload: typecheck
  657. - platform: linux
  658. cores: '64'
  659. runner: dsh-ubuntu-24-04-64core
  660. workload: typecheck
  661. - platform: linux
  662. cores: '96'
  663. runner: dsh-ubuntu-24-04-96core
  664. workload: typecheck
  665. - platform: windows
  666. cores: '4'
  667. runner: dsh-windows-2025-4core
  668. workload: production-site
  669. - platform: windows
  670. cores: '8'
  671. runner: dsh-windows-2025-8core
  672. workload: production-site
  673. - platform: windows
  674. cores: '16'
  675. runner: dsh-windows-2025-16core
  676. workload: production-site
  677. - platform: windows
  678. cores: '32'
  679. runner: dsh-windows-2025-32core
  680. workload: production-site
  681. - platform: windows
  682. cores: '64'
  683. runner: dsh-windows-2025-64core
  684. workload: production-site
  685. - platform: windows
  686. cores: '96'
  687. runner: dsh-windows-2025-96core
  688. workload: production-site
  689. steps:
  690. - uses: actions/checkout@v6
  691. - uses: actions/setup-node@v6
  692. with:
  693. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  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. - name: Enable corepack (pnpm)
  700. run: corepack enable
  701. - name: Resolve pnpm store path
  702. if: matrix.platform == 'linux'
  703. id: pnpm-store
  704. run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  705. - uses: actions/cache@v4
  706. if: matrix.platform == 'linux'
  707. with:
  708. path: ${{ steps.pnpm-store.outputs.path }}
  709. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  710. restore-keys: |
  711. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  712. - name: Install (immutable)
  713. run: pnpm install --frozen-lockfile
  714. - name: Run critical Linux typecheck lane
  715. if: matrix.platform == 'linux'
  716. run: pnpm run typecheck
  717. - name: Run critical Windows production-site lane
  718. if: matrix.platform == 'windows'
  719. run: pnpm run docs:build
  720. # Manual comparison of the intended low-fanout topology. Linux runs the
  721. # complete unsharded primary aggregate with bounded in-runner parallelism;
  722. # Windows runs both blocking build surfaces concurrently through run-gates.
  723. consolidated-runner-benchmark:
  724. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  725. runs-on: ${{ matrix.runner }}
  726. timeout-minutes: 15
  727. strategy:
  728. fail-fast: false
  729. max-parallel: 12
  730. matrix:
  731. include:
  732. - platform: linux
  733. cores: '4'
  734. runner: dsh-ubuntu-24-04-4core
  735. workers: '4'
  736. - platform: linux
  737. cores: '8'
  738. runner: dsh-ubuntu-24-04-8core
  739. workers: '8'
  740. - platform: linux
  741. cores: '16'
  742. runner: dsh-ubuntu-24-04-16core
  743. workers: '16'
  744. - platform: linux
  745. cores: '32'
  746. runner: dsh-ubuntu-24-04-32core
  747. workers: '32'
  748. - platform: linux
  749. cores: '64'
  750. runner: dsh-ubuntu-24-04-64core
  751. workers: '32'
  752. - platform: linux
  753. cores: '96'
  754. runner: dsh-ubuntu-24-04-96core
  755. workers: '32'
  756. - platform: windows
  757. cores: '4'
  758. runner: dsh-windows-2025-4core
  759. workers: '2'
  760. - platform: windows
  761. cores: '8'
  762. runner: dsh-windows-2025-8core
  763. workers: '2'
  764. - platform: windows
  765. cores: '16'
  766. runner: dsh-windows-2025-16core
  767. workers: '2'
  768. - platform: windows
  769. cores: '32'
  770. runner: dsh-windows-2025-32core
  771. workers: '2'
  772. - platform: windows
  773. cores: '64'
  774. runner: dsh-windows-2025-64core
  775. workers: '2'
  776. - platform: windows
  777. cores: '96'
  778. runner: dsh-windows-2025-96core
  779. workers: '2'
  780. steps:
  781. - uses: actions/checkout@v6
  782. - uses: actions/setup-node@v6
  783. with:
  784. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  785. - name: Report runner capacity
  786. run: >-
  787. node -e "const os = require('node:os');
  788. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  789. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  790. - name: Enable corepack (pnpm)
  791. run: corepack enable
  792. - name: Resolve pnpm store path (Linux)
  793. if: matrix.platform == 'linux'
  794. id: pnpm-store-linux
  795. run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  796. - name: Resolve pnpm store path (Windows)
  797. if: matrix.platform == 'windows'
  798. id: pnpm-store-windows
  799. shell: pwsh
  800. run: '"path=$(pnpm store path --silent)" >> $env:GITHUB_OUTPUT'
  801. - uses: actions/cache@v4
  802. with:
  803. path: ${{ steps.pnpm-store-linux.outputs.path || steps.pnpm-store-windows.outputs.path }}
  804. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  805. restore-keys: |
  806. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  807. - uses: actions/cache@v4
  808. if: matrix.platform == 'linux'
  809. with:
  810. path: .cache/eslint
  811. 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') }}
  812. restore-keys: |
  813. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-
  814. - name: Install and prepare Linux
  815. if: matrix.platform == 'linux'
  816. run: |
  817. pnpm install --frozen-lockfile &
  818. install_pid=$!
  819. bash scripts/prepare-ci-bubblewrap.sh &
  820. sandbox_pid=$!
  821. install_status=0
  822. wait "$install_pid" || install_status=$?
  823. sandbox_status=0
  824. wait "$sandbox_pid" || sandbox_status=$?
  825. if (( install_status != 0 )); then exit "$install_status"; fi
  826. exit "$sandbox_status"
  827. - name: Install (immutable)
  828. if: matrix.platform == 'windows'
  829. shell: pwsh
  830. run: pnpm install --frozen-lockfile
  831. - name: Run complete unsharded primary Node CI concurrently
  832. if: matrix.platform == 'linux'
  833. env:
  834. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  835. DSH_ESLINT_CACHE: '1'
  836. DSH_ESLINT_CONCURRENCY: ${{ matrix.workers }}
  837. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  838. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  839. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  840. run: pnpm run check:ci
  841. - name: Run blocking Windows builds concurrently
  842. if: matrix.platform == 'windows'
  843. shell: pwsh
  844. env:
  845. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  846. run: pnpm run check:ci:windows-blocking
  847. # Single stable required check for branch protection: require "all checks
  848. # passed" instead of enumerating matrix legs whose names change as lanes and
  849. # node versions evolve. Every blocking job in THIS workflow must be listed in
  850. # `needs`; observational Windows gates share the required Windows job but are
  851. # marked non-blocking inside run-gates. (`needs` cannot reach across workflow
  852. # files; e2e.yml stays its own check.)
  853. # `if: always()` is load-bearing: without it a failed dependency
  854. # would SKIP this job, and GitHub counts a skipped required check as passing
  855. # — so this job always runs and fails on any non-success result, including
  856. # 'cancelled' and 'skipped'.
  857. all-checks-passed:
  858. name: all checks passed
  859. # This bookkeeping-only verdict must not depend on custom-pool
  860. # provisioning (master's #734 moved it to ubuntu-latest) — and under
  861. # failover it follows the same selector as the worker jobs it
  862. # aggregates, so a standard-hosted outage cannot strand the
  863. # branch-protection verdict either (observed 2026-07-27).
  864. runs-on: >-
  865. ${{ vars.DSH_CI_FAILOVER == 'selfhosted'
  866. && github.event.pull_request.user.login != 'dependabot[bot]'
  867. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  868. || 'ubuntu-latest' }}
  869. needs: [node-24, node-24-coverage, node-24-consumers, node-compat, python-sdk, windows]
  870. if: always() && github.event_name == 'pull_request'
  871. steps:
  872. - name: Fail if any needed job did not succeed
  873. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  874. run: |
  875. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  876. exit 1
  877. - name: All checks passed
  878. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"