ci.yml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  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. # Blacksmith's Ubuntu HTTP archive endpoints can be unreachable while HTTPS works.
  289. - name: Use HTTPS for Ubuntu archives on Blacksmith
  290. if: vars.DSH_CI_FAILOVER_LINUX == 'blacksmith'
  291. run: |
  292. sudo python3 - <<'PY'
  293. from pathlib import Path
  294. import re
  295. apt = Path('/etc/apt')
  296. sources = [apt / 'sources.list', apt / 'blacksmith-ubuntu-mirrors.txt',
  297. *(apt / 'sources.list.d').glob('*.list'),
  298. *(apt / 'sources.list.d').glob('*.sources')]
  299. for source in sources:
  300. if source.is_file():
  301. source.write_text(re.sub(
  302. r'http://((?:[a-z]{2}\.)?archive\.ubuntu\.com|security\.ubuntu\.com)/',
  303. r'https://\1/', source.read_text()))
  304. PY
  305. - name: Install Playwright Chromium and hosted dependencies
  306. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  307. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install --with-deps chromium
  308. # The persistent VM image owns Playwright's Linux system packages; do
  309. # not mutate the shared host with apt on every failover run.
  310. - name: Install Playwright Chromium on the failover VM
  311. if: vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]'
  312. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install chromium
  313. - name: Run compatibility, snapshot, and artifact gates
  314. run: pnpm run check:ci:consumers
  315. node-compat:
  316. if: github.event_name == 'pull_request'
  317. # Under the selfhosted leg this job admits only repository-owned PR code
  318. # to the persistent shared VM; the blacksmith branch targets ephemeral
  319. # runners and carries none of those predicates.
  320. runs-on: >-
  321. ${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404'
  322. || vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  323. && github.event.pull_request.head.repo.full_name == github.repository
  324. && github.event.pull_request.head.repo.fork == false
  325. && github.event.pull_request.user.login != 'dependabot[bot]'
  326. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  327. || matrix.runner }}
  328. name: ${{ matrix.name }}
  329. env:
  330. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  331. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  332. # A failed smoke aborts the remaining compatibility gates instead of
  333. # letting the build-backed legs run against an already-red aggregate.
  334. DSH_GATE_FAIL_FAST: '1'
  335. strategy:
  336. fail-fast: false
  337. matrix:
  338. include:
  339. - node: '22.19'
  340. name: node 22.19
  341. runner: ubuntu-latest
  342. gate_concurrency: '1'
  343. # Pinned inside 24.0-24.11.1: those releases carry the v1 internal
  344. # loader while reporting major 24, and every other job tracks the
  345. # latest 24, which is v2. A bare `24` here would retest that same v2.
  346. - node: '24.9'
  347. name: node 24.9
  348. runner: ubuntu-latest
  349. gate_concurrency: '1'
  350. - node: 26
  351. name: node 26
  352. runner: ubuntu-latest
  353. gate_concurrency: '1'
  354. steps:
  355. - uses: actions/checkout@v6
  356. with:
  357. persist-credentials: false
  358. # Shared hosts keep version installs and generated caches inside runner temp.
  359. - name: Isolate compatibility caches
  360. if: runner.environment == 'self-hosted'
  361. run: |
  362. echo "NODE_COMPILE_CACHE=$RUNNER_TEMP/node-compile-cache" >> "$GITHUB_ENV"
  363. echo "npm_config_devdir=$RUNNER_TEMP/node-gyp" >> "$GITHUB_ENV"
  364. echo "PNPM_CONFIG_STORE_DIR=$HOME/.local/share/pnpm/store" >> "$GITHUB_ENV"
  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. env:
  370. # The runner overwrites RUNNER_* step env before starting JavaScript actions.
  371. NODE_OPTIONS: ${{ runner.environment == 'self-hosted' && '--import=./scripts/ci-compatible-toolcache.mjs' || '' }}
  372. with:
  373. node-version: ${{ matrix.node }}
  374. cache: ${{ runner.environment == 'github-hosted' && 'pnpm' || '' }}
  375. package-manager-cache: false
  376. - name: Verify isolated Node installation
  377. if: runner.environment == 'self-hosted'
  378. run: |
  379. node_path=$(node -p process.execPath)
  380. echo "Node executable: $node_path"
  381. case "$node_path" in
  382. "$RUNNER_TEMP/node-compat-toolcache/"*) ;;
  383. *) echo "::error::Node compatibility installation is outside runner temp"; exit 1 ;;
  384. esac
  385. - name: Install (immutable)
  386. run: pnpm install --frozen-lockfile
  387. - name: Run compatibility smokes
  388. env:
  389. DSH_BUILD_CLIENT_PROFILE: official
  390. run: pnpm run check:node-compat
  391. # Kept out of the gate aggregate: the shape a Node release carries only
  392. # changes with the Node version, so this belongs to the version matrix
  393. # rather than to every commit's checks.
  394. - name: Check Loader internal shape detection
  395. run: pnpm exec vitest run packages/boot/app-boot/tests/loader-shape.compat.spec.ts
  396. python-sdk:
  397. if: github.event_name == 'pull_request'
  398. runs-on: ubuntu-latest
  399. name: python 3.10 / keyless SDK
  400. steps:
  401. - uses: actions/checkout@v6
  402. - uses: actions/setup-python@v6.3.0
  403. with:
  404. python-version: '3.10'
  405. cache: pip
  406. - name: Install uv
  407. run: python -m pip install uv==0.11.23
  408. - name: Run complete keyless Python suite
  409. run: uv run --python 3.10 --group test --project python/sdk pytest
  410. # The reusable builder owns each published executable, wheel, clean-install,
  411. # keyless black-box, and trusted real-API path. Linux/Windows x64 block PRs;
  412. # Linux ARM64 and both macOS architectures run in ci-master.yml.
  413. python-runtime:
  414. if: github.event_name == 'pull_request'
  415. name: python runtime / release-shaped matrix
  416. uses: ./.github/workflows/build-exe-for-python-sdk.yml
  417. with:
  418. targets: node24-linux-x64,node24-win-x64
  419. ci: true
  420. secrets:
  421. DEEPSEEK_API_KEY_EXTERNAL: ${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }}
  422. # Every pull request also gets real Windows-kernel signals. The former
  423. # monolithic windows-native job is split into smaller jobs so one slow
  424. # coverage gate does not hold up build/static results, while the total
  425. # per-job process count stays lower. Observational checks are non-blocking.
  426. # Dependabot PRs are excluded from the self-hosted pool and stay queued for
  427. # the hosted runner.
  428. windows-build:
  429. if: github.event_name == 'pull_request'
  430. runs-on: >-
  431. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith' && 'blacksmith-16vcpu-windows-2025'
  432. || vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  433. && github.event.pull_request.user.login != 'dependabot[bot]'
  434. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  435. || 'dsh-windows-2025-16core' }}
  436. name: windows node 24 / build
  437. timeout-minutes: 60
  438. env:
  439. # A failing build or site aborts the sibling gate on the same runner.
  440. DSH_GATE_FAIL_FAST: '1'
  441. steps:
  442. - uses: actions/checkout@v6
  443. with:
  444. persist-credentials: false
  445. - name: Enable Developer Mode (symlink support)
  446. shell: pwsh
  447. run: >-
  448. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  449. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  450. - uses: pnpm/action-setup@v4
  451. with:
  452. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  453. - uses: actions/setup-node@v6
  454. with:
  455. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  456. - name: Install (immutable)
  457. shell: pwsh
  458. # See 2026-08-30-windows-refs-store-block-clone-install for the
  459. # ReFS block-clone rationale; detect the workspace filesystem and
  460. # pass --package-import-method=clone only on ReFS.
  461. run: >-
  462. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  463. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  464. if ($fs -eq 'ReFS') {
  465. corepack pnpm install --frozen-lockfile --package-import-method=clone
  466. } else {
  467. pnpm install --frozen-lockfile
  468. }
  469. - name: Run blocking Windows builds
  470. shell: pwsh
  471. run: pnpm run check:ci:windows-blocking
  472. windows-coverage:
  473. if: github.event_name == 'pull_request'
  474. runs-on: >-
  475. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith' && 'blacksmith-16vcpu-windows-2025'
  476. || vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  477. && github.event.pull_request.user.login != 'dependabot[bot]'
  478. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  479. || 'dsh-windows-2025-16core' }}
  480. name: windows node 24 / coverage
  481. timeout-minutes: 120
  482. env:
  483. DSH_COVERAGE_MAX_WORKERS: '6'
  484. DSH_COVERAGE_PARTITIONS: '4'
  485. DSH_COVERAGE_TEST_TIMEOUT_MS: '90000'
  486. DSH_GATE_CONCURRENCY: '3'
  487. # A gate failure aborts the sibling gate instead of waiting out its
  488. # multi-minute instrumented run.
  489. DSH_GATE_FAIL_FAST: '1'
  490. steps:
  491. - uses: actions/checkout@v6
  492. with:
  493. persist-credentials: false
  494. # Checkout removes the gitignored duration history, so restore it from
  495. # the GitHub cache before coverage and save the updated one afterwards.
  496. # The coordinator then weights partitions by measured durations on the
  497. # second run instead of degrading to a file-count split. GitHub cache
  498. # entries are immutable, so the save key is unique per run and the
  499. # restore matches the newest entry through the stable prefix.
  500. - name: Restore coverage duration history
  501. uses: actions/cache/restore@v4
  502. with:
  503. path: .coverage-times.json
  504. key: coverage-times-${{ github.run_id }}
  505. restore-keys: |
  506. coverage-times-
  507. - name: Enable Developer Mode (symlink support)
  508. shell: pwsh
  509. run: >-
  510. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  511. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  512. - uses: pnpm/action-setup@v4
  513. with:
  514. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  515. - uses: actions/setup-node@v6
  516. with:
  517. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  518. - name: Install (immutable)
  519. shell: pwsh
  520. # See 2026-08-30-windows-refs-store-block-clone-install for the
  521. # ReFS block-clone rationale; detect the workspace filesystem and
  522. # pass --package-import-method=clone only on ReFS.
  523. run: >-
  524. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  525. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  526. if ($fs -eq 'ReFS') {
  527. corepack pnpm install --frozen-lockfile --package-import-method=clone
  528. } else {
  529. pnpm install --frozen-lockfile
  530. }
  531. # No build before coverage, matching the Linux lane: workspace imports
  532. # resolve to src through the tsconfig paths map, and the lib-consuming
  533. # suites (webworker-packer image-loadable, webworker-runtime
  534. # transform-corpus, client ui-trajectory client-bundle) self-skip on
  535. # unbuilt checkouts.
  536. - name: Run Windows coverage
  537. shell: pwsh
  538. run: pnpm run check:ci:coverage
  539. - name: Save coverage duration history
  540. # Coverage flakes must not prevent the cache from building; the
  541. # measured durations remain useful even when a partition failed. The
  542. # per-run key keeps every save a fresh immutable cache entry.
  543. if: ${{ !cancelled() }}
  544. uses: actions/cache/save@v4
  545. with:
  546. path: .coverage-times.json
  547. key: coverage-times-${{ github.run_id }}
  548. windows-native-tests:
  549. if: github.event_name == 'pull_request'
  550. runs-on: >-
  551. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith' && 'blacksmith-16vcpu-windows-2025'
  552. || vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  553. && github.event.pull_request.user.login != 'dependabot[bot]'
  554. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  555. || 'dsh-windows-2025-16core' }}
  556. name: windows node 24 / native tests
  557. timeout-minutes: 60
  558. steps:
  559. - uses: actions/checkout@v6
  560. with:
  561. persist-credentials: false
  562. - name: Enable Developer Mode (symlink support)
  563. shell: pwsh
  564. run: >-
  565. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  566. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  567. - uses: pnpm/action-setup@v4
  568. with:
  569. dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
  570. - uses: actions/setup-node@v6
  571. with:
  572. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  573. - name: Install (immutable)
  574. shell: pwsh
  575. # See 2026-08-30-windows-refs-store-block-clone-install for the
  576. # ReFS block-clone rationale; detect the workspace filesystem and
  577. # pass --package-import-method=clone only on ReFS.
  578. run: >-
  579. $drive = (Split-Path -Qualifier $env:GITHUB_WORKSPACE).TrimEnd(':');
  580. $fs = (Get-Volume -DriveLetter $drive).FileSystem;
  581. if ($fs -eq 'ReFS') {
  582. corepack pnpm install --frozen-lockfile --package-import-method=clone
  583. } else {
  584. pnpm install --frozen-lockfile
  585. }
  586. - name: Run Windows-specific native tests
  587. shell: pwsh
  588. run: >-
  589. pnpm exec vitest run
  590. --no-file-parallelism
  591. --testTimeout 90000
  592. packages/shell/tool-pwsh/tests/loader.spec.ts
  593. packages/workflow/workflow-worker-thread/tests/workflow-worker-thread.spec.ts
  594. packages/workflow/tool-ralph/tests/integration.spec.ts
  595. packages/subprocess/subprocess-local/tests/process-exit.spec.ts
  596. windows-observational:
  597. if: github.event_name == 'pull_request'
  598. continue-on-error: true
  599. runs-on: >-
  600. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith' && 'blacksmith-16vcpu-windows-2025'
  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`. Native Windows build and process checks are required; Wine and
  644. # the deferred Python runtime targets live in ci-master.yml and do not
  645. # participate in this PR verdict. `needs` cannot cross workflow files.
  646. # An explicit status function runs the verdict after failed/skipped needs
  647. # without keeping a cancelled workflow alive for an obsolete verdict.
  648. all-checks-passed:
  649. name: all checks passed
  650. # This bookkeeping-only verdict must not depend on custom-pool
  651. # provisioning — and under Linux failover it follows the same selector as
  652. # the worker jobs it aggregates, so a standard-hosted outage cannot strand
  653. # the branch-protection verdict either. It retargets with the Linux switch
  654. # (DSH_CI_FAILOVER_LINUX), not the Windows one, because it aggregates the
  655. # required Linux workers and runs on the vm-backup pool. Under the
  656. # 'blacksmith' value the verdict shares Blacksmith's pool with its workers
  657. # through the same selector, so a Blacksmith outage strands both together —
  658. # the accepted consequence of the explicit opt-in switch.
  659. runs-on: >-
  660. ${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404'
  661. || vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  662. && github.event.pull_request.user.login != 'dependabot[bot]'
  663. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  664. || 'ubuntu-latest' }}
  665. needs: [node-24, node-24-coverage, node-24-bench, node-24-consumers, node-compat, python-sdk, python-runtime, windows-build, windows-native-tests]
  666. if: ${{ !cancelled() && github.event_name == 'pull_request' }}
  667. steps:
  668. - name: Fail if any needed job did not succeed
  669. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  670. run: |
  671. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  672. exit 1
  673. - name: All checks passed
  674. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"