ci.yml 32 KB

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