ci.yml 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  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. # Each compatibility contract receives an independent standard hosted job.
  258. runs-on: ${{ matrix.runner }}
  259. name: ${{ matrix.name }}
  260. env:
  261. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  262. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  263. # A failed smoke aborts the remaining compatibility gates instead of
  264. # letting the build-backed legs run against an already-red aggregate.
  265. DSH_GATE_FAIL_FAST: '1'
  266. strategy:
  267. fail-fast: false
  268. matrix:
  269. include:
  270. - node: '22.19'
  271. name: node 22.19
  272. runner: ubuntu-latest
  273. gate_concurrency: '1'
  274. # Pinned inside 24.0-24.11.1: those releases carry the v1 internal
  275. # loader while reporting major 24, and every other job tracks the
  276. # latest 24, which is v2. A bare `24` here would retest that same v2.
  277. - node: '24.9'
  278. name: node 24.9
  279. runner: ubuntu-latest
  280. gate_concurrency: '1'
  281. - node: 26
  282. name: node 26
  283. runner: ubuntu-latest
  284. gate_concurrency: '1'
  285. steps:
  286. - uses: actions/checkout@v6
  287. - uses: pnpm/action-setup@v4
  288. with:
  289. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  290. - uses: actions/setup-node@v6
  291. with:
  292. node-version: ${{ matrix.node }}
  293. cache: pnpm
  294. - name: Install (immutable)
  295. run: pnpm install --frozen-lockfile
  296. - name: Run compatibility smokes
  297. env:
  298. DSH_BUILD_CLIENT_PROFILE: official
  299. run: pnpm run check:node-compat
  300. # Kept out of the gate aggregate: the shape a Node release carries only
  301. # changes with the Node version, so this belongs to the version matrix
  302. # rather than to every commit's checks.
  303. - name: Check Loader internal shape detection
  304. run: pnpm exec vitest run packages/boot/app-boot/tests/loader-shape.compat.spec.ts
  305. python-sdk:
  306. if: github.event_name == 'pull_request'
  307. runs-on: ubuntu-latest
  308. name: python 3.10 / keyless SDK
  309. steps:
  310. - uses: actions/checkout@v6
  311. - uses: actions/setup-python@v6.3.0
  312. with:
  313. python-version: '3.10'
  314. cache: pip
  315. - name: Install uv
  316. run: python -m pip install uv==0.11.23
  317. - name: Run complete keyless Python suite
  318. run: uv run --python 3.10 --group test --project python/sdk pytest
  319. # The reusable builder owns each published executable, wheel, clean-install,
  320. # keyless black-box, and trusted real-API path. All native release targets are
  321. # required because a platform wheel cannot be validated by another carrier.
  322. python-runtime:
  323. if: github.event_name == 'pull_request'
  324. name: python runtime / release-shaped matrix
  325. uses: ./.github/workflows/build-exe-for-python-sdk.yml
  326. with:
  327. targets: node24-linux-x64,node24-linux-arm64,node24-macos-arm64,node24-macos-x64,node24-win-x64
  328. ci: true
  329. secrets:
  330. DEEPSEEK_API_KEY_EXTERNAL: ${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }}
  331. # The required pull-request Windows signal: the two blocking win32 surfaces
  332. # (workspace build, production site) execute with real, checksum-verified
  333. # Windows Node under Wine on standard hosted Linux. The independent
  334. # windows-native job below keeps the complete native-kernel inventory —
  335. # including the observational portability gates this lane does not run —
  336. # on real Windows. This job only provisions runner state (caches,
  337. # apt); scripts/wine-windows-gates.sh owns the gate logic and is the same
  338. # script the optional local gate `pnpm run check:windows-wine` runs.
  339. # Current topology and fidelity limits live in
  340. # .agents/notes/implemented/process/2026-08-08-native-windows-pull-request-ci.md
  341. windows:
  342. if: github.event_name == 'pull_request'
  343. runs-on: ubuntu-latest
  344. name: windows node 24 / wine blocking
  345. timeout-minutes: 15
  346. steps:
  347. - uses: actions/checkout@v6
  348. with:
  349. persist-credentials: false
  350. - uses: pnpm/action-setup@v4
  351. with:
  352. dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
  353. - uses: actions/setup-node@v6
  354. with:
  355. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  356. - name: Configure pnpm store path
  357. id: pnpm-store
  358. run: |
  359. store_root="$HOME/.local/share/pnpm/store"
  360. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  361. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  362. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  363. - uses: actions/cache/restore@v4
  364. with:
  365. path: ${{ steps.pnpm-store.outputs.path }}
  366. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  367. restore-keys: |
  368. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  369. # Master's wine-apt-cache job in ci-master.yml seeds the default-branch
  370. # scope every pull request can read; a save from this job only reaches
  371. # reruns of the same merge ref.
  372. - name: Compose Wine apt cache key
  373. id: wine-cache-key
  374. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  375. - uses: actions/cache@v4
  376. with:
  377. path: ~/wine-debs
  378. key: ${{ steps.wine-cache-key.outputs.key }}
  379. # Runner provisioning only — a developer machine installs Wine through
  380. # its own package manager; the gate script assumes a wine binary and
  381. # fails loud without one. Wine from the apt cache when present; else
  382. # download the full dependency closure once and keep it for the next
  383. # run. The `wine` dispatcher package (not bare `wine64`) is what puts a
  384. # binary on PATH.
  385. - name: Install Wine
  386. run: |
  387. if compgen -G "$HOME/wine-debs/*.deb" > /dev/null; then
  388. # The restored archive is the full --download-only closure of
  389. # `wine` for this runner image, so installing the .debs directly
  390. # with dpkg needs no repository access. apt-get would instead
  391. # re-download the same 100+ MB closure from the mirror, which has
  392. # stalled the job past its budget on a degraded runner network.
  393. # If the archive cannot satisfy the closure, fall back to the apt
  394. # network install.
  395. if ! sudo DEBIAN_FRONTEND=noninteractive dpkg -i "$HOME"/wine-debs/*.deb; then
  396. sudo DEBIAN_FRONTEND=noninteractive dpkg --configure -a || true
  397. sudo apt-get install -y --no-install-recommends "$HOME"/wine-debs/*.deb
  398. fi
  399. else
  400. sudo apt-get update
  401. sudo apt-get install -y --no-install-recommends --download-only wine
  402. mkdir -p "$HOME/wine-debs"
  403. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/" 2>/dev/null || true
  404. sudo apt-get install -y --no-install-recommends wine
  405. fi
  406. - name: Run the Wine Windows gates
  407. run: bash scripts/wine-windows-gates.sh
  408. - name: Shut down wineserver
  409. if: always()
  410. run: wineserver -k 2>/dev/null || true
  411. # Every pull request also gets real Windows-kernel signals. The former
  412. # monolithic windows-native job is split into smaller jobs so one slow
  413. # coverage gate does not hold up build/static results, while the total
  414. # per-job process count stays lower. Observational checks are non-blocking.
  415. # Dependabot PRs are excluded from the self-hosted pool and stay queued for
  416. # the hosted runner.
  417. windows-build:
  418. if: github.event_name == 'pull_request'
  419. runs-on: >-
  420. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  421. && github.event.pull_request.user.login != 'dependabot[bot]'
  422. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  423. || 'dsh-windows-2025-16core' }}
  424. name: windows node 24 / build
  425. timeout-minutes: 60
  426. env:
  427. # A failing build or site aborts the sibling gate on the same runner.
  428. DSH_GATE_FAIL_FAST: '1'
  429. steps:
  430. - uses: actions/checkout@v6
  431. with:
  432. persist-credentials: false
  433. - name: Enable Developer Mode (symlink support)
  434. shell: pwsh
  435. run: >-
  436. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  437. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  438. - uses: pnpm/action-setup@v4
  439. with:
  440. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  441. - uses: actions/setup-node@v6
  442. with:
  443. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  444. - name: Install (immutable)
  445. shell: pwsh
  446. # See 2026-08-30-windows-refs-store-block-clone-install for the
  447. # ReFS block-clone rationale; detect the workspace filesystem and
  448. # pass --package-import-method=clone only on ReFS.
  449. run: >-
  450. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  451. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  452. if ($fs -eq 'ReFS') {
  453. corepack pnpm install --frozen-lockfile --package-import-method=clone
  454. } else {
  455. pnpm install --frozen-lockfile
  456. }
  457. - name: Run blocking Windows builds
  458. shell: pwsh
  459. run: pnpm run check:ci:windows-blocking
  460. windows-coverage:
  461. if: github.event_name == 'pull_request'
  462. runs-on: >-
  463. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  464. && github.event.pull_request.user.login != 'dependabot[bot]'
  465. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  466. || 'dsh-windows-2025-16core' }}
  467. name: windows node 24 / coverage
  468. timeout-minutes: 120
  469. env:
  470. DSH_COVERAGE_MAX_WORKERS: '6'
  471. DSH_COVERAGE_PARTITIONS: '4'
  472. DSH_COVERAGE_TEST_TIMEOUT_MS: '90000'
  473. DSH_GATE_CONCURRENCY: '3'
  474. # A gate failure aborts the sibling gate instead of waiting out its
  475. # multi-minute instrumented run.
  476. DSH_GATE_FAIL_FAST: '1'
  477. steps:
  478. - uses: actions/checkout@v6
  479. with:
  480. persist-credentials: false
  481. # Checkout removes the gitignored duration history, so restore it from
  482. # the GitHub cache before coverage and save the updated one afterwards.
  483. # The coordinator then weights partitions by measured durations on the
  484. # second run instead of degrading to a file-count split. GitHub cache
  485. # entries are immutable, so the save key is unique per run and the
  486. # restore matches the newest entry through the stable prefix.
  487. - name: Restore coverage duration history
  488. uses: actions/cache/restore@v4
  489. with:
  490. path: .coverage-times.json
  491. key: coverage-times-${{ github.run_id }}
  492. restore-keys: |
  493. coverage-times-
  494. - name: Enable Developer Mode (symlink support)
  495. shell: pwsh
  496. run: >-
  497. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  498. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  499. - uses: pnpm/action-setup@v4
  500. with:
  501. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  502. - uses: actions/setup-node@v6
  503. with:
  504. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  505. - name: Install (immutable)
  506. shell: pwsh
  507. # See 2026-08-30-windows-refs-store-block-clone-install for the
  508. # ReFS block-clone rationale; detect the workspace filesystem and
  509. # pass --package-import-method=clone only on ReFS.
  510. run: >-
  511. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  512. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  513. if ($fs -eq 'ReFS') {
  514. corepack pnpm install --frozen-lockfile --package-import-method=clone
  515. } else {
  516. pnpm install --frozen-lockfile
  517. }
  518. # No build before coverage, matching the Linux lane: workspace imports
  519. # resolve to src through the tsconfig paths map, and the lib-consuming
  520. # suites (webworker-packer image-loadable, webworker-runtime
  521. # transform-corpus, client ui-trajectory client-bundle) self-skip on
  522. # unbuilt checkouts.
  523. - name: Run Windows coverage
  524. shell: pwsh
  525. run: pnpm run check:ci:coverage
  526. - name: Save coverage duration history
  527. # Coverage flakes must not prevent the cache from building; the
  528. # measured durations remain useful even when a partition failed. The
  529. # per-run key keeps every save a fresh immutable cache entry.
  530. if: always()
  531. uses: actions/cache/save@v4
  532. with:
  533. path: .coverage-times.json
  534. key: coverage-times-${{ github.run_id }}
  535. windows-native-tests:
  536. if: github.event_name == 'pull_request'
  537. runs-on: >-
  538. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  539. && github.event.pull_request.user.login != 'dependabot[bot]'
  540. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  541. || 'dsh-windows-2025-16core' }}
  542. name: windows node 24 / native tests
  543. timeout-minutes: 60
  544. steps:
  545. - uses: actions/checkout@v6
  546. with:
  547. persist-credentials: false
  548. - name: Enable Developer Mode (symlink support)
  549. shell: pwsh
  550. run: >-
  551. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  552. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  553. - uses: pnpm/action-setup@v4
  554. with:
  555. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  556. - uses: actions/setup-node@v6
  557. with:
  558. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  559. - name: Install (immutable)
  560. shell: pwsh
  561. # See 2026-08-30-windows-refs-store-block-clone-install for the
  562. # ReFS block-clone rationale; detect the workspace filesystem and
  563. # pass --package-import-method=clone only on ReFS.
  564. run: >-
  565. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  566. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  567. if ($fs -eq 'ReFS') {
  568. corepack pnpm install --frozen-lockfile --package-import-method=clone
  569. } else {
  570. pnpm install --frozen-lockfile
  571. }
  572. - name: Run Windows-specific native tests
  573. shell: pwsh
  574. run: >-
  575. pnpm exec vitest run
  576. --no-file-parallelism
  577. --testTimeout 90000
  578. packages/shell/tool-pwsh/tests/loader.spec.ts
  579. packages/workflow/workflow-worker-thread/tests/workflow-worker-thread.spec.ts
  580. packages/workflow/tool-ralph/tests/integration.spec.ts
  581. packages/subprocess/subprocess-local/tests/process-exit.spec.ts
  582. windows-observational:
  583. if: github.event_name == 'pull_request'
  584. continue-on-error: true
  585. runs-on: >-
  586. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  587. && github.event.pull_request.user.login != 'dependabot[bot]'
  588. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  589. || 'dsh-windows-2025-16core' }}
  590. name: windows node 24 / observational
  591. timeout-minutes: 60
  592. env:
  593. DSH_PUBLINT_CONCURRENCY: '8'
  594. steps:
  595. - uses: actions/checkout@v6
  596. with:
  597. persist-credentials: false
  598. - name: Enable Developer Mode (symlink support)
  599. shell: pwsh
  600. run: >-
  601. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  602. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  603. - uses: pnpm/action-setup@v4
  604. with:
  605. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  606. - uses: actions/setup-node@v6
  607. with:
  608. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  609. - name: Install (immutable)
  610. shell: pwsh
  611. # See 2026-08-30-windows-refs-store-block-clone-install for the
  612. # ReFS block-clone rationale; detect the workspace filesystem and
  613. # pass --package-import-method=clone only on ReFS.
  614. run: >-
  615. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  616. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  617. if ($fs -eq 'ReFS') {
  618. corepack pnpm install --frozen-lockfile --package-import-method=clone
  619. } else {
  620. pnpm install --frozen-lockfile
  621. }
  622. - name: Run Windows observational gates
  623. shell: pwsh
  624. run: pnpm run check:ci:windows-observational
  625. # Single stable required check for branch protection: require "all checks
  626. # passed" instead of enumerating matrix legs whose names change as lanes and
  627. # node versions evolve. Every blocking job in THIS workflow must be listed in
  628. # `needs`. The required Wine job is listed as `windows`; `windows-native` is
  629. # deliberately absent so its independent result never delays or changes this
  630. # verdict. (`needs` cannot reach across workflow files; the master-only jobs in
  631. # ci-master.yml are intentionally not part of this PR verdict.)
  632. # `if: always()` is load-bearing: without it a failed dependency
  633. # would SKIP this job, and GitHub counts a skipped required check as passing
  634. # — so this job always runs and fails on any non-success result, including
  635. # 'cancelled' and 'skipped'.
  636. all-checks-passed:
  637. name: all checks passed
  638. # This bookkeeping-only verdict must not depend on custom-pool
  639. # provisioning — and under Linux failover it follows the same selector as
  640. # the worker jobs it aggregates, so a standard-hosted outage cannot strand
  641. # the branch-protection verdict either. It retargets with the Linux switch
  642. # (DSH_CI_FAILOVER_LINUX), not the Windows one, because it aggregates the
  643. # required Linux workers and runs on the vm-backup pool.
  644. runs-on: >-
  645. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  646. && github.event.pull_request.user.login != 'dependabot[bot]'
  647. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  648. || 'ubuntu-latest' }}
  649. needs: [node-24, node-24-coverage, node-24-bench, node-24-consumers, node-compat, python-sdk, python-runtime, windows, windows-build, windows-native-tests]
  650. if: always() && github.event_name == 'pull_request'
  651. steps:
  652. - name: Fail if any needed job did not succeed
  653. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  654. run: |
  655. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  656. exit 1
  657. - name: All checks passed
  658. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"