ci.yml 28 KB

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