ci.yml 31 KB

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