ci.yml 29 KB

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