ci.yml 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990
  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
  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. Direct tool entrypoints stand in for pnpm's cmd
  300. # shims, which a Linux-side install does not create; layout, fidelity
  301. # limits, and measured timings live in
  302. # .agents/notes/implemented/process/2026-07-27-wine-windows-gates-experiment.md
  303. windows:
  304. if: github.event_name == 'pull_request'
  305. runs-on: ubuntu-latest
  306. name: windows node 24 / wine blocking
  307. timeout-minutes: 15
  308. env:
  309. WINEDEBUG: '-all'
  310. WINEARCH: win64
  311. # Skip Wine Mono / Gecko installers: Node needs neither.
  312. WINEDLLOVERRIDES: 'mscoree,mshtml='
  313. steps:
  314. - uses: actions/checkout@v6
  315. with:
  316. persist-credentials: false
  317. - uses: pnpm/action-setup@v4
  318. - uses: actions/setup-node@v6
  319. with:
  320. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  321. - name: Configure pnpm store path
  322. id: pnpm-store
  323. run: |
  324. store_root="$HOME/.local/share/pnpm/store"
  325. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  326. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  327. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  328. - uses: actions/cache/restore@v4
  329. with:
  330. path: ${{ steps.pnpm-store.outputs.path }}
  331. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  332. restore-keys: |
  333. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  334. # Master's wine-apt-cache job seeds the default-branch scope every pull
  335. # request can read; a save from this job only reaches reruns of the
  336. # same merge ref.
  337. - name: Compose Wine apt cache key
  338. id: wine-cache-key
  339. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  340. - uses: actions/cache@v4
  341. with:
  342. path: ~/wine-debs
  343. key: ${{ steps.wine-cache-key.outputs.key }}
  344. - name: Install dependencies and provision Wine concurrently
  345. run: |
  346. # Windows-lane install-time overrides. supportedArchitectures
  347. # additionally materializes the win32-x64 platform packages
  348. # (@esbuild/win32-x64, rolldown and rollup MSVC bindings) the
  349. # Windows toolchain resolves at runtime; nodeLinker: hoisted lays
  350. # node_modules out flat with real files because Windows Node under
  351. # Wine does not realpath pnpm's isolated-layout symlinks. Neither
  352. # override is recorded in the lockfile, so --frozen-lockfile stays
  353. # valid. --ignore-scripts skips Linux lifecycle scripts no gate in
  354. # this lane loads; the win32 binaries ship prebuilt.
  355. cat >> pnpm-workspace.yaml <<'EOF'
  356. nodeLinker: hoisted
  357. supportedArchitectures:
  358. os: [current, win32]
  359. cpu: [current, x64]
  360. EOF
  361. pnpm install --frozen-lockfile --ignore-scripts &
  362. install_pid=$!
  363. provision_wine() {
  364. set -euo pipefail
  365. # Wine from the apt cache when present; else download the full
  366. # dependency closure once and keep it for the next run. The
  367. # `wine` dispatcher package (not bare `wine64`) is what puts a
  368. # binary on PATH.
  369. if compgen -G "$HOME/wine-debs/*.deb" > /dev/null; then
  370. sudo apt-get install -y --no-install-recommends "$HOME"/wine-debs/*.deb
  371. else
  372. sudo apt-get update
  373. sudo apt-get install -y --no-install-recommends --download-only wine
  374. mkdir -p "$HOME/wine-debs"
  375. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/" 2>/dev/null || true
  376. sudo apt-get install -y --no-install-recommends wine
  377. fi
  378. WINE_BIN=''
  379. for candidate in "$(command -v wine || true)" "$(command -v wine64 || true)" /usr/lib/wine/wine64; do
  380. if [ -n "$candidate" ] && [ -x "$candidate" ]; then WINE_BIN="$candidate"; break; fi
  381. done
  382. [ -n "$WINE_BIN" ] || { echo '::error::no wine binary found after install'; exit 1; }
  383. echo "WINE_BIN=$WINE_BIN" >> "$GITHUB_ENV"
  384. # Windows Node for the repo's primary line, checksum-verified
  385. # against the same dist directory.
  386. version=$(curl -fsSL https://nodejs.org/dist/index.json \
  387. | jq -r --arg p "v${PRIMARY_NODE_VERSION}." '[.[] | select(.version | startswith($p))][0].version')
  388. echo "Windows Node: $version"
  389. curl -fsSL -o "$RUNNER_TEMP/node-win.zip" \
  390. "https://nodejs.org/dist/${version}/node-${version}-win-x64.zip"
  391. curl -fsSL "https://nodejs.org/dist/${version}/SHASUMS256.txt" \
  392. | awk -v a="node-${version}-win-x64.zip" '$2 == a { print $1 " '"$RUNNER_TEMP"'/node-win.zip" }' \
  393. | sha256sum --check -
  394. unzip -q "$RUNNER_TEMP/node-win.zip" -d "$RUNNER_TEMP/node-win"
  395. echo "NODE_WIN=$RUNNER_TEMP/node-win/node-${version}-win-x64/node.exe" >> "$GITHUB_ENV"
  396. "$WINE_BIN" wineboot --init || true
  397. wineserver -w || true
  398. }
  399. provision_wine &
  400. wine_pid=$!
  401. install_status=0
  402. wait "$install_pid" || install_status=$?
  403. wine_status=0
  404. wait "$wine_pid" || wine_status=$?
  405. if (( install_status != 0 )); then exit "$install_status"; fi
  406. exit "$wine_status"
  407. - name: Resolve entrypoints, link vue, smoke Windows Node
  408. run: |
  409. # Node under Wine cannot attach stdio to the Actions runner's pipes
  410. # (Socket open EBADF at bootstrap), so every invocation runs through
  411. # this wrapper: stdio to a regular file, replayed after exit.
  412. cat > "$RUNNER_TEMP/wine-node.sh" <<'SH'
  413. #!/usr/bin/env bash
  414. set -u
  415. log="$1"; shift
  416. "$WINE_BIN" "$NODE_WIN" "$@" < /dev/null > "$log" 2>&1
  417. status=$?
  418. tail -n 300 "$log"
  419. exit "$status"
  420. SH
  421. chmod +x "$RUNNER_TEMP/wine-node.sh"
  422. resolve() {
  423. local name="$1"; shift
  424. for p in "$@"; do
  425. if [ -f "$p" ]; then echo "$name=$PWD/$p" >> "$GITHUB_ENV"; return 0; fi
  426. done
  427. echo "::error::$name not found at any of: $*"; return 1
  428. }
  429. resolve TSC_JS node_modules/typescript/bin/tsc
  430. resolve TSDOWN_JS node_modules/tsdown/dist/run.mjs
  431. resolve VITEPRESS_JS website/node_modules/vitepress/bin/vitepress.js node_modules/vitepress/bin/vitepress.js
  432. # VitePress links vue into the site's node_modules at build time;
  433. # Wine cannot CREATE Windows symlinks (ENOTSUP) but follows
  434. # pre-existing Unix ones, so lay the link down host-side.
  435. if [ -d node_modules/vue ] && [ ! -e website/node_modules/vue ]; then
  436. mkdir -p website/node_modules
  437. ln -s ../../node_modules/vue website/node_modules/vue
  438. fi
  439. "$RUNNER_TEMP/wine-node.sh" "$RUNNER_TEMP/smoke.log" -p "'smoke: ' + process.platform + ' ' + process.arch + ' ' + process.version"
  440. # The two blocking surfaces run concurrently, the same shape run-gates
  441. # gives ci-windows-blocking on native Windows: `build` = tsc -b then
  442. # tsdown, `production site` = the VitePress build. Both statuses are
  443. # captured so one failure cannot hide the other's result.
  444. - name: Run blocking Windows gates concurrently under Wine
  445. run: |
  446. build_gate() {
  447. "$RUNNER_TEMP/wine-node.sh" "$RUNNER_TEMP/tsc.log" "$TSC_JS" -b --pretty false || return $?
  448. "$RUNNER_TEMP/wine-node.sh" "$RUNNER_TEMP/tsdown.log" "$TSDOWN_JS"
  449. }
  450. site_gate() {
  451. cd website
  452. "$RUNNER_TEMP/wine-node.sh" "$RUNNER_TEMP/site.log" "$VITEPRESS_JS" build .
  453. }
  454. start=$SECONDS
  455. build_gate > "$RUNNER_TEMP/build-gate.out" 2>&1 &
  456. build_pid=$!
  457. site_gate > "$RUNNER_TEMP/site-gate.out" 2>&1 &
  458. site_pid=$!
  459. build_status=0
  460. wait "$build_pid" || build_status=$?
  461. site_status=0
  462. wait "$site_pid" || site_status=$?
  463. echo "== build gate (exit $build_status, $((SECONDS - start))s elapsed) =="
  464. tail -n 120 "$RUNNER_TEMP/build-gate.out"
  465. echo "== production site gate (exit $site_status, $((SECONDS - start))s elapsed) =="
  466. tail -n 120 "$RUNNER_TEMP/site-gate.out"
  467. if (( build_status != 0 )); then exit "$build_status"; fi
  468. exit "$site_status"
  469. - name: Shut down wineserver
  470. if: always()
  471. run: wineserver -k 2>/dev/null || true
  472. # Master seeds the Wine apt-archive cache in the default-branch scope,
  473. # which every pull request's windows job can restore; saves from
  474. # pull-request runs are scoped to their own merge ref and help nobody
  475. # else. Runs in seconds when the image version already has a cache.
  476. wine-apt-cache:
  477. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  478. name: wine apt cache
  479. runs-on: ubuntu-latest
  480. timeout-minutes: 10
  481. steps:
  482. - name: Compose Wine apt cache key
  483. id: wine-cache-key
  484. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  485. - uses: actions/cache@v4
  486. id: wine-cache
  487. with:
  488. path: ~/wine-debs
  489. key: ${{ steps.wine-cache-key.outputs.key }}
  490. - name: Download the Wine dependency closure
  491. if: steps.wine-cache.outputs.cache-hit != 'true'
  492. run: |
  493. sudo apt-get update
  494. sudo apt-get install -y --no-install-recommends --download-only wine
  495. mkdir -p "$HOME/wine-debs"
  496. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/"
  497. du -sh "$HOME/wine-debs"
  498. # Master pushes run only the serial reference jobs below.
  499. # Each host executes the complete, unsharded primary Node aggregate with one
  500. # gate worker, giving reviewers a simple cross-platform oracle for completeness
  501. # and timing.
  502. serial-linux:
  503. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  504. name: serial / linux
  505. runs-on: ubuntu-latest
  506. steps:
  507. - uses: actions/checkout@v6
  508. with:
  509. fetch-depth: 2
  510. - uses: pnpm/action-setup@v4
  511. - uses: actions/setup-node@v6
  512. with:
  513. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  514. - name: Configure pnpm store path
  515. id: pnpm-store
  516. run: |
  517. store_root="$HOME/.local/share/pnpm/store"
  518. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  519. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  520. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  521. # Master refreshes the caches that pull requests restore without saving.
  522. # The store cache stays a hand-rolled actions/cache step rather than
  523. # setup-node's `cache: pnpm`: the enterprise pull-request jobs above
  524. # restore exactly this key and path, and setup-node's built-in cache
  525. # uses its own key format — converting this producer would silently
  526. # starve their documented restore-only optimization.
  527. - uses: actions/cache@v4
  528. with:
  529. path: ${{ steps.pnpm-store.outputs.path }}
  530. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  531. restore-keys: |
  532. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  533. - uses: actions/cache@v4
  534. with:
  535. path: .cache/eslint
  536. 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') }}
  537. restore-keys: |
  538. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-
  539. - name: Install (immutable)
  540. run: pnpm install --frozen-lockfile
  541. - name: Prepare bubblewrap (unrestrict userns)
  542. run: bash scripts/prepare-ci-bubblewrap.sh
  543. - name: Run complete unsharded primary Node CI serially
  544. env:
  545. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  546. DSH_COVERAGE_MAX_WORKERS: '1'
  547. DSH_E2E_MAX_WORKERS: '1'
  548. DSH_ESLINT_CACHE: '1'
  549. DSH_GATE_CONCURRENCY: '1'
  550. DSH_PUBLINT_CONCURRENCY: '1'
  551. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  552. run: pnpm run check:ci
  553. # Hot-standby drill for the in-house self-hosted pool: every master move
  554. # re-runs the complete unsharded aggregate on the persistent 64-core VM,
  555. # continuously proving that environment can take over a required lane if
  556. # the hosted pools degrade (the switch is then setting the writer-manageable
  557. # DSH_CI_FAILOVER variable — see the failover runbook, no merge required).
  558. # Push-triggered, so this lane always executes the base branch's own
  559. # workflow definition. (Under failover, pull_request jobs do reach these
  560. # runners with the PR merge ref's workflow — the boundary there is
  561. # repository membership: private, forking disabled, Dependabot excluded.)
  562. # Non-blocking for
  563. # pull requests; no cache steps because the VM's persistent pnpm store and
  564. # tool caches make them redundant (and saving here would poison the hosted
  565. # cache namespace with self-hosted paths).
  566. serial-linux-selfhosted:
  567. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  568. name: serial / linux (self-hosted standby)
  569. runs-on: [self-hosted, linux, x64, vm-backup]
  570. steps:
  571. # Full history + DSH_ARCHIVE_BASE_REF below: same frozen-archive
  572. # comparison as serial-linux. Depth 2 would miss github.event.before
  573. # on multi-commit or force pushes; full fetch is cheap here because
  574. # checkout resolves against the VM's local mirror.
  575. - uses: actions/checkout@v6
  576. with:
  577. fetch-depth: 0
  578. - uses: pnpm/action-setup@v4
  579. - uses: actions/setup-node@v6
  580. with:
  581. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  582. - name: Configure persistent pnpm store
  583. run: echo "PNPM_CONFIG_STORE_DIR=$HOME/.local/share/pnpm/store" >> "$GITHUB_ENV"
  584. - name: Install (immutable)
  585. run: pnpm install --frozen-lockfile
  586. - name: Prepare bubblewrap (unrestrict userns)
  587. run: bash scripts/prepare-ci-bubblewrap.sh
  588. - name: Run complete unsharded primary Node CI serially
  589. env:
  590. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  591. DSH_COVERAGE_MAX_WORKERS: '1'
  592. DSH_E2E_MAX_WORKERS: '1'
  593. DSH_ESLINT_CACHE: '1'
  594. DSH_GATE_CONCURRENCY: '1'
  595. DSH_PUBLINT_CONCURRENCY: '1'
  596. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  597. run: pnpm run check:ci
  598. serial-macos:
  599. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  600. name: serial / macos
  601. runs-on: macos-latest
  602. steps:
  603. - uses: actions/checkout@v6
  604. - uses: pnpm/action-setup@v4
  605. - uses: actions/setup-node@v6
  606. with:
  607. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  608. - name: Install (immutable)
  609. run: pnpm install --frozen-lockfile
  610. - name: Run complete unsharded primary Node CI serially
  611. env:
  612. DSH_COVERAGE_MAX_WORKERS: '1'
  613. DSH_E2E_MAX_WORKERS: '1'
  614. DSH_GATE_CONCURRENCY: '1'
  615. DSH_PUBLINT_CONCURRENCY: '1'
  616. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  617. run: pnpm run check:ci
  618. serial-windows:
  619. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  620. name: serial / windows
  621. runs-on: windows-2025
  622. steps:
  623. - uses: actions/checkout@v6
  624. - name: Enable Developer Mode (symlink support)
  625. shell: pwsh
  626. run: >-
  627. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  628. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  629. - uses: pnpm/action-setup@v4
  630. - uses: actions/setup-node@v6
  631. with:
  632. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  633. # Master refreshes the small cache that pull requests restore without
  634. # putting package-store extraction back on the Windows critical path.
  635. - uses: actions/cache@v4
  636. with:
  637. path: .cache/eslint
  638. 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') }}
  639. restore-keys: |
  640. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-
  641. - name: Install (immutable)
  642. shell: pwsh
  643. run: pnpm install --frozen-lockfile
  644. - name: Run complete unsharded primary Node CI serially
  645. shell: pwsh
  646. env:
  647. DSH_COVERAGE_MAX_WORKERS: '1'
  648. DSH_E2E_MAX_WORKERS: '1'
  649. DSH_ESLINT_CACHE: '1'
  650. DSH_GATE_CONCURRENCY: '1'
  651. DSH_PUBLINT_CONCURRENCY: '1'
  652. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  653. run: pnpm run check:ci
  654. # Manual, bounded comparison of the actual critical Linux and Windows lanes.
  655. # The named pools are restricted at the organization level to this repository.
  656. larger-runner-benchmark:
  657. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'larger-runner-benchmark'
  658. runs-on: ${{ matrix.runner }}
  659. timeout-minutes: 15
  660. strategy:
  661. fail-fast: false
  662. max-parallel: 12
  663. matrix:
  664. include:
  665. - platform: linux
  666. cores: '4'
  667. runner: dsh-ubuntu-24-04-4core
  668. workload: typecheck
  669. - platform: linux
  670. cores: '8'
  671. runner: dsh-ubuntu-24-04-8core
  672. workload: typecheck
  673. - platform: linux
  674. cores: '16'
  675. runner: dsh-ubuntu-24-04-16core
  676. workload: typecheck
  677. - platform: linux
  678. cores: '32'
  679. runner: dsh-ubuntu-24-04-32core
  680. workload: typecheck
  681. - platform: linux
  682. cores: '64'
  683. runner: dsh-ubuntu-24-04-64core
  684. workload: typecheck
  685. - platform: linux
  686. cores: '96'
  687. runner: dsh-ubuntu-24-04-96core
  688. workload: typecheck
  689. - platform: windows
  690. cores: '4'
  691. runner: dsh-windows-2025-4core
  692. workload: production-site
  693. - platform: windows
  694. cores: '8'
  695. runner: dsh-windows-2025-8core
  696. workload: production-site
  697. - platform: windows
  698. cores: '16'
  699. runner: dsh-windows-2025-16core
  700. workload: production-site
  701. - platform: windows
  702. cores: '32'
  703. runner: dsh-windows-2025-32core
  704. workload: production-site
  705. - platform: windows
  706. cores: '64'
  707. runner: dsh-windows-2025-64core
  708. workload: production-site
  709. - platform: windows
  710. cores: '96'
  711. runner: dsh-windows-2025-96core
  712. workload: production-site
  713. steps:
  714. - uses: actions/checkout@v6
  715. - uses: pnpm/action-setup@v4
  716. # The Windows lanes deliberately skip the store cache like the required
  717. # windows job; an empty cache input disables setup-node's caching.
  718. - uses: actions/setup-node@v6
  719. with:
  720. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  721. cache: ${{ matrix.platform == 'linux' && 'pnpm' || '' }}
  722. - name: Report runner capacity
  723. run: >-
  724. node -e "const os = require('node:os');
  725. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  726. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  727. - name: Install (immutable)
  728. run: pnpm install --frozen-lockfile
  729. - name: Run critical Linux typecheck lane
  730. if: matrix.platform == 'linux'
  731. run: pnpm run typecheck
  732. - name: Run critical Windows production-site lane
  733. if: matrix.platform == 'windows'
  734. run: pnpm run docs:build
  735. # Manual comparison of the intended low-fanout topology. Linux runs the
  736. # complete unsharded primary aggregate with bounded in-runner parallelism;
  737. # Windows runs both blocking build surfaces concurrently through run-gates.
  738. consolidated-runner-benchmark:
  739. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  740. runs-on: ${{ matrix.runner }}
  741. timeout-minutes: 15
  742. strategy:
  743. fail-fast: false
  744. max-parallel: 12
  745. matrix:
  746. include:
  747. - platform: linux
  748. cores: '4'
  749. runner: dsh-ubuntu-24-04-4core
  750. workers: '4'
  751. - platform: linux
  752. cores: '8'
  753. runner: dsh-ubuntu-24-04-8core
  754. workers: '8'
  755. - platform: linux
  756. cores: '16'
  757. runner: dsh-ubuntu-24-04-16core
  758. workers: '16'
  759. - platform: linux
  760. cores: '32'
  761. runner: dsh-ubuntu-24-04-32core
  762. workers: '32'
  763. - platform: linux
  764. cores: '64'
  765. runner: dsh-ubuntu-24-04-64core
  766. workers: '32'
  767. - platform: linux
  768. cores: '96'
  769. runner: dsh-ubuntu-24-04-96core
  770. workers: '32'
  771. - platform: windows
  772. cores: '4'
  773. runner: dsh-windows-2025-4core
  774. workers: '2'
  775. - platform: windows
  776. cores: '8'
  777. runner: dsh-windows-2025-8core
  778. workers: '2'
  779. - platform: windows
  780. cores: '16'
  781. runner: dsh-windows-2025-16core
  782. workers: '2'
  783. - platform: windows
  784. cores: '32'
  785. runner: dsh-windows-2025-32core
  786. workers: '2'
  787. - platform: windows
  788. cores: '64'
  789. runner: dsh-windows-2025-64core
  790. workers: '2'
  791. - platform: windows
  792. cores: '96'
  793. runner: dsh-windows-2025-96core
  794. workers: '2'
  795. steps:
  796. - uses: actions/checkout@v6
  797. - uses: pnpm/action-setup@v4
  798. # Unlike the larger-runner suite, both platforms cache the store here:
  799. # the consolidated topology measures cache mechanics as workload.
  800. - uses: actions/setup-node@v6
  801. with:
  802. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  803. cache: pnpm
  804. - name: Report runner capacity
  805. run: >-
  806. node -e "const os = require('node:os');
  807. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  808. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  809. - uses: actions/cache@v4
  810. if: matrix.platform == 'linux'
  811. with:
  812. path: .cache/eslint
  813. 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') }}
  814. restore-keys: |
  815. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-
  816. - name: Install and prepare Linux
  817. if: matrix.platform == 'linux'
  818. run: |
  819. pnpm install --frozen-lockfile &
  820. install_pid=$!
  821. bash scripts/prepare-ci-bubblewrap.sh &
  822. sandbox_pid=$!
  823. install_status=0
  824. wait "$install_pid" || install_status=$?
  825. sandbox_status=0
  826. wait "$sandbox_pid" || sandbox_status=$?
  827. if (( install_status != 0 )); then exit "$install_status"; fi
  828. exit "$sandbox_status"
  829. - name: Install (immutable)
  830. if: matrix.platform == 'windows'
  831. shell: pwsh
  832. run: pnpm install --frozen-lockfile
  833. - name: Run complete unsharded primary Node CI concurrently
  834. if: matrix.platform == 'linux'
  835. env:
  836. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  837. DSH_ESLINT_CACHE: '1'
  838. DSH_ESLINT_CONCURRENCY: ${{ matrix.workers }}
  839. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  840. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  841. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  842. run: pnpm run check:ci
  843. - name: Run blocking Windows builds concurrently
  844. if: matrix.platform == 'windows'
  845. shell: pwsh
  846. env:
  847. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  848. run: pnpm run check:ci:windows-blocking
  849. # Single stable required check for branch protection: require "all checks
  850. # passed" instead of enumerating matrix legs whose names change as lanes and
  851. # node versions evolve. Every blocking job in THIS workflow must be listed in
  852. # `needs`; observational Windows gates share the required Windows job but are
  853. # marked non-blocking inside run-gates. (`needs` cannot reach across workflow
  854. # files; e2e.yml stays its own check.)
  855. # `if: always()` is load-bearing: without it a failed dependency
  856. # would SKIP this job, and GitHub counts a skipped required check as passing
  857. # — so this job always runs and fails on any non-success result, including
  858. # 'cancelled' and 'skipped'.
  859. all-checks-passed:
  860. name: all checks passed
  861. # This bookkeeping-only verdict must not depend on custom-pool
  862. # provisioning (master's #734 moved it to ubuntu-latest) — and under
  863. # failover it follows the same selector as the worker jobs it
  864. # aggregates, so a standard-hosted outage cannot strand the
  865. # branch-protection verdict either (observed 2026-07-27).
  866. runs-on: >-
  867. ${{ vars.DSH_CI_FAILOVER == 'selfhosted'
  868. && github.event.pull_request.user.login != 'dependabot[bot]'
  869. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  870. || 'ubuntu-latest' }}
  871. needs: [node-24, node-24-coverage, node-24-consumers, node-compat, python-sdk, windows]
  872. if: always() && github.event_name == 'pull_request'
  873. steps:
  874. - name: Fail if any needed job did not succeed
  875. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  876. run: |
  877. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  878. exit 1
  879. - name: All checks passed
  880. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"