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: dsh-windows-2025-16core
  378. name: windows node 24 / native complete
  379. timeout-minutes: 60
  380. env:
  381. DSH_COVERAGE_MAX_WORKERS: '2'
  382. DSH_GATE_CONCURRENCY: '2'
  383. DSH_PUBLINT_CONCURRENCY: '8'
  384. steps:
  385. - uses: actions/checkout@v6
  386. with:
  387. persist-credentials: false
  388. - name: Enable Developer Mode (symlink support)
  389. shell: pwsh
  390. run: >-
  391. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  392. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  393. - uses: pnpm/action-setup@v4
  394. with:
  395. dest: ${{ runner.temp }}/setup-pnpm
  396. - uses: actions/setup-node@v6
  397. with:
  398. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  399. # Extracting the many-file pnpm store cache is slower than a clean install,
  400. # and saving it adds more latency after the gates.
  401. - name: Install (immutable)
  402. shell: pwsh
  403. run: pnpm install --frozen-lockfile
  404. - name: Run complete native Windows gate inventory
  405. shell: pwsh
  406. run: pnpm run check:ci:windows-complete
  407. # The hosted reference jobs below are temporarily disabled; the self-hosted
  408. # standby remains active. Each enabled host executes the complete, unsharded
  409. # primary Node aggregate with one gate worker, giving reviewers a simple
  410. # cross-platform oracle for completeness and timing.
  411. serial-linux:
  412. if: false
  413. name: serial / linux
  414. runs-on: ubuntu-latest
  415. steps:
  416. - uses: actions/checkout@v6
  417. with:
  418. fetch-depth: 2
  419. - uses: pnpm/action-setup@v4
  420. with:
  421. dest: ${{ runner.temp }}/setup-pnpm
  422. - uses: actions/setup-node@v6
  423. with:
  424. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  425. - name: Configure pnpm store path
  426. id: pnpm-store
  427. run: |
  428. store_root="$HOME/.local/share/pnpm/store"
  429. echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV"
  430. store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent)
  431. echo "path=$store_path" >> "$GITHUB_OUTPUT"
  432. # Master refreshes the pnpm store cache that pull requests restore without saving.
  433. # The store cache stays a hand-rolled actions/cache step rather than
  434. # setup-node's `cache: pnpm`: the enterprise pull-request jobs above
  435. # restore exactly this key and path, and setup-node's built-in cache
  436. # uses its own key format — converting this producer would silently
  437. # starve their documented restore-only optimization.
  438. - uses: actions/cache@v4
  439. with:
  440. path: ${{ steps.pnpm-store.outputs.path }}
  441. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  442. restore-keys: |
  443. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  444. # Master produces the hosted Chromium cache restored by pull requests.
  445. - uses: actions/cache@v4
  446. with:
  447. path: ~/.cache/ms-playwright
  448. key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
  449. restore-keys: |
  450. ${{ runner.os }}-playwright-
  451. - name: Install (immutable)
  452. run: pnpm install --frozen-lockfile
  453. - name: Install Playwright Chromium and system dependencies
  454. run: pnpm --filter @deepseek-ai/dsh-frontend exec playwright install --with-deps chromium
  455. - name: Prepare bubblewrap (unrestrict userns)
  456. run: bash scripts/prepare-ci-bubblewrap.sh
  457. - name: Run complete unsharded primary Node CI serially
  458. env:
  459. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  460. DSH_COVERAGE_MAX_WORKERS: '1'
  461. DSH_E2E_MAX_WORKERS: '1'
  462. DSH_GATE_CONCURRENCY: '1'
  463. DSH_OXLINT_THREADS: '1'
  464. DSH_PUBLINT_CONCURRENCY: '1'
  465. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  466. run: pnpm run check:ci:linux-primary
  467. # Hot-standby drill for the in-house self-hosted pool: every master move
  468. # re-runs the complete unsharded aggregate on the persistent 64-core VM,
  469. # continuously proving that environment can take over a required lane if
  470. # the hosted pools degrade (the switch is then setting the writer-manageable
  471. # DSH_CI_FAILOVER variable — see the failover runbook, no merge required).
  472. # Push-triggered, so this lane always executes the base branch's own
  473. # workflow definition. (Under failover, pull_request jobs do reach these
  474. # runners with the PR merge ref's workflow — the boundary there is
  475. # repository membership: private, forking disabled, Dependabot excluded.)
  476. # Non-blocking for
  477. # pull requests; no cache steps because the VM's persistent pnpm store and
  478. # tool caches make them redundant (and saving here would poison the hosted
  479. # cache namespace with self-hosted paths).
  480. serial-linux-selfhosted:
  481. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  482. name: serial / linux (self-hosted standby)
  483. runs-on: [self-hosted, linux, x64, vm-backup]
  484. steps:
  485. # Full history + DSH_ARCHIVE_BASE_REF below: same frozen-archive
  486. # comparison as serial-linux. Depth 2 would miss github.event.before
  487. # on multi-commit or force pushes; full fetch is cheap here because
  488. # checkout resolves against the VM's local mirror.
  489. - uses: actions/checkout@v6
  490. with:
  491. fetch-depth: 0
  492. - uses: pnpm/action-setup@v4
  493. with:
  494. dest: ${{ runner.temp }}/setup-pnpm
  495. - uses: actions/setup-node@v6
  496. with:
  497. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  498. - name: Configure persistent pnpm store
  499. run: echo "PNPM_CONFIG_STORE_DIR=$HOME/.local/share/pnpm/store" >> "$GITHUB_ENV"
  500. - name: Install (immutable)
  501. run: pnpm install --frozen-lockfile
  502. # The persistent VM image owns Playwright's Linux system packages; this
  503. # step also proves that browser provisioning remains usable for failover.
  504. - name: Install Playwright Chromium
  505. run: pnpm --filter @deepseek-ai/dsh-frontend exec playwright install chromium
  506. - name: Prepare bubblewrap (unrestrict userns)
  507. run: bash scripts/prepare-ci-bubblewrap.sh
  508. - name: Run complete unsharded primary Node CI serially
  509. env:
  510. DSH_ARCHIVE_BASE_REF: ${{ github.event.before }}
  511. DSH_COVERAGE_MAX_WORKERS: '1'
  512. DSH_E2E_MAX_WORKERS: '1'
  513. DSH_GATE_CONCURRENCY: '1'
  514. DSH_OXLINT_THREADS: '1'
  515. DSH_PUBLINT_CONCURRENCY: '1'
  516. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  517. run: pnpm run check:ci:linux-primary
  518. serial-macos:
  519. if: false
  520. name: serial / macos
  521. runs-on: macos-latest
  522. steps:
  523. - uses: actions/checkout@v6
  524. - uses: pnpm/action-setup@v4
  525. with:
  526. dest: ${{ runner.temp }}/setup-pnpm
  527. - uses: actions/setup-node@v6
  528. with:
  529. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  530. - name: Install (immutable)
  531. run: pnpm install --frozen-lockfile
  532. - name: Run complete unsharded primary Node CI serially
  533. env:
  534. DSH_COVERAGE_MAX_WORKERS: '1'
  535. DSH_E2E_MAX_WORKERS: '1'
  536. DSH_GATE_CONCURRENCY: '1'
  537. DSH_PUBLINT_CONCURRENCY: '1'
  538. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  539. run: pnpm run check:ci
  540. serial-windows:
  541. if: false
  542. name: serial / windows
  543. runs-on: windows-2025
  544. steps:
  545. - uses: actions/checkout@v6
  546. - name: Enable Developer Mode (symlink support)
  547. shell: pwsh
  548. run: >-
  549. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  550. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  551. - uses: pnpm/action-setup@v4
  552. with:
  553. dest: ${{ runner.temp }}/setup-pnpm
  554. - uses: actions/setup-node@v6
  555. with:
  556. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  557. - name: Install (immutable)
  558. shell: pwsh
  559. run: pnpm install --frozen-lockfile
  560. - name: Run complete unsharded primary Node CI serially
  561. shell: pwsh
  562. env:
  563. DSH_COVERAGE_MAX_WORKERS: '1'
  564. DSH_E2E_MAX_WORKERS: '1'
  565. DSH_GATE_CONCURRENCY: '1'
  566. DSH_OXLINT_THREADS: '1'
  567. DSH_PUBLINT_CONCURRENCY: '1'
  568. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  569. run: pnpm run check:ci
  570. # Manual, bounded comparison of the actual critical Linux and Windows lanes.
  571. # The named pools are restricted at the organization level to this repository.
  572. larger-runner-benchmark:
  573. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'larger-runner-benchmark'
  574. runs-on: ${{ matrix.runner }}
  575. timeout-minutes: 15
  576. strategy:
  577. fail-fast: false
  578. max-parallel: 12
  579. matrix:
  580. include:
  581. - platform: linux
  582. cores: '4'
  583. runner: dsh-ubuntu-24-04-4core
  584. workload: typecheck
  585. - platform: linux
  586. cores: '8'
  587. runner: dsh-ubuntu-24-04-8core
  588. workload: typecheck
  589. - platform: linux
  590. cores: '16'
  591. runner: dsh-ubuntu-24-04-16core
  592. workload: typecheck
  593. - platform: linux
  594. cores: '32'
  595. runner: dsh-ubuntu-24-04-32core
  596. workload: typecheck
  597. - platform: linux
  598. cores: '64'
  599. runner: dsh-ubuntu-24-04-64core
  600. workload: typecheck
  601. - platform: linux
  602. cores: '96'
  603. runner: dsh-ubuntu-24-04-96core
  604. workload: typecheck
  605. - platform: windows
  606. cores: '4'
  607. runner: dsh-windows-2025-4core
  608. workload: production-site
  609. - platform: windows
  610. cores: '8'
  611. runner: dsh-windows-2025-8core
  612. workload: production-site
  613. - platform: windows
  614. cores: '16'
  615. runner: dsh-windows-2025-16core
  616. workload: production-site
  617. - platform: windows
  618. cores: '32'
  619. runner: dsh-windows-2025-32core
  620. workload: production-site
  621. - platform: windows
  622. cores: '64'
  623. runner: dsh-windows-2025-64core
  624. workload: production-site
  625. - platform: windows
  626. cores: '96'
  627. runner: dsh-windows-2025-96core
  628. workload: production-site
  629. steps:
  630. - uses: actions/checkout@v6
  631. - uses: pnpm/action-setup@v4
  632. with:
  633. dest: ${{ runner.temp }}/setup-pnpm
  634. # The benchmark's Windows lanes deliberately skip the store cache like
  635. # the independent native Windows job; an empty input disables caching.
  636. - uses: actions/setup-node@v6
  637. with:
  638. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  639. cache: ${{ matrix.platform == 'linux' && 'pnpm' || '' }}
  640. - name: Report runner capacity
  641. run: >-
  642. node -e "const os = require('node:os');
  643. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  644. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  645. - name: Install (immutable)
  646. run: pnpm install --frozen-lockfile
  647. - name: Run critical Linux typecheck lane
  648. if: matrix.platform == 'linux'
  649. run: pnpm run typecheck
  650. - name: Run critical Windows production-site lane
  651. if: matrix.platform == 'windows'
  652. run: pnpm run docs:build
  653. # Manual comparison of the intended low-fanout topology. Linux runs the
  654. # complete unsharded primary aggregate with bounded in-runner parallelism;
  655. # Windows runs both blocking build surfaces concurrently through run-gates.
  656. consolidated-runner-benchmark:
  657. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  658. runs-on: ${{ matrix.runner }}
  659. timeout-minutes: 15
  660. strategy:
  661. fail-fast: false
  662. max-parallel: 12
  663. matrix:
  664. include:
  665. - platform: linux
  666. cores: '4'
  667. runner: dsh-ubuntu-24-04-4core
  668. workers: '4'
  669. - platform: linux
  670. cores: '8'
  671. runner: dsh-ubuntu-24-04-8core
  672. workers: '8'
  673. - platform: linux
  674. cores: '16'
  675. runner: dsh-ubuntu-24-04-16core
  676. workers: '16'
  677. - platform: linux
  678. cores: '32'
  679. runner: dsh-ubuntu-24-04-32core
  680. workers: '32'
  681. - platform: linux
  682. cores: '64'
  683. runner: dsh-ubuntu-24-04-64core
  684. workers: '32'
  685. - platform: linux
  686. cores: '96'
  687. runner: dsh-ubuntu-24-04-96core
  688. workers: '32'
  689. - platform: windows
  690. cores: '4'
  691. runner: dsh-windows-2025-4core
  692. workers: '2'
  693. - platform: windows
  694. cores: '8'
  695. runner: dsh-windows-2025-8core
  696. workers: '2'
  697. - platform: windows
  698. cores: '16'
  699. runner: dsh-windows-2025-16core
  700. workers: '2'
  701. - platform: windows
  702. cores: '32'
  703. runner: dsh-windows-2025-32core
  704. workers: '2'
  705. - platform: windows
  706. cores: '64'
  707. runner: dsh-windows-2025-64core
  708. workers: '2'
  709. - platform: windows
  710. cores: '96'
  711. runner: dsh-windows-2025-96core
  712. workers: '2'
  713. steps:
  714. - uses: actions/checkout@v6
  715. - uses: pnpm/action-setup@v4
  716. with:
  717. dest: ${{ runner.temp }}/setup-pnpm
  718. # Unlike the larger-runner suite, both platforms cache the store here:
  719. # the consolidated topology measures cache mechanics as workload.
  720. - uses: actions/setup-node@v6
  721. with:
  722. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  723. cache: pnpm
  724. - name: Report runner capacity
  725. run: >-
  726. node -e "const os = require('node:os');
  727. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  728. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  729. - name: Install and prepare Linux
  730. if: matrix.platform == 'linux'
  731. run: |
  732. pnpm install --frozen-lockfile &
  733. install_pid=$!
  734. bash scripts/prepare-ci-bubblewrap.sh &
  735. sandbox_pid=$!
  736. install_status=0
  737. wait "$install_pid" || install_status=$?
  738. sandbox_status=0
  739. wait "$sandbox_pid" || sandbox_status=$?
  740. if (( install_status != 0 )); then exit "$install_status"; fi
  741. exit "$sandbox_status"
  742. - name: Install (immutable)
  743. if: matrix.platform == 'windows'
  744. shell: pwsh
  745. run: pnpm install --frozen-lockfile
  746. - name: Run complete unsharded primary Node CI concurrently
  747. if: matrix.platform == 'linux'
  748. env:
  749. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  750. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  751. DSH_OXLINT_THREADS: ${{ matrix.workers }}
  752. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  753. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  754. run: pnpm run check:ci
  755. - name: Run blocking Windows builds concurrently
  756. if: matrix.platform == 'windows'
  757. shell: pwsh
  758. env:
  759. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  760. run: pnpm run check:ci:windows-blocking
  761. # Single stable required check for branch protection: require "all checks
  762. # passed" instead of enumerating matrix legs whose names change as lanes and
  763. # node versions evolve. Every blocking job in THIS workflow must be listed in
  764. # `needs`. The required Wine job is listed as `windows`; `windows-native` is
  765. # deliberately absent so its independent result never delays or changes this
  766. # verdict. (`needs` cannot reach across workflow files; e2e.yml stays its own
  767. # check.)
  768. # `if: always()` is load-bearing: without it a failed dependency
  769. # would SKIP this job, and GitHub counts a skipped required check as passing
  770. # — so this job always runs and fails on any non-success result, including
  771. # 'cancelled' and 'skipped'.
  772. all-checks-passed:
  773. name: all checks passed
  774. # This bookkeeping-only verdict must not depend on custom-pool
  775. # provisioning — and under failover it follows the same selector as the
  776. # worker jobs it aggregates, so a standard-hosted outage cannot strand
  777. # the branch-protection verdict either.
  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, ', ') }})"