ci.yml 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. name: CI
  2. on:
  3. pull_request:
  4. permissions:
  5. contents: read
  6. env:
  7. PRIMARY_NODE_VERSION: '24'
  8. # CI runs must never report to the production telemetry endpoint baked
  9. # into apps/cli/cordis.yml (AppCLIEntry disables the row when set).
  10. DSH_TELEMETRY_DISABLED: '1'
  11. # Cancel a superseded pull-request run on a new push so a fresh head does not
  12. # queue a second full 9-job run behind a stale one (paid enterprise runners
  13. # would otherwise stack with no auto-cancellation).
  14. concurrency:
  15. group: ${{ github.workflow }}-${{ github.ref }}
  16. cancel-in-progress: true
  17. jobs:
  18. # Three enterprise jobs isolate coverage, static analysis, and the
  19. # build-backed consumer tail. The consumer job owns the only Linux build so
  20. # all three jobs enter runner allocation independently.
  21. #
  22. # FAILOVER (Linux): each Linux enterprise job resolves its pool through the
  23. # DSH_CI_FAILOVER_LINUX repository variable. Unset (normal), the expressions
  24. # pick the hosted enterprise pools below. Setting the variable to
  25. # 'selfhosted' (repo Settings → Actions → Variables; writer-manageable
  26. # repository state — not PR-editable, no merge required) retargets all
  27. # three onto the in-house
  28. # vm-backup pool and re-running the failed jobs is the entire switch —
  29. # see .agents/notes/implemented/process/2026-07-26-ci-failover-runbook.md.
  30. # Setting the variable to 'blacksmith' instead routes the same jobs onto
  31. # Blacksmith's hosted runners at the matching vCPU size (see
  32. # .agents/notes/implemented/process/2026-09-09-blacksmith-failover-leg.md). The
  33. # in-house pool's readiness is re-proven on every master push by the
  34. # serial-linux-selfhosted standby lane in ci-master.yml. The Windows failover
  35. # switch is the separate DSH_CI_FAILOVER_WINDOWS variable on the windows-native
  36. # job below.
  37. node-24:
  38. if: github.event_name == 'pull_request'
  39. runs-on: >-
  40. ${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-16vcpu-ubuntu-2404'
  41. || vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  42. && github.event.pull_request.user.login != 'dependabot[bot]'
  43. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  44. || 'dsh-ubuntu-24-04-16core' }}
  45. name: node 24 / static
  46. env:
  47. DSH_GATE_CONCURRENCY: '8'
  48. # Stop the aggregate at the first blocking gate failure so a red run
  49. # does not keep burning enterprise runner time on the remaining gates.
  50. DSH_GATE_FAIL_FAST: '1'
  51. steps:
  52. # Runner cleanup owns tool caches and fixtures, including cancelled runs.
  53. - name: Use runner-owned temporary storage
  54. run: |
  55. echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"
  56. # Fetch complete history so the archive gate can read the trusted PR base from a reused shallow checkout.
  57. - uses: actions/checkout@v6
  58. with:
  59. fetch-depth: 0
  60. persist-credentials: false
  61. # Redirect the Node compile cache (enabled by pnpm and TypeScript) off
  62. # the root partition's /tmp before the first pnpm call in this lane —
  63. # see .agents/notes/implemented/process/2026-08-28-ci-node-compile-cache-data-disk.md.
  64. - name: Redirect Node compile cache to runner temp
  65. run: echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"
  66. - uses: pnpm/action-setup@v4
  67. with:
  68. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  69. - uses: actions/setup-node@v6
  70. with:
  71. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  72. - name: Configure pnpm store path
  73. id: pnpm-store
  74. run: |
  75. store_root="$HOME/.local/share/pnpm/store"
  76. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  77. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  78. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  79. # Pull requests consume the default-branch cache but do not put cache
  80. # compression and upload on the paid latency-critical path. Skipped
  81. # under failover — see the coverage lane's identical rationale.
  82. - uses: actions/cache/restore@v4
  83. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  84. with:
  85. path: ${{ steps.pnpm-store.outputs.path }}
  86. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  87. restore-keys: |
  88. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  89. - name: Install (immutable)
  90. run: pnpm install --frozen-lockfile
  91. - name: Run static gates
  92. env:
  93. DSH_ARCHIVE_BASE_REF: ${{ github.event.pull_request.base.sha }}
  94. run: pnpm run check:ci:static
  95. node-24-coverage:
  96. if: github.event_name == 'pull_request'
  97. runs-on: >-
  98. ${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-16vcpu-ubuntu-2404'
  99. || vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  100. && github.event.pull_request.user.login != 'dependabot[bot]'
  101. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  102. || 'dsh-ubuntu-24-04-16core' }}
  103. name: node 24 / coverage
  104. env:
  105. # Partitioning replaces the instrumented share; this budget gives the
  106. # exempt-heavy gate two workers on both hosted and failover runners.
  107. DSH_COVERAGE_MAX_WORKERS: '6'
  108. DSH_COVERAGE_PARTITIONS: '4'
  109. DSH_GATE_CONCURRENCY: '3'
  110. # Managed-scope teardown cases run past the default per-test budget when
  111. # this lane's partitions, workers, and sibling gates share one host: the
  112. # disposal cases in subprocess-local and bash-sandbox exceeded 5000ms on
  113. # the hosted image (run 34449848541) while the same commit stayed inside
  114. # the budget on the in-house pool; the lane is green with this value
  115. # (run 34457655892). The Windows coverage lane grants the same budget for
  116. # the same reason.
  117. DSH_COVERAGE_TEST_TIMEOUT_MS: '90000'
  118. # A gate failure aborts the sibling gate instead of waiting out its
  119. # multi-minute instrumented run.
  120. DSH_GATE_FAIL_FAST: '1'
  121. steps:
  122. # Runner cleanup owns tool caches and fixtures, including cancelled runs.
  123. - name: Use runner-owned temporary storage
  124. run: |
  125. echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"
  126. - uses: actions/checkout@v6
  127. with:
  128. persist-credentials: false
  129. # Redirect the Node compile cache (enabled by pnpm and TypeScript) off
  130. # the root partition's /tmp before the first pnpm call in this lane —
  131. # see .agents/notes/implemented/process/2026-08-28-ci-node-compile-cache-data-disk.md.
  132. - name: Redirect Node compile cache to runner temp
  133. run: echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"
  134. - uses: pnpm/action-setup@v4
  135. with:
  136. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  137. - uses: actions/setup-node@v6
  138. with:
  139. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  140. - name: Configure pnpm store path
  141. id: pnpm-store
  142. run: |
  143. store_root="$HOME/.local/share/pnpm/store"
  144. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  145. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  146. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  147. # Self-hosted runners reuse the shared persistent pnpm store.
  148. # Hosted runners restore the remote cache into their ephemeral store.
  149. - uses: actions/cache/restore@v4
  150. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  151. with:
  152. path: ${{ steps.pnpm-store.outputs.path }}
  153. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  154. restore-keys: |
  155. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  156. - name: Install dependencies and prepare bubblewrap
  157. run: |
  158. pnpm install --frozen-lockfile &
  159. install_pid=$!
  160. bash scripts/prepare-ci-bubblewrap.sh &
  161. sandbox_pid=$!
  162. install_status=0
  163. wait "$install_pid" || install_status=$?
  164. sandbox_status=0
  165. wait "$sandbox_pid" || sandbox_status=$?
  166. if (( install_status != 0 )); then exit "$install_status"; fi
  167. exit "$sandbox_status"
  168. - name: Run exhaustive coverage
  169. run: pnpm run check:ci:coverage
  170. node-24-bench:
  171. if: github.event_name == 'pull_request'
  172. runs-on: ubuntu-24.04
  173. name: node 24 / benchmarks
  174. # Wall-clock budgets need an otherwise idle runner, so this job runs the
  175. # benchmark lane alone instead of joining a concurrent gate aggregate.
  176. timeout-minutes: 15
  177. steps:
  178. - uses: actions/checkout@v6
  179. with:
  180. persist-credentials: false
  181. - uses: pnpm/action-setup@v4
  182. with:
  183. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  184. - uses: actions/setup-node@v6
  185. with:
  186. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  187. - name: Configure pnpm store path
  188. id: pnpm-store
  189. run: |
  190. store_root="$HOME/.local/share/pnpm/store"
  191. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  192. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  193. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  194. - uses: actions/cache/restore@v4
  195. with:
  196. path: ${{ steps.pnpm-store.outputs.path }}
  197. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  198. restore-keys: |
  199. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  200. - name: Install (immutable)
  201. run: pnpm install --frozen-lockfile
  202. - name: Install benchmark browser and hosted dependencies
  203. run: pnpm --filter @deepseek-ai/dsh-benchmarks exec playwright install --with-deps chromium
  204. - name: Run performance benchmarks
  205. env:
  206. DSH_GATE_VERBOSE: '1'
  207. run: pnpm run check:ci:bench
  208. node-24-consumers:
  209. if: github.event_name == 'pull_request'
  210. runs-on: >-
  211. ${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-16vcpu-ubuntu-2404'
  212. || vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  213. && github.event.pull_request.user.login != 'dependabot[bot]'
  214. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  215. || 'dsh-ubuntu-24-04-16core' }}
  216. name: node 24 / snapshots and artifacts
  217. env:
  218. DSH_GATE_CONCURRENCY: '10'
  219. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  220. DSH_OXLINT_THREADS: '8'
  221. DSH_PUBLINT_CONCURRENCY: '8'
  222. DSH_WEB_SNAPSHOT_WORKERS: '6'
  223. # A failing gate aborts its running siblings: a failing build stops the
  224. # independent Node compatibility smoke, and a failing reader (e.g.
  225. # publint) stops the remaining artifact consumers.
  226. DSH_GATE_FAIL_FAST: '1'
  227. # Failover halves snapshot concurrency for the shared 64-core VM.
  228. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '12' || '32' }}
  229. steps:
  230. # Runner cleanup owns tool caches and fixtures, including cancelled runs.
  231. - name: Use runner-owned temporary storage
  232. run: |
  233. echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"
  234. echo "PLAYWRIGHT_BROWSERS_PATH=${RUNNER_TEMP%/*}/ms-playwright" >> "$GITHUB_ENV"
  235. - uses: actions/checkout@v6
  236. with:
  237. persist-credentials: false
  238. # Redirect the Node compile cache (enabled by pnpm and TypeScript) off
  239. # the root partition's /tmp before the first pnpm call in this lane —
  240. # see .agents/notes/implemented/process/2026-08-28-ci-node-compile-cache-data-disk.md.
  241. - name: Redirect Node compile cache to runner temp
  242. run: echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"
  243. - uses: pnpm/action-setup@v4
  244. with:
  245. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  246. - uses: actions/setup-node@v6
  247. with:
  248. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  249. - name: Configure pnpm store path
  250. id: pnpm-store
  251. run: |
  252. store_root="$HOME/.local/share/pnpm/store"
  253. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  254. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  255. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  256. # Pull requests restore the pnpm store and Playwright caches without paying
  257. # compression and upload on the required path. No master job saves these
  258. # hosted cache keys, so each restore-keys fallback hits the matching archived
  259. # entry until it evicts, after which the store is cold. Self-hosted runners
  260. # reuse the shared persistent store instead of restoring the remote archive.
  261. - uses: actions/cache/restore@v4
  262. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  263. with:
  264. path: ${{ steps.pnpm-store.outputs.path }}
  265. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  266. restore-keys: |
  267. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  268. # Self-hosted runners retain their own browser cache between jobs.
  269. - uses: actions/cache/restore@v4
  270. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  271. with:
  272. path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
  273. key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
  274. restore-keys: |
  275. ${{ runner.os }}-playwright-
  276. - name: Install dependencies and prepare bubblewrap
  277. run: |
  278. pnpm install --frozen-lockfile &
  279. install_pid=$!
  280. bash scripts/prepare-ci-bubblewrap.sh &
  281. sandbox_pid=$!
  282. install_status=0
  283. wait "$install_pid" || install_status=$?
  284. sandbox_status=0
  285. wait "$sandbox_pid" || sandbox_status=$?
  286. if (( install_status != 0 )); then exit "$install_status"; fi
  287. exit "$sandbox_status"
  288. # Blacksmith's Ubuntu HTTP archive endpoints can be unreachable while HTTPS works.
  289. - name: Use HTTPS for Ubuntu archives on Blacksmith
  290. if: vars.DSH_CI_FAILOVER_LINUX == 'blacksmith'
  291. run: |
  292. sudo python3 - <<'PY'
  293. from pathlib import Path
  294. import re
  295. apt = Path('/etc/apt')
  296. sources = [apt / 'sources.list', apt / 'blacksmith-ubuntu-mirrors.txt',
  297. *(apt / 'sources.list.d').glob('*.list'),
  298. *(apt / 'sources.list.d').glob('*.sources')]
  299. for source in sources:
  300. if source.is_file():
  301. source.write_text(re.sub(
  302. r'http://((?:[a-z]{2}\.)?archive\.ubuntu\.com|security\.ubuntu\.com)/',
  303. r'https://\1/', source.read_text()))
  304. PY
  305. - name: Install Playwright Chromium and hosted dependencies
  306. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  307. # Ephemeral runner images can carry Ubuntu mirrors whose HTTP endpoints are unreachable.
  308. run: |
  309. sudo find /etc/apt -maxdepth 2 -type f \( -name '*.list' -o -name '*.sources' \) -exec sed -i -E 's@http://([a-z]{2}\.)?archive\.ubuntu\.com/ubuntu@https://archive.ubuntu.com/ubuntu@g; s@http://security\.ubuntu\.com/ubuntu@https://security.ubuntu.com/ubuntu@g' {} +
  310. pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install --with-deps chromium
  311. # The persistent VM image owns Playwright's Linux system packages; do
  312. # not mutate the shared host with apt on every failover run.
  313. - name: Install Playwright Chromium on the failover VM
  314. if: vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]'
  315. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install chromium
  316. - name: Run compatibility, snapshot, and artifact gates
  317. run: pnpm run check:ci:consumers
  318. node-compat:
  319. if: github.event_name == 'pull_request'
  320. # Under the selfhosted leg this job admits only repository-owned PR code
  321. # to the persistent shared VM; the blacksmith branch targets ephemeral
  322. # runners and carries none of those predicates.
  323. runs-on: >-
  324. ${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404'
  325. || vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  326. && github.event.pull_request.head.repo.full_name == github.repository
  327. && github.event.pull_request.head.repo.fork == false
  328. && github.event.pull_request.user.login != 'dependabot[bot]'
  329. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  330. || matrix.runner }}
  331. name: ${{ matrix.name }}
  332. env:
  333. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  334. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  335. # A failed smoke aborts the remaining compatibility gates instead of
  336. # letting the build-backed legs run against an already-red aggregate.
  337. DSH_GATE_FAIL_FAST: '1'
  338. strategy:
  339. fail-fast: false
  340. matrix:
  341. include:
  342. - node: '22.19'
  343. name: node 22.19
  344. runner: ubuntu-latest
  345. gate_concurrency: '1'
  346. # Pinned inside 24.0-24.11.1: those releases carry the v1 internal
  347. # loader while reporting major 24, and every other job tracks the
  348. # latest 24, which is v2. A bare `24` here would retest that same v2.
  349. - node: '24.9'
  350. name: node 24.9
  351. runner: ubuntu-latest
  352. gate_concurrency: '1'
  353. - node: 26
  354. name: node 26
  355. runner: ubuntu-latest
  356. gate_concurrency: '1'
  357. steps:
  358. - uses: actions/checkout@v6
  359. with:
  360. persist-credentials: false
  361. # Shared hosts keep version installs and generated caches inside runner temp.
  362. - name: Isolate compatibility caches
  363. if: runner.environment == 'self-hosted'
  364. run: |
  365. echo "NODE_COMPILE_CACHE=$RUNNER_TEMP/node-compile-cache" >> "$GITHUB_ENV"
  366. echo "npm_config_devdir=$RUNNER_TEMP/node-gyp" >> "$GITHUB_ENV"
  367. echo "PNPM_CONFIG_STORE_DIR=$HOME/.local/share/pnpm/store" >> "$GITHUB_ENV"
  368. - uses: pnpm/action-setup@v4
  369. with:
  370. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  371. - uses: actions/setup-node@v6
  372. env:
  373. # The runner overwrites RUNNER_* step env before starting JavaScript actions.
  374. NODE_OPTIONS: ${{ runner.environment == 'self-hosted' && '--import=./scripts/ci-compatible-toolcache.mjs' || '' }}
  375. with:
  376. node-version: ${{ matrix.node }}
  377. cache: ${{ runner.environment == 'github-hosted' && 'pnpm' || '' }}
  378. package-manager-cache: false
  379. - name: Verify isolated Node installation
  380. if: runner.environment == 'self-hosted'
  381. run: |
  382. node_path=$(node -p process.execPath)
  383. echo "Node executable: $node_path"
  384. case "$node_path" in
  385. "$RUNNER_TEMP/node-compat-toolcache/"*) ;;
  386. *) echo "::error::Node compatibility installation is outside runner temp"; exit 1 ;;
  387. esac
  388. - name: Install (immutable)
  389. run: pnpm install --frozen-lockfile
  390. - name: Prepare bubblewrap (unrestrict userns)
  391. run: bash scripts/prepare-ci-bubblewrap.sh
  392. - name: Run compatibility smokes
  393. env:
  394. DSH_BUILD_CLIENT_PROFILE: official
  395. run: pnpm run check:node-compat
  396. # Kept out of the gate aggregate: the shape a Node release carries only
  397. # changes with the Node version, so this belongs to the version matrix
  398. # rather than to every commit's checks.
  399. - name: Check Loader internal shape detection
  400. run: pnpm exec vitest run packages/boot/app-boot/tests/loader-shape.compat.spec.ts
  401. python-sdk:
  402. if: github.event_name == 'pull_request'
  403. runs-on: ubuntu-latest
  404. name: python 3.10 / keyless SDK
  405. steps:
  406. - uses: actions/checkout@v6
  407. - uses: actions/setup-python@v6.3.0
  408. with:
  409. python-version: '3.10'
  410. cache: pip
  411. - name: Install uv
  412. run: python -m pip install uv==0.11.23
  413. - uses: actions/setup-node@v6
  414. with:
  415. node-version: 24
  416. - name: Test production blame scoring
  417. run: uv run --python 3.10 --with-requirements .github/review-ownership/requirements.txt python -m unittest discover -s .github/review-ownership -p 'test_*.py'
  418. - name: Run complete keyless Python suite
  419. run: uv run --python 3.10 --group test --project python/sdk pytest
  420. # The reusable builder owns each published executable, wheel, clean-install,
  421. # keyless black-box, and trusted real-API path. Linux/Windows x64 block PRs;
  422. # Linux ARM64 and both macOS architectures run in ci-master.yml.
  423. python-runtime:
  424. if: github.event_name == 'pull_request'
  425. name: python runtime / release-shaped matrix
  426. uses: ./.github/workflows/build-exe-for-python-sdk.yml
  427. with:
  428. targets: node24-linux-x64,node24-win-x64
  429. ci: true
  430. secrets:
  431. DEEPSEEK_API_KEY_EXTERNAL: ${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }}
  432. # Every pull request also gets real Windows-kernel signals. The former
  433. # monolithic windows-native job is split into smaller jobs so one slow
  434. # coverage gate does not hold up build/static results, while the total
  435. # per-job process count stays lower. Observational checks are non-blocking.
  436. # Dependabot PRs are excluded from the self-hosted pool and stay queued for
  437. # the hosted runner.
  438. windows-build:
  439. if: github.event_name == 'pull_request'
  440. runs-on: >-
  441. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith' && 'blacksmith-16vcpu-windows-2025'
  442. || vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  443. && github.event.pull_request.user.login != 'dependabot[bot]'
  444. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  445. || 'dsh-windows-2025-16core' }}
  446. name: windows node 24 / build
  447. timeout-minutes: 60
  448. env:
  449. # A failing build or site aborts the sibling gate on the same runner.
  450. DSH_GATE_FAIL_FAST: '1'
  451. steps:
  452. - uses: actions/checkout@v6
  453. with:
  454. persist-credentials: false
  455. - name: Enable Developer Mode (symlink support)
  456. shell: pwsh
  457. run: >-
  458. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  459. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  460. - uses: pnpm/action-setup@v4
  461. with:
  462. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  463. - uses: actions/setup-node@v6
  464. with:
  465. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  466. - name: Install (immutable)
  467. shell: pwsh
  468. # See 2026-08-30-windows-refs-store-block-clone-install for the
  469. # ReFS block-clone rationale; detect the workspace filesystem and
  470. # pass --package-import-method=clone only on ReFS.
  471. run: >-
  472. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  473. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  474. if ($fs -eq 'ReFS') {
  475. corepack pnpm install --frozen-lockfile --package-import-method=clone
  476. } else {
  477. pnpm install --frozen-lockfile
  478. }
  479. - name: Run blocking Windows builds
  480. shell: pwsh
  481. run: pnpm run check:ci:windows-blocking
  482. windows-coverage:
  483. if: github.event_name == 'pull_request'
  484. runs-on: >-
  485. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith' && 'blacksmith-16vcpu-windows-2025'
  486. || vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  487. && github.event.pull_request.user.login != 'dependabot[bot]'
  488. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  489. || 'dsh-windows-2025-16core' }}
  490. name: windows node 24 / coverage
  491. timeout-minutes: 120
  492. env:
  493. DSH_COVERAGE_MAX_WORKERS: '6'
  494. DSH_COVERAGE_PARTITIONS: '4'
  495. DSH_COVERAGE_TEST_TIMEOUT_MS: '90000'
  496. DSH_GATE_CONCURRENCY: '3'
  497. # A gate failure aborts the sibling gate instead of waiting out its
  498. # multi-minute instrumented run.
  499. DSH_GATE_FAIL_FAST: '1'
  500. steps:
  501. - uses: actions/checkout@v6
  502. with:
  503. persist-credentials: false
  504. # Checkout removes the gitignored duration history, so restore it from
  505. # the GitHub cache before coverage and save the updated one afterwards.
  506. # The coordinator then weights partitions by measured durations on the
  507. # second run instead of degrading to a file-count split. GitHub cache
  508. # entries are immutable, so the save key is unique per run and the
  509. # restore matches the newest entry through the stable prefix.
  510. - name: Restore coverage duration history
  511. uses: actions/cache/restore@v4
  512. with:
  513. path: .coverage-times.json
  514. key: coverage-times-${{ github.run_id }}
  515. restore-keys: |
  516. coverage-times-
  517. - name: Enable Developer Mode (symlink support)
  518. shell: pwsh
  519. run: >-
  520. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  521. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  522. - uses: pnpm/action-setup@v4
  523. with:
  524. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  525. - uses: actions/setup-node@v6
  526. with:
  527. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  528. - name: Install (immutable)
  529. shell: pwsh
  530. # See 2026-08-30-windows-refs-store-block-clone-install for the
  531. # ReFS block-clone rationale; detect the workspace filesystem and
  532. # pass --package-import-method=clone only on ReFS.
  533. run: >-
  534. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  535. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  536. if ($fs -eq 'ReFS') {
  537. corepack pnpm install --frozen-lockfile --package-import-method=clone
  538. } else {
  539. pnpm install --frozen-lockfile
  540. }
  541. # No build before coverage, matching the Linux lane: workspace imports
  542. # resolve to src through the tsconfig paths map, and the lib-consuming
  543. # suites (webworker-packer image-loadable, webworker-runtime
  544. # transform-corpus, client ui-trajectory client-bundle) self-skip on
  545. # unbuilt checkouts.
  546. - name: Run Windows coverage
  547. shell: pwsh
  548. run: pnpm run check:ci:coverage
  549. - name: Save coverage duration history
  550. # Coverage flakes must not prevent the cache from building; the
  551. # measured durations remain useful even when a partition failed. The
  552. # per-run key keeps every save a fresh immutable cache entry.
  553. if: ${{ !cancelled() }}
  554. uses: actions/cache/save@v4
  555. with:
  556. path: .coverage-times.json
  557. key: coverage-times-${{ github.run_id }}
  558. windows-native-tests:
  559. if: github.event_name == 'pull_request'
  560. runs-on: >-
  561. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith' && 'blacksmith-16vcpu-windows-2025'
  562. || vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  563. && github.event.pull_request.user.login != 'dependabot[bot]'
  564. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  565. || 'dsh-windows-2025-16core' }}
  566. name: windows node 24 / native tests
  567. timeout-minutes: 60
  568. steps:
  569. - uses: actions/checkout@v6
  570. with:
  571. persist-credentials: false
  572. - name: Enable Developer Mode (symlink support)
  573. shell: pwsh
  574. run: >-
  575. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  576. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  577. - uses: pnpm/action-setup@v4
  578. with:
  579. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  580. - uses: actions/setup-node@v6
  581. with:
  582. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  583. - name: Install (immutable)
  584. shell: pwsh
  585. # See 2026-08-30-windows-refs-store-block-clone-install for the
  586. # ReFS block-clone rationale; detect the workspace filesystem and
  587. # pass --package-import-method=clone only on ReFS.
  588. run: >-
  589. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  590. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  591. if ($fs -eq 'ReFS') {
  592. corepack pnpm install --frozen-lockfile --package-import-method=clone
  593. } else {
  594. pnpm install --frozen-lockfile
  595. }
  596. - name: Run Windows-specific native tests
  597. shell: pwsh
  598. run: >-
  599. pnpm exec vitest run
  600. --no-file-parallelism
  601. --testTimeout 90000
  602. packages/shell/tool-pwsh/tests/loader.spec.ts
  603. packages/workflow/workflow-ptc/tests/workflow-ptc.spec.ts
  604. packages/workflow/tool-ralph/tests/integration.spec.ts
  605. packages/subprocess/subprocess-local/tests/process-exit.spec.ts
  606. windows-observational:
  607. if: github.event_name == 'pull_request'
  608. continue-on-error: true
  609. runs-on: >-
  610. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith' && 'blacksmith-16vcpu-windows-2025'
  611. || vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  612. && github.event.pull_request.user.login != 'dependabot[bot]'
  613. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  614. || 'dsh-windows-2025-16core' }}
  615. name: windows node 24 / observational
  616. timeout-minutes: 60
  617. env:
  618. DSH_PUBLINT_CONCURRENCY: '8'
  619. steps:
  620. - uses: actions/checkout@v6
  621. with:
  622. persist-credentials: false
  623. - name: Enable Developer Mode (symlink support)
  624. shell: pwsh
  625. run: >-
  626. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  627. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  628. - uses: pnpm/action-setup@v4
  629. with:
  630. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  631. - uses: actions/setup-node@v6
  632. with:
  633. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  634. - name: Install (immutable)
  635. shell: pwsh
  636. # See 2026-08-30-windows-refs-store-block-clone-install for the
  637. # ReFS block-clone rationale; detect the workspace filesystem and
  638. # pass --package-import-method=clone only on ReFS.
  639. run: >-
  640. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  641. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  642. if ($fs -eq 'ReFS') {
  643. corepack pnpm install --frozen-lockfile --package-import-method=clone
  644. } else {
  645. pnpm install --frozen-lockfile
  646. }
  647. - name: Run Windows observational gates
  648. shell: pwsh
  649. run: pnpm run check:ci:windows-observational
  650. # Single stable required check for branch protection: require "all checks
  651. # passed" instead of enumerating matrix legs whose names change as lanes and
  652. # node versions evolve. Every blocking job in THIS workflow must be listed in
  653. # `needs`. Native Windows build and process checks are required; Wine and
  654. # the deferred Python runtime targets live in ci-master.yml and do not
  655. # participate in this PR verdict. `needs` cannot cross workflow files.
  656. # An explicit status function runs the verdict after failed/skipped needs
  657. # without keeping a cancelled workflow alive for an obsolete verdict.
  658. all-checks-passed:
  659. name: all checks passed
  660. # This bookkeeping-only verdict must not depend on custom-pool
  661. # provisioning — and under Linux failover it follows the same selector as
  662. # the worker jobs it aggregates, so a standard-hosted outage cannot strand
  663. # the branch-protection verdict either. It retargets with the Linux switch
  664. # (DSH_CI_FAILOVER_LINUX), not the Windows one, because it aggregates the
  665. # required Linux workers and runs on the vm-backup pool. Under the
  666. # 'blacksmith' value the verdict shares Blacksmith's pool with its workers
  667. # through the same selector, so a Blacksmith outage strands both together —
  668. # the accepted consequence of the explicit opt-in switch.
  669. runs-on: >-
  670. ${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404'
  671. || vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  672. && github.event.pull_request.user.login != 'dependabot[bot]'
  673. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  674. || 'ubuntu-latest' }}
  675. needs: [node-24, node-24-coverage, node-24-bench, node-24-consumers, node-compat, python-sdk, python-runtime, windows-build, windows-native-tests]
  676. if: ${{ !cancelled() && github.event_name == 'pull_request' }}
  677. steps:
  678. - name: Fail if any needed job did not succeed
  679. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  680. run: |
  681. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  682. exit 1
  683. - name: All checks passed
  684. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"