ci.yml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  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. steps:
  45. # Fetch complete history so the archive gate can read the trusted PR base from a reused shallow checkout.
  46. - uses: actions/checkout@v6
  47. with:
  48. fetch-depth: 0
  49. persist-credentials: false
  50. - uses: pnpm/action-setup@v4
  51. with:
  52. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  53. - uses: actions/setup-node@v6
  54. with:
  55. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  56. - name: Configure pnpm store path
  57. id: pnpm-store
  58. run: |
  59. store_root="$HOME/.local/share/pnpm/store"
  60. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  61. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  62. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  63. # Pull requests consume the default-branch cache but do not put cache
  64. # compression and upload on the paid latency-critical path. Skipped
  65. # under failover — see the coverage lane's identical rationale.
  66. - uses: actions/cache/restore@v4
  67. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  68. with:
  69. path: ${{ steps.pnpm-store.outputs.path }}
  70. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  71. restore-keys: |
  72. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  73. - name: Install (immutable)
  74. run: pnpm install --frozen-lockfile
  75. - name: Run static gates
  76. env:
  77. DSH_ARCHIVE_BASE_REF: ${{ github.event.pull_request.base.sha }}
  78. run: pnpm run check:ci:static
  79. node-24-coverage:
  80. if: github.event_name == 'pull_request'
  81. runs-on: >-
  82. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  83. && github.event.pull_request.user.login != 'dependabot[bot]'
  84. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  85. || 'dsh-ubuntu-24-04-16core' }}
  86. name: node 24 / coverage
  87. env:
  88. # Partitioning replaces the instrumented share; this budget gives the
  89. # exempt-heavy gate two workers on both hosted and failover runners.
  90. DSH_COVERAGE_MAX_WORKERS: '6'
  91. DSH_COVERAGE_PARTITIONS: '4'
  92. DSH_GATE_CONCURRENCY: '3'
  93. steps:
  94. - uses: actions/checkout@v6
  95. with:
  96. persist-credentials: false
  97. - uses: pnpm/action-setup@v4
  98. with:
  99. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  100. - uses: actions/setup-node@v6
  101. with:
  102. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  103. - name: Configure pnpm store path
  104. id: pnpm-store
  105. run: |
  106. store_root="$HOME/.local/share/pnpm/store"
  107. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  108. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  109. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  110. # Skipped under failover: the self-hosted VM's persistent pnpm store
  111. # already serves warm installs, while restoring the hosted archive
  112. # would spend ~52 s pulling ~180 MB into that populated store.
  113. - uses: actions/cache/restore@v4
  114. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  115. with:
  116. path: ${{ steps.pnpm-store.outputs.path }}
  117. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  118. restore-keys: |
  119. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  120. - name: Install dependencies and prepare bubblewrap
  121. run: |
  122. pnpm install --frozen-lockfile &
  123. install_pid=$!
  124. bash scripts/prepare-ci-bubblewrap.sh &
  125. sandbox_pid=$!
  126. install_status=0
  127. wait "$install_pid" || install_status=$?
  128. sandbox_status=0
  129. wait "$sandbox_pid" || sandbox_status=$?
  130. if (( install_status != 0 )); then exit "$install_status"; fi
  131. exit "$sandbox_status"
  132. - name: Run exhaustive coverage
  133. run: pnpm run check:ci:coverage
  134. node-24-consumers:
  135. if: github.event_name == 'pull_request'
  136. runs-on: >-
  137. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  138. && github.event.pull_request.user.login != 'dependabot[bot]'
  139. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  140. || 'dsh-ubuntu-24-04-16core' }}
  141. name: node 24 / snapshots and artifacts
  142. env:
  143. DSH_GATE_CONCURRENCY: '10'
  144. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  145. DSH_OXLINT_THREADS: '8'
  146. DSH_PUBLINT_CONCURRENCY: '8'
  147. DSH_WEB_SNAPSHOT_WORKERS: '6'
  148. # Failover halves snapshot concurrency for the shared 64-core VM.
  149. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '12' || '32' }}
  150. steps:
  151. - uses: actions/checkout@v6
  152. with:
  153. persist-credentials: false
  154. - uses: pnpm/action-setup@v4
  155. with:
  156. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  157. - uses: actions/setup-node@v6
  158. with:
  159. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  160. - name: Configure pnpm store path
  161. id: pnpm-store
  162. run: |
  163. store_root="$HOME/.local/share/pnpm/store"
  164. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  165. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  166. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  167. # Pull requests restore the pnpm store and Playwright caches without paying
  168. # compression and upload on the required path. No master job saves these
  169. # hosted cache keys, so each restore-keys fallback hits the matching archived
  170. # entry until it evicts, after which the store is cold. Skipped under failover
  171. # — the self-hosted VM's persistent store is already warm.
  172. - uses: actions/cache/restore@v4
  173. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  174. with:
  175. path: ${{ steps.pnpm-store.outputs.path }}
  176. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  177. restore-keys: |
  178. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  179. # Skipped under failover: the VM's persistent browser cache is already warm.
  180. - uses: actions/cache/restore@v4
  181. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  182. with:
  183. path: ~/.cache/ms-playwright
  184. key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
  185. restore-keys: |
  186. ${{ runner.os }}-playwright-
  187. - name: Install dependencies and prepare bubblewrap
  188. run: |
  189. pnpm install --frozen-lockfile &
  190. install_pid=$!
  191. bash scripts/prepare-ci-bubblewrap.sh &
  192. sandbox_pid=$!
  193. install_status=0
  194. wait "$install_pid" || install_status=$?
  195. sandbox_status=0
  196. wait "$sandbox_pid" || sandbox_status=$?
  197. if (( install_status != 0 )); then exit "$install_status"; fi
  198. exit "$sandbox_status"
  199. - name: Install Playwright Chromium and hosted dependencies
  200. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  201. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install --with-deps chromium
  202. # The persistent VM image owns Playwright's Linux system packages; do
  203. # not mutate the shared host with apt on every failover run.
  204. - name: Install Playwright Chromium on the failover VM
  205. if: vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]'
  206. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install chromium
  207. - name: Run compatibility, snapshot, and artifact gates
  208. run: pnpm run check:ci:consumers
  209. node-compat:
  210. if: github.event_name == 'pull_request'
  211. # Each compatibility contract receives an independent standard hosted job.
  212. runs-on: ${{ matrix.runner }}
  213. name: ${{ matrix.name }}
  214. env:
  215. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  216. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  217. strategy:
  218. fail-fast: false
  219. matrix:
  220. include:
  221. - node: '22.19'
  222. name: node 22.19
  223. runner: ubuntu-latest
  224. gate_concurrency: '1'
  225. # Pinned inside 24.0-24.11.1: those releases carry the v1 internal
  226. # loader while reporting major 24, and every other job tracks the
  227. # latest 24, which is v2. A bare `24` here would retest that same v2.
  228. - node: '24.9'
  229. name: node 24.9
  230. runner: ubuntu-latest
  231. gate_concurrency: '1'
  232. - node: 26
  233. name: node 26
  234. runner: ubuntu-latest
  235. gate_concurrency: '1'
  236. steps:
  237. - uses: actions/checkout@v6
  238. - uses: pnpm/action-setup@v4
  239. with:
  240. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  241. - uses: actions/setup-node@v6
  242. with:
  243. node-version: ${{ matrix.node }}
  244. cache: pnpm
  245. - name: Install (immutable)
  246. run: pnpm install --frozen-lockfile
  247. - name: Run compatibility smokes
  248. env:
  249. DSH_BUILD_CLIENT_PROFILE: official
  250. run: pnpm run check:node-compat
  251. # Kept out of the gate aggregate: the shape a Node release carries only
  252. # changes with the Node version, so this belongs to the version matrix
  253. # rather than to every commit's checks.
  254. - name: Check Loader internal shape detection
  255. run: pnpm exec vitest run packages/boot/app-boot/tests/loader-shape.compat.spec.ts
  256. python-sdk:
  257. if: github.event_name == 'pull_request'
  258. runs-on: ubuntu-latest
  259. name: python 3.10 / keyless SDK
  260. steps:
  261. - uses: actions/checkout@v6
  262. - uses: actions/setup-python@v6.3.0
  263. with:
  264. python-version: '3.10'
  265. cache: pip
  266. - name: Install uv
  267. run: python -m pip install uv==0.11.23
  268. - name: Run complete keyless Python suite
  269. run: uv run --python 3.10 --group test --project python/sdk pytest
  270. # The reusable builder owns each published executable, wheel, clean-install,
  271. # keyless black-box, and trusted real-API path. All native release targets are
  272. # required because a platform wheel cannot be validated by another carrier.
  273. python-runtime:
  274. if: github.event_name == 'pull_request'
  275. name: python runtime / release-shaped matrix
  276. uses: ./.github/workflows/build-exe-for-python-sdk.yml
  277. with:
  278. targets: node24-linux-x64,node24-linux-arm64,node24-macos-arm64,node24-win-x64
  279. ci: true
  280. secrets:
  281. DEEPSEEK_API_KEY_EXTERNAL: ${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }}
  282. # The required pull-request Windows signal: the two blocking win32 surfaces
  283. # (workspace build, production site) execute with real, checksum-verified
  284. # Windows Node under Wine on standard hosted Linux. The independent
  285. # windows-native job below keeps the complete native-kernel inventory —
  286. # including the observational portability gates this lane does not run —
  287. # on real Windows. This job only provisions runner state (caches,
  288. # apt); scripts/wine-windows-gates.sh owns the gate logic and is the same
  289. # script the optional local gate `pnpm run check:windows-wine` runs.
  290. # Current topology and fidelity limits live in
  291. # .agents/notes/implemented/process/2026-08-08-native-windows-pull-request-ci.md
  292. windows:
  293. if: github.event_name == 'pull_request'
  294. runs-on: ubuntu-latest
  295. name: windows node 24 / wine blocking
  296. timeout-minutes: 15
  297. steps:
  298. - uses: actions/checkout@v6
  299. with:
  300. persist-credentials: false
  301. - uses: pnpm/action-setup@v4
  302. with:
  303. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  304. - uses: actions/setup-node@v6
  305. with:
  306. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  307. - name: Configure pnpm store path
  308. id: pnpm-store
  309. run: |
  310. store_root="$HOME/.local/share/pnpm/store"
  311. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  312. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  313. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  314. - uses: actions/cache/restore@v4
  315. with:
  316. path: ${{ steps.pnpm-store.outputs.path }}
  317. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  318. restore-keys: |
  319. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  320. # Master's wine-apt-cache job in ci-master.yml seeds the default-branch
  321. # scope every pull request can read; a save from this job only reaches
  322. # reruns of the same merge ref.
  323. - name: Compose Wine apt cache key
  324. id: wine-cache-key
  325. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  326. - uses: actions/cache@v4
  327. with:
  328. path: ~/wine-debs
  329. key: ${{ steps.wine-cache-key.outputs.key }}
  330. # Runner provisioning only — a developer machine installs Wine through
  331. # its own package manager; the gate script assumes a wine binary and
  332. # fails loud without one. Wine from the apt cache when present; else
  333. # download the full dependency closure once and keep it for the next
  334. # run. The `wine` dispatcher package (not bare `wine64`) is what puts a
  335. # binary on PATH.
  336. - name: Install Wine
  337. run: |
  338. if compgen -G "$HOME/wine-debs/*.deb" > /dev/null; then
  339. # The restored archive is the full --download-only closure of
  340. # `wine` for this runner image, so installing the .debs directly
  341. # with dpkg needs no repository access. apt-get would instead
  342. # re-download the same 100+ MB closure from the mirror, which has
  343. # stalled the job past its budget on a degraded runner network.
  344. # If the archive cannot satisfy the closure, fall back to the apt
  345. # network install.
  346. if ! sudo DEBIAN_FRONTEND=noninteractive dpkg -i "$HOME"/wine-debs/*.deb; then
  347. sudo DEBIAN_FRONTEND=noninteractive dpkg --configure -a || true
  348. sudo apt-get install -y --no-install-recommends "$HOME"/wine-debs/*.deb
  349. fi
  350. else
  351. sudo apt-get update
  352. sudo apt-get install -y --no-install-recommends --download-only wine
  353. mkdir -p "$HOME/wine-debs"
  354. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/" 2>/dev/null || true
  355. sudo apt-get install -y --no-install-recommends wine
  356. fi
  357. - name: Run the Wine Windows gates
  358. run: bash scripts/wine-windows-gates.sh
  359. - name: Shut down wineserver
  360. if: always()
  361. run: wineserver -k 2>/dev/null || true
  362. # Every pull request also gets real Windows-kernel signals. The former
  363. # monolithic windows-native job is split into smaller jobs so one slow
  364. # coverage gate does not hold up build/static results, while the total
  365. # per-job process count stays lower. Observational checks are non-blocking.
  366. # Dependabot PRs are excluded from the self-hosted pool and stay queued for
  367. # the hosted runner.
  368. windows-build:
  369. if: github.event_name == 'pull_request'
  370. runs-on: >-
  371. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  372. && github.event.pull_request.user.login != 'dependabot[bot]'
  373. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  374. || 'dsh-windows-2025-16core' }}
  375. name: windows node 24 / build
  376. timeout-minutes: 60
  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. run: pnpm install --frozen-lockfile
  395. - name: Run blocking Windows builds
  396. shell: pwsh
  397. run: pnpm run check:ci:windows-blocking
  398. windows-coverage:
  399. if: github.event_name == 'pull_request'
  400. runs-on: >-
  401. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  402. && github.event.pull_request.user.login != 'dependabot[bot]'
  403. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  404. || 'dsh-windows-2025-16core' }}
  405. name: windows node 24 / coverage
  406. timeout-minutes: 120
  407. env:
  408. DSH_COVERAGE_MAX_WORKERS: '6'
  409. DSH_COVERAGE_PARTITIONS: '4'
  410. DSH_COVERAGE_TEST_TIMEOUT_MS: '90000'
  411. DSH_GATE_CONCURRENCY: '3'
  412. steps:
  413. - uses: actions/checkout@v6
  414. with:
  415. persist-credentials: false
  416. # Checkout removes the gitignored duration history, so restore it from
  417. # the GitHub cache before coverage and save the updated one afterwards.
  418. # The coordinator then weights partitions by measured durations on the
  419. # second run instead of degrading to a file-count split. GitHub cache
  420. # entries are immutable, so the save key is unique per run and the
  421. # restore matches the newest entry through the stable prefix.
  422. - name: Restore coverage duration history
  423. uses: actions/cache/restore@v4
  424. with:
  425. path: .coverage-times.json
  426. key: coverage-times-${{ github.run_id }}
  427. restore-keys: |
  428. coverage-times-
  429. - name: Enable Developer Mode (symlink support)
  430. shell: pwsh
  431. run: >-
  432. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  433. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  434. - uses: pnpm/action-setup@v4
  435. with:
  436. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  437. - uses: actions/setup-node@v6
  438. with:
  439. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  440. - name: Install (immutable)
  441. shell: pwsh
  442. run: pnpm install --frozen-lockfile
  443. - name: Build before coverage
  444. shell: pwsh
  445. run: pnpm run build
  446. - name: Run Windows coverage
  447. shell: pwsh
  448. run: pnpm run check:ci:coverage
  449. - name: Save coverage duration history
  450. # Coverage flakes must not prevent the cache from building; the
  451. # measured durations remain useful even when a partition failed. The
  452. # per-run key keeps every save a fresh immutable cache entry.
  453. if: always()
  454. uses: actions/cache/save@v4
  455. with:
  456. path: .coverage-times.json
  457. key: coverage-times-${{ github.run_id }}
  458. windows-native-tests:
  459. if: github.event_name == 'pull_request'
  460. runs-on: >-
  461. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  462. && github.event.pull_request.user.login != 'dependabot[bot]'
  463. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  464. || 'dsh-windows-2025-16core' }}
  465. name: windows node 24 / native tests
  466. timeout-minutes: 60
  467. steps:
  468. - uses: actions/checkout@v6
  469. with:
  470. persist-credentials: false
  471. - name: Enable Developer Mode (symlink support)
  472. shell: pwsh
  473. run: >-
  474. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  475. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  476. - uses: pnpm/action-setup@v4
  477. with:
  478. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  479. - uses: actions/setup-node@v6
  480. with:
  481. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  482. - name: Install (immutable)
  483. shell: pwsh
  484. run: pnpm install --frozen-lockfile
  485. - name: Run Windows-specific native tests
  486. shell: pwsh
  487. run: >-
  488. pnpm exec vitest run
  489. --no-file-parallelism
  490. --testTimeout 90000
  491. packages/shell/tool-pwsh/tests/loader.spec.ts
  492. packages/workflow/workflow-worker-thread/tests/workflow-worker-thread.spec.ts
  493. packages/workflow/tool-ralph/tests/integration.spec.ts
  494. packages/subprocess/subprocess-local/tests/process-exit.spec.ts
  495. packages/session/session-persistence-sqlite/tests/differential.spec.ts
  496. windows-observational:
  497. if: github.event_name == 'pull_request'
  498. continue-on-error: true
  499. runs-on: >-
  500. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  501. && github.event.pull_request.user.login != 'dependabot[bot]'
  502. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  503. || 'dsh-windows-2025-16core' }}
  504. name: windows node 24 / observational
  505. timeout-minutes: 60
  506. env:
  507. DSH_PUBLINT_CONCURRENCY: '8'
  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. run: pnpm install --frozen-lockfile
  526. - name: Run Windows observational gates
  527. shell: pwsh
  528. run: pnpm run check:ci:windows-observational
  529. # Single stable required check for branch protection: require "all checks
  530. # passed" instead of enumerating matrix legs whose names change as lanes and
  531. # node versions evolve. Every blocking job in THIS workflow must be listed in
  532. # `needs`. The required Wine job is listed as `windows`; `windows-native` is
  533. # deliberately absent so its independent result never delays or changes this
  534. # verdict. (`needs` cannot reach across workflow files; the master-only jobs in
  535. # ci-master.yml are intentionally not part of this PR verdict.)
  536. # `if: always()` is load-bearing: without it a failed dependency
  537. # would SKIP this job, and GitHub counts a skipped required check as passing
  538. # — so this job always runs and fails on any non-success result, including
  539. # 'cancelled' and 'skipped'.
  540. all-checks-passed:
  541. name: all checks passed
  542. # This bookkeeping-only verdict must not depend on custom-pool
  543. # provisioning — and under Linux failover it follows the same selector as
  544. # the worker jobs it aggregates, so a standard-hosted outage cannot strand
  545. # the branch-protection verdict either. It retargets with the Linux switch
  546. # (DSH_CI_FAILOVER_LINUX), not the Windows one, because it aggregates the
  547. # required Linux workers and runs on the vm-backup pool.
  548. runs-on: >-
  549. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  550. && github.event.pull_request.user.login != 'dependabot[bot]'
  551. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  552. || 'ubuntu-latest' }}
  553. needs: [node-24, node-24-coverage, node-24-consumers, node-compat, python-sdk, python-runtime, windows, windows-build, windows-native-tests]
  554. if: always() && github.event_name == 'pull_request'
  555. steps:
  556. - name: Fail if any needed job did not succeed
  557. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  558. run: |
  559. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  560. exit 1
  561. - name: All checks passed
  562. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"