ci.yml 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937
  1. name: CI
  2. on:
  3. push:
  4. branches: [master]
  5. pull_request:
  6. workflow_dispatch:
  7. inputs:
  8. suite:
  9. description: Manual CI suite to run
  10. required: true
  11. default: larger-runner-benchmark
  12. type: choice
  13. options:
  14. - larger-runner-benchmark
  15. - consolidated-runner-benchmark
  16. # Cancel a superseded run on every event EXCEPT push. A push run carries the two
  17. # self-hosted standby drills, which take longer than the interval between master
  18. # merges, so cancelling supersedes a drill before it reaches a verdict and the
  19. # lane yields no readiness evidence. Must be decided here: cancellation applies
  20. # to the whole superseded run, so a job-level group cannot exempt its job.
  21. # Negated rather than `== 'pull_request'` so workflow_dispatch keeps cancelling:
  22. # a re-dispatched runner benchmark holds up to 12 larger runners for 15 minutes
  23. # and shares this group with the drills on master, so queueing it would delay
  24. # them. The guarantee is narrow — evaluated against the newly triggered run, so a
  25. # dispatch on master still cancels a mid-flight drill, and a newer pending push
  26. # displaces an older one. Bounds and rationale:
  27. # .agents/notes/implemented/process/2026-07-26-ci-failover-runbook.md
  28. concurrency:
  29. group: ${{ github.workflow }}-${{ github.ref }}
  30. cancel-in-progress: ${{ github.event_name != 'push' }}
  31. permissions:
  32. contents: read
  33. env:
  34. PRIMARY_NODE_VERSION: '24'
  35. # CI runs must never report to the production telemetry endpoint baked
  36. # into apps/cli/cordis.yml (AppCLIEntry disables the row when set).
  37. DSH_TELEMETRY_DISABLED: '1'
  38. jobs:
  39. # TODO(hosted-serial-ci): Re-enable the three hosted serial reference jobs before release.
  40. # The self-hosted standby remains active on every master push.
  41. # Three enterprise jobs isolate coverage, static analysis, and the
  42. # build-backed consumer tail. The consumer job owns the only Linux build so
  43. # all three jobs enter runner allocation independently.
  44. #
  45. # FAILOVER (Linux): each Linux enterprise job resolves its pool through the
  46. # DSH_CI_FAILOVER_LINUX repository variable. Unset (normal), the expressions
  47. # pick the hosted enterprise pools below. Setting the variable to
  48. # 'selfhosted' (repo Settings → Actions → Variables; writer-manageable
  49. # repository state — not PR-editable, no merge required) retargets all
  50. # three onto the in-house
  51. # vm-backup pool and re-running the failed jobs is the entire switch —
  52. # see .agents/notes/implemented/process/2026-07-26-ci-failover-runbook.md. The
  53. # in-house pool's readiness is re-proven on every master push by the
  54. # serial-linux-selfhosted standby lane below. The Windows failover switch is
  55. # the separate DSH_CI_FAILOVER_WINDOWS variable on the windows-native job below.
  56. node-24:
  57. if: github.event_name == 'pull_request'
  58. runs-on: >-
  59. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  60. && github.event.pull_request.user.login != 'dependabot[bot]'
  61. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  62. || 'dsh-ubuntu-24-04-16core' }}
  63. name: node 24 / static
  64. env:
  65. DSH_GATE_CONCURRENCY: '8'
  66. steps:
  67. # Fetch complete history so the archive gate can read the trusted PR base from a reused shallow checkout.
  68. - uses: actions/checkout@v6
  69. with:
  70. fetch-depth: 0
  71. persist-credentials: false
  72. - uses: pnpm/action-setup@v4
  73. with:
  74. dest: ${{ runner.temp }}/setup-pnpm
  75. - uses: actions/setup-node@v6
  76. with:
  77. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  78. - name: Configure pnpm store path
  79. id: pnpm-store
  80. run: |
  81. store_root="$HOME/.local/share/pnpm/store"
  82. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  83. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  84. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  85. # Pull requests consume the default-branch cache but do not put cache
  86. # compression and upload on the paid latency-critical path. Skipped
  87. # under failover — see the coverage lane's identical rationale.
  88. - uses: actions/cache/restore@v4
  89. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  90. with:
  91. path: ${{ steps.pnpm-store.outputs.path }}
  92. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  93. restore-keys: |
  94. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  95. - name: Install (immutable)
  96. run: pnpm install --frozen-lockfile
  97. - name: Run static gates
  98. env:
  99. DSH_ARCHIVE_BASE_REF: ${{ github.event.pull_request.base.sha }}
  100. run: pnpm run check:ci:static
  101. node-24-coverage:
  102. if: github.event_name == 'pull_request'
  103. runs-on: >-
  104. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  105. && github.event.pull_request.user.login != 'dependabot[bot]'
  106. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  107. || 'dsh-ubuntu-24-04-16core' }}
  108. name: node 24 / coverage
  109. env:
  110. # The hosted 16-core runner uses six coverage workers. The failover pool
  111. # shares one 64-core VM across six always-on runner instances, so each
  112. # instance may use eight while keeping the worst case at 8 × 6 = 48
  113. # workers; process-bound suites remain isolated in forks.
  114. DSH_COVERAGE_MAX_WORKERS: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '8' || '6' }}
  115. DSH_GATE_CONCURRENCY: '3'
  116. steps:
  117. - uses: actions/checkout@v6
  118. with:
  119. persist-credentials: false
  120. - uses: pnpm/action-setup@v4
  121. with:
  122. dest: ${{ runner.temp }}/setup-pnpm
  123. - uses: actions/setup-node@v6
  124. with:
  125. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  126. - name: Configure pnpm store path
  127. id: pnpm-store
  128. run: |
  129. store_root="$HOME/.local/share/pnpm/store"
  130. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  131. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  132. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  133. # Skipped under failover: the self-hosted VM's persistent pnpm store
  134. # already serves warm installs, while restoring the hosted archive
  135. # would spend ~52 s pulling ~180 MB into that populated store.
  136. - uses: actions/cache/restore@v4
  137. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  138. with:
  139. path: ${{ steps.pnpm-store.outputs.path }}
  140. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  141. restore-keys: |
  142. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  143. - name: Install dependencies and prepare bubblewrap
  144. run: |
  145. pnpm install --frozen-lockfile &
  146. install_pid=$!
  147. bash scripts/prepare-ci-bubblewrap.sh &
  148. sandbox_pid=$!
  149. install_status=0
  150. wait "$install_pid" || install_status=$?
  151. sandbox_status=0
  152. wait "$sandbox_pid" || sandbox_status=$?
  153. if (( install_status != 0 )); then exit "$install_status"; fi
  154. exit "$sandbox_status"
  155. - name: Run exhaustive coverage
  156. run: pnpm run check:ci:coverage
  157. node-24-consumers:
  158. if: github.event_name == 'pull_request'
  159. runs-on: >-
  160. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  161. && github.event.pull_request.user.login != 'dependabot[bot]'
  162. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  163. || 'dsh-ubuntu-24-04-16core' }}
  164. name: node 24 / snapshots and artifacts
  165. env:
  166. DSH_GATE_CONCURRENCY: '8'
  167. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  168. DSH_OXLINT_THREADS: '8'
  169. DSH_PUBLINT_CONCURRENCY: '8'
  170. # Failover halves snapshot concurrency for the shared 64-core VM.
  171. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]' && '12' || '32' }}
  172. steps:
  173. - uses: actions/checkout@v6
  174. with:
  175. persist-credentials: false
  176. - uses: pnpm/action-setup@v4
  177. with:
  178. dest: ${{ runner.temp }}/setup-pnpm
  179. - uses: actions/setup-node@v6
  180. with:
  181. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  182. - name: Configure pnpm store path
  183. id: pnpm-store
  184. run: |
  185. store_root="$HOME/.local/share/pnpm/store"
  186. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  187. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  188. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  189. # Skipped under failover — see the coverage lane's identical rationale.
  190. - uses: actions/cache/restore@v4
  191. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  192. with:
  193. path: ${{ steps.pnpm-store.outputs.path }}
  194. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  195. restore-keys: |
  196. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  197. # Pull requests restore the cache normally produced by serial-linux on
  198. # master; they do not pay compression and upload on the required path.
  199. - uses: actions/cache/restore@v4
  200. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  201. with:
  202. path: ~/.cache/ms-playwright
  203. key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
  204. restore-keys: |
  205. ${{ runner.os }}-playwright-
  206. - name: Install dependencies and prepare bubblewrap
  207. run: |
  208. pnpm install --frozen-lockfile &
  209. install_pid=$!
  210. bash scripts/prepare-ci-bubblewrap.sh &
  211. sandbox_pid=$!
  212. install_status=0
  213. wait "$install_pid" || install_status=$?
  214. sandbox_status=0
  215. wait "$sandbox_pid" || sandbox_status=$?
  216. if (( install_status != 0 )); then exit "$install_status"; fi
  217. exit "$sandbox_status"
  218. - name: Install Playwright Chromium and hosted dependencies
  219. if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
  220. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install --with-deps chromium
  221. # The persistent VM image owns Playwright's Linux system packages; do
  222. # not mutate the shared host with apt on every failover run.
  223. - name: Install Playwright Chromium on the failover VM
  224. if: vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' && github.event.pull_request.user.login != 'dependabot[bot]'
  225. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install chromium
  226. - name: Run compatibility, snapshot, and artifact gates
  227. run: pnpm run check:ci:consumers
  228. node-compat:
  229. if: github.event_name == 'pull_request'
  230. # Each compatibility contract receives an independent standard hosted job.
  231. runs-on: ${{ matrix.runner }}
  232. name: ${{ matrix.name }}
  233. env:
  234. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  235. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  236. strategy:
  237. fail-fast: false
  238. matrix:
  239. include:
  240. - node: '22.19'
  241. name: node 22.19
  242. runner: ubuntu-latest
  243. gate_concurrency: '1'
  244. - node: 26
  245. name: node 26
  246. runner: ubuntu-latest
  247. gate_concurrency: '1'
  248. steps:
  249. - uses: actions/checkout@v6
  250. - uses: pnpm/action-setup@v4
  251. with:
  252. dest: ${{ runner.temp }}/setup-pnpm
  253. - uses: actions/setup-node@v6
  254. with:
  255. node-version: ${{ matrix.node }}
  256. cache: pnpm
  257. - name: Install (immutable)
  258. run: pnpm install --frozen-lockfile
  259. - name: Run compatibility smokes
  260. run: pnpm run check:node-compat
  261. python-sdk:
  262. if: github.event_name == 'pull_request'
  263. runs-on: ubuntu-latest
  264. name: python 3.10 / keyless SDK
  265. steps:
  266. - uses: actions/checkout@v6
  267. - uses: actions/setup-python@v6.3.0
  268. with:
  269. python-version: '3.10'
  270. cache: pip
  271. - name: Install uv
  272. run: python -m pip install uv==0.11.23
  273. - name: Run complete keyless Python suite
  274. run: uv run --python 3.10 --group test --project python/sdk pytest
  275. # One native target makes the complete release-shaped Python path required
  276. # without duplicating platform-independent behavior across the release matrix.
  277. # The reusable builder owns the executable, snapshot, wheel, clean-install,
  278. # GLIBC, and manylinux checks; release validation retains all native targets.
  279. python-runtime:
  280. if: github.event_name == 'pull_request'
  281. name: python runtime / release-shaped Linux x64
  282. uses: ./.github/workflows/build-exe-for-python-sdk.yml
  283. with:
  284. targets: node24-linux-x64
  285. ci: true
  286. # The required pull-request Windows signal: the two blocking win32 surfaces
  287. # (workspace build, production site) execute with real, checksum-verified
  288. # Windows Node under Wine on standard hosted Linux. The independent
  289. # windows-native job below keeps the complete native-kernel inventory —
  290. # including the observational portability gates this lane does not run —
  291. # on real Windows. This job only provisions runner state (caches,
  292. # apt); scripts/wine-windows-gates.sh owns the gate logic and is the same
  293. # script the optional local gate `pnpm run check:windows-wine` runs.
  294. # Current topology and fidelity limits live in
  295. # .agents/notes/implemented/process/2026-08-08-native-windows-pull-request-ci.md
  296. windows:
  297. if: github.event_name == 'pull_request'
  298. runs-on: ubuntu-latest
  299. name: windows node 24 / wine blocking
  300. timeout-minutes: 15
  301. steps:
  302. - uses: actions/checkout@v6
  303. with:
  304. persist-credentials: false
  305. - uses: pnpm/action-setup@v4
  306. with:
  307. dest: ${{ runner.temp }}/setup-pnpm
  308. - uses: actions/setup-node@v6
  309. with:
  310. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  311. - name: Configure pnpm store path
  312. id: pnpm-store
  313. run: |
  314. store_root="$HOME/.local/share/pnpm/store"
  315. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  316. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  317. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  318. - uses: actions/cache/restore@v4
  319. with:
  320. path: ${{ steps.pnpm-store.outputs.path }}
  321. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  322. restore-keys: |
  323. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  324. # Master's wine-apt-cache job seeds the default-branch scope every pull
  325. # request can read; a save from this job only reaches reruns of the
  326. # same merge ref.
  327. - name: Compose Wine apt cache key
  328. id: wine-cache-key
  329. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  330. - uses: actions/cache@v4
  331. with:
  332. path: ~/wine-debs
  333. key: ${{ steps.wine-cache-key.outputs.key }}
  334. # Runner provisioning only — a developer machine installs Wine through
  335. # its own package manager; the gate script assumes a wine binary and
  336. # fails loud without one. Wine from the apt cache when present; else
  337. # download the full dependency closure once and keep it for the next
  338. # run. The `wine` dispatcher package (not bare `wine64`) is what puts a
  339. # binary on PATH.
  340. - name: Install Wine
  341. run: |
  342. if compgen -G "$HOME/wine-debs/*.deb" > /dev/null; then
  343. sudo apt-get install -y --no-install-recommends "$HOME"/wine-debs/*.deb
  344. else
  345. sudo apt-get update
  346. sudo apt-get install -y --no-install-recommends --download-only wine
  347. mkdir -p "$HOME/wine-debs"
  348. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/" 2>/dev/null || true
  349. sudo apt-get install -y --no-install-recommends wine
  350. fi
  351. - name: Run the Wine Windows gates
  352. run: bash scripts/wine-windows-gates.sh
  353. - name: Shut down wineserver
  354. if: always()
  355. run: wineserver -k 2>/dev/null || true
  356. # Master seeds the Wine apt-archive cache in the default-branch scope,
  357. # which every pull request's windows job can restore; saves from
  358. # pull-request runs are scoped to their own merge ref and help nobody
  359. # else. Runs in seconds when the image version already has a cache.
  360. wine-apt-cache:
  361. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  362. name: wine apt cache
  363. runs-on: ubuntu-latest
  364. timeout-minutes: 10
  365. steps:
  366. - name: Compose Wine apt cache key
  367. id: wine-cache-key
  368. run: echo "key=wine-debs-${ImageOS:-linux}-${ImageVersion:-v0}" >> "$GITHUB_OUTPUT"
  369. - uses: actions/cache@v4
  370. id: wine-cache
  371. with:
  372. path: ~/wine-debs
  373. key: ${{ steps.wine-cache-key.outputs.key }}
  374. - name: Download the Wine dependency closure
  375. if: steps.wine-cache.outputs.cache-hit != 'true'
  376. run: |
  377. sudo apt-get update
  378. sudo apt-get install -y --no-install-recommends --download-only wine
  379. mkdir -p "$HOME/wine-debs"
  380. cp /var/cache/apt/archives/*.deb "$HOME/wine-debs/"
  381. du -sh "$HOME/wine-debs"
  382. # Every pull request also gets a real Windows-kernel signal. This job keeps
  383. # its own unmasked conclusion but is deliberately absent from
  384. # all-checks-passed.needs, so it never delays or changes that required
  385. # verdict. Under normal operation it runs on the hosted larger runner; under
  386. # Windows failover (DSH_CI_FAILOVER_WINDOWS=selfhosted) it retargets onto the
  387. # in-house self-hosted Windows pool. Dependabot PRs are excluded from the
  388. # self-hosted pool and stay queued for the hosted runner — see the failover
  389. # runbook. This Windows switch is independent of the Linux
  390. # DSH_CI_FAILOVER_LINUX variable that retargets the three required Linux jobs
  391. # and the all-checks-passed verdict above.
  392. windows-native:
  393. if: github.event_name == 'pull_request'
  394. runs-on: >-
  395. ${{ vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
  396. && github.event.pull_request.user.login != 'dependabot[bot]'
  397. && fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
  398. || 'dsh-windows-2025-16core' }}
  399. name: windows node 24 / native complete
  400. timeout-minutes: 60
  401. env:
  402. DSH_COVERAGE_MAX_WORKERS: '2'
  403. DSH_GATE_CONCURRENCY: '2'
  404. DSH_PUBLINT_CONCURRENCY: '8'
  405. steps:
  406. - uses: actions/checkout@v6
  407. with:
  408. persist-credentials: false
  409. - name: Enable Developer Mode (symlink support)
  410. shell: pwsh
  411. run: >-
  412. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  413. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  414. - uses: pnpm/action-setup@v4
  415. with:
  416. dest: ${{ runner.temp }}/setup-pnpm
  417. - uses: actions/setup-node@v6
  418. with:
  419. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  420. # Extracting the many-file pnpm store cache is slower than a clean
  421. # install on hosted Windows runners, and saving it adds latency after
  422. # the gates. The self-hosted VM's persistent store makes caching
  423. # redundant.
  424. - name: Install (immutable)
  425. shell: pwsh
  426. run: pnpm install --frozen-lockfile
  427. - name: Run complete native Windows gate inventory
  428. shell: pwsh
  429. run: pnpm run check:ci:windows-complete
  430. # The hosted reference jobs below are temporarily disabled; the self-hosted
  431. # standby remains active. Each enabled host executes the complete, unsharded
  432. # primary Node aggregate with one gate worker, giving reviewers a simple
  433. # cross-platform oracle for completeness and timing.
  434. serial-linux:
  435. if: false
  436. name: serial / linux
  437. runs-on: ubuntu-latest
  438. steps:
  439. - uses: actions/checkout@v6
  440. with:
  441. fetch-depth: 2
  442. - uses: pnpm/action-setup@v4
  443. with:
  444. dest: ${{ runner.temp }}/setup-pnpm
  445. - uses: actions/setup-node@v6
  446. with:
  447. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  448. - name: Configure pnpm store path
  449. id: pnpm-store
  450. run: |
  451. store_root="$HOME/.local/share/pnpm/store"
  452. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  453. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  454. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  455. # Master refreshes the pnpm store cache that pull requests restore without saving.
  456. # The store cache stays a hand-rolled actions/cache step rather than
  457. # setup-node's `cache: pnpm`: the enterprise pull-request jobs above
  458. # restore exactly this key and path, and setup-node's built-in cache
  459. # uses its own key format — converting this producer would silently
  460. # starve their documented restore-only optimization.
  461. - uses: actions/cache@v4
  462. with:
  463. path: ${{ steps.pnpm-store.outputs.path }}
  464. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  465. restore-keys: |
  466. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  467. # Master produces the hosted Chromium cache restored by pull requests.
  468. - uses: actions/cache@v4
  469. with:
  470. path: ~/.cache/ms-playwright
  471. key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
  472. restore-keys: |
  473. ${{ runner.os }}-playwright-
  474. - name: Install (immutable)
  475. run: pnpm install --frozen-lockfile
  476. - name: Install Playwright Chromium and system dependencies
  477. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install --with-deps chromium
  478. - name: Prepare bubblewrap (unrestrict userns)
  479. run: bash scripts/prepare-ci-bubblewrap.sh
  480. - name: Run complete unsharded primary Node CI serially
  481. env:
  482. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  483. DSH_COVERAGE_MAX_WORKERS: '1'
  484. DSH_E2E_MAX_WORKERS: '1'
  485. DSH_GATE_CONCURRENCY: '1'
  486. DSH_OXLINT_THREADS: '1'
  487. DSH_PUBLINT_CONCURRENCY: '1'
  488. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  489. run: pnpm run check:ci:linux-primary
  490. # Hot-standby drill for the in-house self-hosted pool: every master move
  491. # re-runs the complete unsharded aggregate on the persistent 64-core VM,
  492. # continuously proving that environment can take over a required lane if
  493. # the hosted pools degrade (the switch is then setting the writer-manageable
  494. # DSH_CI_FAILOVER_LINUX variable — see the failover runbook, no merge required).
  495. # Push-triggered, so this lane always executes the base branch's own
  496. # workflow definition. (Under failover, pull_request jobs do reach these
  497. # runners with the PR merge ref's workflow — the boundary there is
  498. # repository membership: private, forking disabled, Dependabot excluded.)
  499. # Non-blocking for
  500. # pull requests; no cache steps because the VM's persistent pnpm store and
  501. # tool caches make them redundant (and saving here would poison the hosted
  502. # cache namespace with self-hosted paths).
  503. serial-linux-selfhosted:
  504. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  505. name: serial / linux (self-hosted standby)
  506. runs-on: [self-hosted, linux, x64, vm-backup]
  507. steps:
  508. # Full history + DSH_ARCHIVE_BASE_REF below: same frozen-archive
  509. # comparison as serial-linux. Depth 2 would miss github.event.before
  510. # on multi-commit or force pushes; full fetch is cheap here because
  511. # checkout resolves against the VM's local mirror.
  512. - uses: actions/checkout@v6
  513. with:
  514. fetch-depth: 0
  515. - uses: pnpm/action-setup@v4
  516. with:
  517. dest: ${{ runner.temp }}/setup-pnpm
  518. - uses: actions/setup-node@v6
  519. with:
  520. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  521. - name: Configure persistent pnpm store
  522. run: echo "PNPM_CONFIG_STORE_DIR=$HOME/.local/share/pnpm/store" >> "$GITHUB_ENV"
  523. - name: Install (immutable)
  524. run: pnpm install --frozen-lockfile
  525. # The persistent VM image owns Playwright's Linux system packages; this
  526. # step also proves that browser provisioning remains usable for failover.
  527. - name: Install Playwright Chromium
  528. run: pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install chromium
  529. - name: Prepare bubblewrap (unrestrict userns)
  530. run: bash scripts/prepare-ci-bubblewrap.sh
  531. - name: Run complete unsharded primary Node CI serially
  532. env:
  533. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  534. DSH_COVERAGE_MAX_WORKERS: '1'
  535. DSH_E2E_MAX_WORKERS: '1'
  536. DSH_GATE_CONCURRENCY: '1'
  537. DSH_OXLINT_THREADS: '1'
  538. DSH_PUBLINT_CONCURRENCY: '1'
  539. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  540. run: pnpm run check:ci:linux-primary
  541. serial-macos:
  542. if: false
  543. name: serial / macos
  544. runs-on: macos-latest
  545. steps:
  546. - uses: actions/checkout@v6
  547. - uses: pnpm/action-setup@v4
  548. with:
  549. dest: ${{ runner.temp }}/setup-pnpm
  550. - uses: actions/setup-node@v6
  551. with:
  552. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  553. - name: Install (immutable)
  554. run: pnpm install --frozen-lockfile
  555. - name: Run complete unsharded primary Node CI serially
  556. env:
  557. DSH_COVERAGE_MAX_WORKERS: '1'
  558. DSH_E2E_MAX_WORKERS: '1'
  559. DSH_GATE_CONCURRENCY: '1'
  560. DSH_PUBLINT_CONCURRENCY: '1'
  561. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  562. run: pnpm run check:ci
  563. # Hot-standby drill for the in-house self-hosted Windows pool: every master
  564. # move re-runs the complete unsharded Windows gate inventory on the persistent
  565. # VM, continuously proving that environment can take over the required
  566. # `windows` lane if the hosted pool degrades (the switch is setting the
  567. # writer-manageable DSH_CI_FAILOVER_WINDOWS variable — see the failover
  568. # runbook, no merge required). Push-triggered, so this lane always executes
  569. # the base branch's own workflow definition. Non-blocking for pull requests;
  570. # absent from all-checks-passed.needs by design — the required `windows` job
  571. # owns the PR verdict. No cache steps because the VM's persistent pnpm store
  572. # and tool caches make them redundant (and saving here would poison the
  573. # hosted cache namespace with self-hosted paths).
  574. serial-windows:
  575. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  576. name: serial / windows (self-hosted standby)
  577. runs-on: [self-hosted, dsh-win-ci, windows]
  578. timeout-minutes: 60
  579. steps:
  580. - uses: actions/checkout@v6
  581. - name: Enable Developer Mode (symlink support)
  582. shell: pwsh
  583. run: >-
  584. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  585. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  586. - uses: pnpm/action-setup@v4
  587. with:
  588. dest: ${{ runner.temp }}/setup-pnpm
  589. - uses: actions/setup-node@v6
  590. with:
  591. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  592. - name: Configure persistent pnpm store
  593. shell: pwsh
  594. run: |
  595. $storeRoot = "$env:LOCALAPPDATA\pnpm\store"
  596. echo "PNPM_CONFIG_STORE_DIR=$storeRoot" >> $env:GITHUB_ENV
  597. - name: Install (immutable)
  598. shell: pwsh
  599. run: pnpm install --frozen-lockfile
  600. - name: Run complete unsharded Windows gate inventory serially
  601. shell: pwsh
  602. env:
  603. DSH_COVERAGE_MAX_WORKERS: '1'
  604. DSH_GATE_CONCURRENCY: '1'
  605. DSH_PUBLINT_CONCURRENCY: '1'
  606. run: pnpm run check:ci:windows-complete
  607. # Manual, bounded comparison of the actual critical Linux and Windows lanes.
  608. # The named pools are restricted at the organization level to this repository.
  609. larger-runner-benchmark:
  610. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'larger-runner-benchmark'
  611. runs-on: ${{ matrix.runner }}
  612. timeout-minutes: 15
  613. strategy:
  614. fail-fast: false
  615. max-parallel: 12
  616. matrix:
  617. include:
  618. - platform: linux
  619. cores: '4'
  620. runner: dsh-ubuntu-24-04-4core
  621. workload: typecheck
  622. - platform: linux
  623. cores: '8'
  624. runner: dsh-ubuntu-24-04-8core
  625. workload: typecheck
  626. - platform: linux
  627. cores: '16'
  628. runner: dsh-ubuntu-24-04-16core
  629. workload: typecheck
  630. - platform: linux
  631. cores: '32'
  632. runner: dsh-ubuntu-24-04-32core
  633. workload: typecheck
  634. - platform: linux
  635. cores: '64'
  636. runner: dsh-ubuntu-24-04-64core
  637. workload: typecheck
  638. - platform: linux
  639. cores: '96'
  640. runner: dsh-ubuntu-24-04-96core
  641. workload: typecheck
  642. - platform: windows
  643. cores: '4'
  644. runner: dsh-windows-2025-4core
  645. workload: production-site
  646. - platform: windows
  647. cores: '8'
  648. runner: dsh-windows-2025-8core
  649. workload: production-site
  650. - platform: windows
  651. cores: '16'
  652. runner: dsh-windows-2025-16core
  653. workload: production-site
  654. - platform: windows
  655. cores: '32'
  656. runner: dsh-windows-2025-32core
  657. workload: production-site
  658. - platform: windows
  659. cores: '64'
  660. runner: dsh-windows-2025-64core
  661. workload: production-site
  662. - platform: windows
  663. cores: '96'
  664. runner: dsh-windows-2025-96core
  665. workload: production-site
  666. steps:
  667. - uses: actions/checkout@v6
  668. - uses: pnpm/action-setup@v4
  669. with:
  670. dest: ${{ runner.temp }}/setup-pnpm
  671. # The benchmark's Windows lanes deliberately skip the store cache like
  672. # the independent native Windows job; an empty input disables caching.
  673. - uses: actions/setup-node@v6
  674. with:
  675. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  676. cache: ${{ matrix.platform == 'linux' && 'pnpm' || '' }}
  677. - name: Report runner capacity
  678. run: >-
  679. node -e "const os = require('node:os');
  680. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  681. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  682. - name: Install (immutable)
  683. run: pnpm install --frozen-lockfile
  684. - name: Run critical Linux typecheck lane
  685. if: matrix.platform == 'linux'
  686. run: pnpm run typecheck
  687. - name: Run critical Windows production-site lane
  688. if: matrix.platform == 'windows'
  689. run: pnpm run docs:build
  690. # Manual comparison of the intended low-fanout topology. Linux runs the
  691. # complete unsharded primary aggregate with bounded in-runner parallelism;
  692. # Windows runs both blocking build targets concurrently through run-gates.
  693. consolidated-runner-benchmark:
  694. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  695. runs-on: ${{ matrix.runner }}
  696. timeout-minutes: 15
  697. strategy:
  698. fail-fast: false
  699. max-parallel: 12
  700. matrix:
  701. include:
  702. - platform: linux
  703. cores: '4'
  704. runner: dsh-ubuntu-24-04-4core
  705. workers: '4'
  706. - platform: linux
  707. cores: '8'
  708. runner: dsh-ubuntu-24-04-8core
  709. workers: '8'
  710. - platform: linux
  711. cores: '16'
  712. runner: dsh-ubuntu-24-04-16core
  713. workers: '16'
  714. - platform: linux
  715. cores: '32'
  716. runner: dsh-ubuntu-24-04-32core
  717. workers: '32'
  718. - platform: linux
  719. cores: '64'
  720. runner: dsh-ubuntu-24-04-64core
  721. workers: '32'
  722. - platform: linux
  723. cores: '96'
  724. runner: dsh-ubuntu-24-04-96core
  725. workers: '32'
  726. - platform: windows
  727. cores: '4'
  728. runner: dsh-windows-2025-4core
  729. workers: '2'
  730. - platform: windows
  731. cores: '8'
  732. runner: dsh-windows-2025-8core
  733. workers: '2'
  734. - platform: windows
  735. cores: '16'
  736. runner: dsh-windows-2025-16core
  737. workers: '2'
  738. - platform: windows
  739. cores: '32'
  740. runner: dsh-windows-2025-32core
  741. workers: '2'
  742. - platform: windows
  743. cores: '64'
  744. runner: dsh-windows-2025-64core
  745. workers: '2'
  746. - platform: windows
  747. cores: '96'
  748. runner: dsh-windows-2025-96core
  749. workers: '2'
  750. steps:
  751. - uses: actions/checkout@v6
  752. - uses: pnpm/action-setup@v4
  753. with:
  754. dest: ${{ runner.temp }}/setup-pnpm
  755. # Unlike the larger-runner suite, both platforms cache the store here:
  756. # the consolidated topology measures cache mechanics as workload.
  757. - uses: actions/setup-node@v6
  758. with:
  759. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  760. cache: pnpm
  761. - name: Report runner capacity
  762. run: >-
  763. node -e "const os = require('node:os');
  764. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  765. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  766. - name: Install and prepare Linux
  767. if: matrix.platform == 'linux'
  768. run: |
  769. pnpm install --frozen-lockfile &
  770. install_pid=$!
  771. bash scripts/prepare-ci-bubblewrap.sh &
  772. sandbox_pid=$!
  773. install_status=0
  774. wait "$install_pid" || install_status=$?
  775. sandbox_status=0
  776. wait "$sandbox_pid" || sandbox_status=$?
  777. if (( install_status != 0 )); then exit "$install_status"; fi
  778. exit "$sandbox_status"
  779. - name: Install (immutable)
  780. if: matrix.platform == 'windows'
  781. shell: pwsh
  782. run: pnpm install --frozen-lockfile
  783. - name: Run complete unsharded primary Node CI concurrently
  784. if: matrix.platform == 'linux'
  785. env:
  786. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  787. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  788. DSH_OXLINT_THREADS: ${{ matrix.workers }}
  789. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  790. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  791. run: pnpm run check:ci
  792. - name: Run blocking Windows builds concurrently
  793. if: matrix.platform == 'windows'
  794. shell: pwsh
  795. env:
  796. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  797. run: pnpm run check:ci:windows-blocking
  798. # Single stable required check for branch protection: require "all checks
  799. # passed" instead of enumerating matrix legs whose names change as lanes and
  800. # node versions evolve. Every blocking job in THIS workflow must be listed in
  801. # `needs`. The required Wine job is listed as `windows`; `windows-native` is
  802. # deliberately absent so its independent result never delays or changes this
  803. # verdict. (`needs` cannot reach across workflow files; e2e.yml stays its own
  804. # check.)
  805. # `if: always()` is load-bearing: without it a failed dependency
  806. # would SKIP this job, and GitHub counts a skipped required check as passing
  807. # — so this job always runs and fails on any non-success result, including
  808. # 'cancelled' and 'skipped'.
  809. all-checks-passed:
  810. name: all checks passed
  811. # This bookkeeping-only verdict must not depend on custom-pool
  812. # provisioning — and under Linux failover it follows the same selector as
  813. # the worker jobs it aggregates, so a standard-hosted outage cannot strand
  814. # the branch-protection verdict either. It retargets with the Linux switch
  815. # (DSH_CI_FAILOVER_LINUX), not the Windows one, because it aggregates the
  816. # required Linux workers and runs on the vm-backup pool.
  817. runs-on: >-
  818. ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
  819. && github.event.pull_request.user.login != 'dependabot[bot]'
  820. && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
  821. || 'ubuntu-latest' }}
  822. needs: [node-24, node-24-coverage, node-24-consumers, node-compat, python-sdk, python-runtime, windows]
  823. if: always() && github.event_name == 'pull_request'
  824. steps:
  825. - name: Fail if any needed job did not succeed
  826. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  827. run: |
  828. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  829. exit 1
  830. - name: All checks passed
  831. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"