ci.yml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  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-consumers:
  141. if: github.event_name == 'pull_request'
  142. runs-on: >-
  143. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  144. && github.event.pull_request.user.login != 'dependabot[bot]'
  145. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  146. || 'dsh-ubuntu-24-04-16core' }}
  147. name: node 24 / snapshots and artifacts
  148. env:
  149. DSH_GATE_CONCURRENCY: '10'
  150. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  151. DSH_OXLINT_THREADS: '8'
  152. DSH_PUBLINT_CONCURRENCY: '8'
  153. DSH_WEB_SNAPSHOT_WORKERS: '6'
  154. # A failing gate aborts its running siblings: a failing build stops the
  155. # independent Node compatibility smoke, and a failing reader (e.g.
  156. # publint) stops the remaining artifact consumers.
  157. DSH_GATE_FAIL_FAST: '1'
  158. # Failover halves snapshot concurrency for the shared 64-core VM.
  159. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '12' || '32' }}
  160. steps:
  161. - uses: actions/checkout@v6
  162. with:
  163. persist-credentials: false
  164. - uses: pnpm/action-setup@v4
  165. with:
  166. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  167. - uses: actions/setup-node@v6
  168. with:
  169. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  170. - name: Configure pnpm store path
  171. id: pnpm-store
  172. run: |
  173. store_root="$HOME/.local/share/pnpm/store"
  174. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  175. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  176. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  177. # Pull requests restore the pnpm store and Playwright caches without paying
  178. # compression and upload on the required path. No master job saves these
  179. # hosted cache keys, so each restore-keys fallback hits the matching archived
  180. # entry until it evicts, after which the store is cold. Skipped under failover
  181. # — the self-hosted VM's persistent store is already warm.
  182. - uses: actions/cache/restore@v4
  183. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  184. with:
  185. path: ${{ steps.pnpm-store.outputs.path }}
  186. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  187. restore-keys: |
  188. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  189. # Skipped under failover: the VM's persistent browser cache is already warm.
  190. - uses: actions/cache/restore@v4
  191. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  192. with:
  193. path: ~/.cache/ms-playwright
  194. key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
  195. restore-keys: |
  196. ${{ runner.os }}-playwright-
  197. - name: Install dependencies and prepare bubblewrap
  198. run: |
  199. pnpm install --frozen-lockfile &
  200. install_pid=$!
  201. bash scripts/prepare-ci-bubblewrap.sh &
  202. sandbox_pid=$!
  203. install_status=0
  204. wait "$install_pid" || install_status=$?
  205. sandbox_status=0
  206. wait "$sandbox_pid" || sandbox_status=$?
  207. if (( install_status != 0 )); then exit "$install_status"; fi
  208. exit "$sandbox_status"
  209. - name: Install Playwright Chromium and hosted dependencies
  210. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  211. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install --with-deps chromium
  212. # The persistent VM image owns Playwright's Linux system packages; do
  213. # not mutate the shared host with apt on every failover run.
  214. - name: Install Playwright Chromium on the failover VM
  215. if: vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]'
  216. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install chromium
  217. - name: Run compatibility, snapshot, and artifact gates
  218. run: pnpm run check:ci:consumers
  219. node-compat:
  220. if: github.event_name == 'pull_request'
  221. # Each compatibility contract receives an independent standard hosted job.
  222. runs-on: ${{ matrix.runner }}
  223. name: ${{ matrix.name }}
  224. env:
  225. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  226. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  227. # A failed smoke aborts the remaining compatibility gates instead of
  228. # letting the build-backed legs run against an already-red aggregate.
  229. DSH_GATE_FAIL_FAST: '1'
  230. strategy:
  231. fail-fast: false
  232. matrix:
  233. include:
  234. - node: '22.19'
  235. name: node 22.19
  236. runner: ubuntu-latest
  237. gate_concurrency: '1'
  238. # Pinned inside 24.0-24.11.1: those releases carry the v1 internal
  239. # loader while reporting major 24, and every other job tracks the
  240. # latest 24, which is v2. A bare `24` here would retest that same v2.
  241. - node: '24.9'
  242. name: node 24.9
  243. runner: ubuntu-latest
  244. gate_concurrency: '1'
  245. - node: 26
  246. name: node 26
  247. runner: ubuntu-latest
  248. gate_concurrency: '1'
  249. steps:
  250. - uses: actions/checkout@v6
  251. - uses: pnpm/action-setup@v4
  252. with:
  253. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  254. - uses: actions/setup-node@v6
  255. with:
  256. node-version: ${{ matrix.node }}
  257. cache: pnpm
  258. - name: Install (immutable)
  259. run: pnpm install --frozen-lockfile
  260. - name: Run compatibility smokes
  261. env:
  262. DSH_BUILD_CLIENT_PROFILE: official
  263. run: pnpm run check:node-compat
  264. # Kept out of the gate aggregate: the shape a Node release carries only
  265. # changes with the Node version, so this belongs to the version matrix
  266. # rather than to every commit's checks.
  267. - name: Check Loader internal shape detection
  268. run: pnpm exec vitest run packages/boot/app-boot/tests/loader-shape.compat.spec.ts
  269. python-sdk:
  270. if: github.event_name == 'pull_request'
  271. runs-on: ubuntu-latest
  272. name: python 3.10 / keyless SDK
  273. steps:
  274. - uses: actions/checkout@v6
  275. - uses: actions/setup-python@v6.3.0
  276. with:
  277. python-version: '3.10'
  278. cache: pip
  279. - name: Install uv
  280. run: python -m pip install uv==0.11.23
  281. - name: Run complete keyless Python suite
  282. run: uv run --python 3.10 --group test --project python/sdk pytest
  283. # The reusable builder owns each published executable, wheel, clean-install,
  284. # keyless black-box, and trusted real-API path. All native release targets are
  285. # required because a platform wheel cannot be validated by another carrier.
  286. python-runtime:
  287. if: github.event_name == 'pull_request'
  288. name: python runtime / release-shaped matrix
  289. uses: ./.github/workflows/build-exe-for-python-sdk.yml
  290. with:
  291. targets: node24-linux-x64,node24-linux-arm64,node24-macos-arm64,node24-macos-x64,node24-win-x64
  292. ci: true
  293. secrets:
  294. DEEPSEEK_API_KEY_EXTERNAL: ${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }}
  295. # The required pull-request Windows signal: the two blocking win32 surfaces
  296. # (workspace build, production site) execute with real, checksum-verified
  297. # Windows Node under Wine on standard hosted Linux. The independent
  298. # windows-native job below keeps the complete native-kernel inventory —
  299. # including the observational portability gates this lane does not run —
  300. # on real Windows. This job only provisions runner state (caches,
  301. # apt); scripts/wine-windows-gates.sh owns the gate logic and is the same
  302. # script the optional local gate `pnpm run check:windows-wine` runs.
  303. # Current topology and fidelity limits live in
  304. # .agents/notes/implemented/process/2026-08-08-native-windows-pull-request-ci.md
  305. windows:
  306. if: github.event_name == 'pull_request'
  307. runs-on: ubuntu-latest
  308. name: windows node 24 / wine blocking
  309. timeout-minutes: 15
  310. steps:
  311. - uses: actions/checkout@v6
  312. with:
  313. persist-credentials: false
  314. - uses: pnpm/action-setup@v4
  315. with:
  316. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  317. - uses: actions/setup-node@v6
  318. with:
  319. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  320. - name: Configure pnpm store path
  321. id: pnpm-store
  322. run: |
  323. store_root="$HOME/.local/share/pnpm/store"
  324. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  325. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  326. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  327. - uses: actions/cache/restore@v4
  328. with:
  329. path: ${{ steps.pnpm-store.outputs.path }}
  330. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  331. restore-keys: |
  332. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  333. # Master's wine-apt-cache job in ci-master.yml seeds the default-branch
  334. # scope every pull request can read; a save from this job only reaches
  335. # reruns of the same merge ref.
  336. - name: Compose Wine apt cache key
  337. id: wine-cache-key
  338. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  339. - uses: actions/cache@v4
  340. with:
  341. path: ~/wine-debs
  342. key: ${{ steps.wine-cache-key.outputs.key }}
  343. # Runner provisioning only — a developer machine installs Wine through
  344. # its own package manager; the gate script assumes a wine binary and
  345. # fails loud without one. Wine from the apt cache when present; else
  346. # download the full dependency closure once and keep it for the next
  347. # run. The `wine` dispatcher package (not bare `wine64`) is what puts a
  348. # binary on PATH.
  349. - name: Install Wine
  350. run: |
  351. if compgen -G "$HOME/wine-debs/*.deb" > /dev/null; then
  352. # The restored archive is the full --download-only closure of
  353. # `wine` for this runner image, so installing the .debs directly
  354. # with dpkg needs no repository access. apt-get would instead
  355. # re-download the same 100+ MB closure from the mirror, which has
  356. # stalled the job past its budget on a degraded runner network.
  357. # If the archive cannot satisfy the closure, fall back to the apt
  358. # network install.
  359. if ! sudo DEBIAN_FRONTEND=noninteractive dpkg -i "$HOME"/wine-debs/*.deb; then
  360. sudo DEBIAN_FRONTEND=noninteractive dpkg --configure -a || true
  361. sudo apt-get install -y --no-install-recommends "$HOME"/wine-debs/*.deb
  362. fi
  363. else
  364. sudo apt-get update
  365. sudo apt-get install -y --no-install-recommends --download-only wine
  366. mkdir -p "$HOME/wine-debs"
  367. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/" 2>/dev/null || true
  368. sudo apt-get install -y --no-install-recommends wine
  369. fi
  370. - name: Run the Wine Windows gates
  371. run: bash scripts/wine-windows-gates.sh
  372. - name: Shut down wineserver
  373. if: always()
  374. run: wineserver -k 2>/dev/null || true
  375. # Every pull request also gets real Windows-kernel signals. The former
  376. # monolithic windows-native job is split into smaller jobs so one slow
  377. # coverage gate does not hold up build/static results, while the total
  378. # per-job process count stays lower. Observational checks are non-blocking.
  379. # Dependabot PRs are excluded from the self-hosted pool and stay queued for
  380. # the hosted runner.
  381. windows-build:
  382. if: github.event_name == 'pull_request'
  383. runs-on: >-
  384. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  385. && github.event.pull_request.user.login != 'dependabot[bot]'
  386. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  387. || 'dsh-windows-2025-16core' }}
  388. name: windows node 24 / build
  389. timeout-minutes: 60
  390. env:
  391. # A failing build or site aborts the sibling gate on the same runner.
  392. DSH_GATE_FAIL_FAST: '1'
  393. steps:
  394. - uses: actions/checkout@v6
  395. with:
  396. persist-credentials: false
  397. - name: Enable Developer Mode (symlink support)
  398. shell: pwsh
  399. run: >-
  400. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  401. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  402. - uses: pnpm/action-setup@v4
  403. with:
  404. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  405. - uses: actions/setup-node@v6
  406. with:
  407. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  408. - name: Install (immutable)
  409. shell: pwsh
  410. # See 2026-08-30-windows-refs-store-block-clone-install for the
  411. # ReFS block-clone rationale; detect the workspace filesystem and
  412. # pass --package-import-method=clone only on ReFS.
  413. run: >-
  414. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  415. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  416. if ($fs -eq 'ReFS') {
  417. corepack pnpm install --frozen-lockfile --package-import-method=clone
  418. } else {
  419. pnpm install --frozen-lockfile
  420. }
  421. - name: Run blocking Windows builds
  422. shell: pwsh
  423. run: pnpm run check:ci:windows-blocking
  424. windows-coverage:
  425. if: github.event_name == 'pull_request'
  426. runs-on: >-
  427. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  428. && github.event.pull_request.user.login != 'dependabot[bot]'
  429. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  430. || 'dsh-windows-2025-16core' }}
  431. name: windows node 24 / coverage
  432. timeout-minutes: 120
  433. env:
  434. DSH_COVERAGE_MAX_WORKERS: '6'
  435. DSH_COVERAGE_PARTITIONS: '4'
  436. DSH_COVERAGE_TEST_TIMEOUT_MS: '90000'
  437. DSH_GATE_CONCURRENCY: '3'
  438. # A gate failure aborts the sibling gate instead of waiting out its
  439. # multi-minute instrumented run.
  440. DSH_GATE_FAIL_FAST: '1'
  441. steps:
  442. - uses: actions/checkout@v6
  443. with:
  444. persist-credentials: false
  445. # Checkout removes the gitignored duration history, so restore it from
  446. # the GitHub cache before coverage and save the updated one afterwards.
  447. # The coordinator then weights partitions by measured durations on the
  448. # second run instead of degrading to a file-count split. GitHub cache
  449. # entries are immutable, so the save key is unique per run and the
  450. # restore matches the newest entry through the stable prefix.
  451. - name: Restore coverage duration history
  452. uses: actions/cache/restore@v4
  453. with:
  454. path: .coverage-times.json
  455. key: coverage-times-${{ github.run_id }}
  456. restore-keys: |
  457. coverage-times-
  458. - name: Enable Developer Mode (symlink support)
  459. shell: pwsh
  460. run: >-
  461. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  462. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  463. - uses: pnpm/action-setup@v4
  464. with:
  465. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  466. - uses: actions/setup-node@v6
  467. with:
  468. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  469. - name: Install (immutable)
  470. shell: pwsh
  471. # See 2026-08-30-windows-refs-store-block-clone-install for the
  472. # ReFS block-clone rationale; detect the workspace filesystem and
  473. # pass --package-import-method=clone only on ReFS.
  474. run: >-
  475. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  476. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  477. if ($fs -eq 'ReFS') {
  478. corepack pnpm install --frozen-lockfile --package-import-method=clone
  479. } else {
  480. pnpm install --frozen-lockfile
  481. }
  482. # No build before coverage, matching the Linux lane: workspace imports
  483. # resolve to src through the tsconfig paths map, and the lib-consuming
  484. # suites (webworker-packer image-loadable, webworker-runtime
  485. # transform-corpus, client ui-trajectory client-bundle) self-skip on
  486. # unbuilt checkouts.
  487. - name: Run Windows coverage
  488. shell: pwsh
  489. run: pnpm run check:ci:coverage
  490. - name: Save coverage duration history
  491. # Coverage flakes must not prevent the cache from building; the
  492. # measured durations remain useful even when a partition failed. The
  493. # per-run key keeps every save a fresh immutable cache entry.
  494. if: always()
  495. uses: actions/cache/save@v4
  496. with:
  497. path: .coverage-times.json
  498. key: coverage-times-${{ github.run_id }}
  499. windows-native-tests:
  500. if: github.event_name == 'pull_request'
  501. runs-on: >-
  502. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  503. && github.event.pull_request.user.login != 'dependabot[bot]'
  504. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  505. || 'dsh-windows-2025-16core' }}
  506. name: windows node 24 / native tests
  507. timeout-minutes: 60
  508. steps:
  509. - uses: actions/checkout@v6
  510. with:
  511. persist-credentials: false
  512. - name: Enable Developer Mode (symlink support)
  513. shell: pwsh
  514. run: >-
  515. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  516. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  517. - uses: pnpm/action-setup@v4
  518. with:
  519. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  520. - uses: actions/setup-node@v6
  521. with:
  522. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  523. - name: Install (immutable)
  524. shell: pwsh
  525. # See 2026-08-30-windows-refs-store-block-clone-install for the
  526. # ReFS block-clone rationale; detect the workspace filesystem and
  527. # pass --package-import-method=clone only on ReFS.
  528. run: >-
  529. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  530. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  531. if ($fs -eq 'ReFS') {
  532. corepack pnpm install --frozen-lockfile --package-import-method=clone
  533. } else {
  534. pnpm install --frozen-lockfile
  535. }
  536. - name: Run Windows-specific native tests
  537. shell: pwsh
  538. run: >-
  539. pnpm exec vitest run
  540. --no-file-parallelism
  541. --testTimeout 90000
  542. packages/shell/tool-pwsh/tests/loader.spec.ts
  543. packages/workflow/workflow-worker-thread/tests/workflow-worker-thread.spec.ts
  544. packages/workflow/tool-ralph/tests/integration.spec.ts
  545. packages/subprocess/subprocess-local/tests/process-exit.spec.ts
  546. windows-observational:
  547. if: github.event_name == 'pull_request'
  548. continue-on-error: true
  549. runs-on: >-
  550. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  551. && github.event.pull_request.user.login != 'dependabot[bot]'
  552. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  553. || 'dsh-windows-2025-16core' }}
  554. name: windows node 24 / observational
  555. timeout-minutes: 60
  556. env:
  557. DSH_PUBLINT_CONCURRENCY: '8'
  558. steps:
  559. - uses: actions/checkout@v6
  560. with:
  561. persist-credentials: false
  562. - name: Enable Developer Mode (symlink support)
  563. shell: pwsh
  564. run: >-
  565. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  566. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  567. - uses: pnpm/action-setup@v4
  568. with:
  569. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  570. - uses: actions/setup-node@v6
  571. with:
  572. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  573. - name: Install (immutable)
  574. shell: pwsh
  575. # See 2026-08-30-windows-refs-store-block-clone-install for the
  576. # ReFS block-clone rationale; detect the workspace filesystem and
  577. # pass --package-import-method=clone only on ReFS.
  578. run: >-
  579. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  580. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  581. if ($fs -eq 'ReFS') {
  582. corepack pnpm install --frozen-lockfile --package-import-method=clone
  583. } else {
  584. pnpm install --frozen-lockfile
  585. }
  586. - name: Run Windows observational gates
  587. shell: pwsh
  588. run: pnpm run check:ci:windows-observational
  589. # Single stable required check for branch protection: require "all checks
  590. # passed" instead of enumerating matrix legs whose names change as lanes and
  591. # node versions evolve. Every blocking job in THIS workflow must be listed in
  592. # `needs`. The required Wine job is listed as `windows`; `windows-native` is
  593. # deliberately absent so its independent result never delays or changes this
  594. # verdict. (`needs` cannot reach across workflow files; the master-only jobs in
  595. # ci-master.yml are intentionally not part of this PR verdict.)
  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-consumers, node-compat, python-sdk, python-runtime, windows, 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, ', ') }})"