ci.yml 34 KB

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