ci.yml 30 KB

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