ci.yml 31 KB

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