ci.yml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  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. jobs:
  24. # One large runner pays hosted setup once, then the repository scheduler
  25. # overlaps the complete unsharded primary Node inventory. Build starts eagerly;
  26. # only consumers of emitted output wait for it.
  27. node-24:
  28. if: github.event_name == 'pull_request'
  29. runs-on: dsh-ubuntu-24-04-96core
  30. name: node 24 / complete
  31. env:
  32. DSH_COVERAGE_MAX_WORKERS: '16'
  33. DSH_ESLINT_CONCURRENCY: '16'
  34. DSH_GATE_CONCURRENCY: '12'
  35. DSH_PUBLINT_CONCURRENCY: '16'
  36. DSH_SNAPSHOT_MAX_CONCURRENCY: '8'
  37. steps:
  38. - uses: actions/checkout@v6
  39. with:
  40. persist-credentials: false
  41. - uses: actions/setup-node@v6
  42. with:
  43. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  44. - name: Enable corepack and resolve pnpm store path
  45. id: pnpm-store
  46. run: |
  47. corepack enable
  48. echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  49. # Pull requests consume the default-branch cache but do not put cache
  50. # compression and upload on the paid latency-critical path.
  51. - uses: actions/cache/restore@v4
  52. with:
  53. path: ${{ steps.pnpm-store.outputs.path }}
  54. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  55. restore-keys: |
  56. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  57. - name: Install dependencies and prepare bubblewrap
  58. run: |
  59. pnpm install --frozen-lockfile &
  60. install_pid=$!
  61. bash scripts/prepare-ci-bubblewrap.sh &
  62. sandbox_pid=$!
  63. install_status=0
  64. wait "$install_pid" || install_status=$?
  65. sandbox_status=0
  66. wait "$sandbox_pid" || sandbox_status=$?
  67. if (( install_status != 0 )); then exit "$install_status"; fi
  68. exit "$sandbox_status"
  69. - name: Run complete unsharded primary Node CI concurrently
  70. run: pnpm run check:ci
  71. node-compat:
  72. if: github.event_name == 'pull_request'
  73. # Distinct larger-runner pools avoid both standard-runner setup outliers and
  74. # delayed allocation when independent environment contracts share one pool.
  75. runs-on: ${{ matrix.runner }}
  76. name: ${{ matrix.name }}
  77. env:
  78. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  79. DSH_NODE_COMPAT_SKIP_TYPECHECK: '1'
  80. strategy:
  81. fail-fast: false
  82. matrix:
  83. include:
  84. - node: '22.19'
  85. name: node 22.19
  86. runner: dsh-ubuntu-24-04-4core
  87. gate_concurrency: '2'
  88. - node: 26
  89. name: node 26
  90. runner: dsh-ubuntu-24-04-32core
  91. gate_concurrency: '2'
  92. steps:
  93. - uses: actions/checkout@v6
  94. - uses: actions/setup-node@v6
  95. with:
  96. node-version: ${{ matrix.node }}
  97. - name: Enable corepack and resolve pnpm store path
  98. id: pnpm-store
  99. run: |
  100. corepack enable
  101. echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  102. - uses: actions/cache@v4
  103. with:
  104. path: ${{ steps.pnpm-store.outputs.path }}
  105. key: ${{ runner.os }}-node-${{ matrix.node }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  106. restore-keys: |
  107. ${{ runner.os }}-node-${{ matrix.node }}-pnpm-
  108. - name: Install (immutable)
  109. run: pnpm install --frozen-lockfile
  110. - name: Run compatibility smokes
  111. run: pnpm run check:node-compat
  112. python-sdk:
  113. if: github.event_name == 'pull_request'
  114. runs-on: dsh-ubuntu-24-04-8core
  115. name: python 3.10 / keyless SDK
  116. steps:
  117. - uses: actions/checkout@v6
  118. - uses: actions/setup-python@v6
  119. with:
  120. python-version: '3.10'
  121. cache: pip
  122. - name: Install uv
  123. run: python -m pip install uv==0.11.23
  124. - name: Run complete keyless Python suite
  125. run: uv run --python 3.10 --group test --project python/sdk pytest
  126. # One Windows box shares setup across the required build/site checks and the
  127. # complete observational portability inventory. run-gates reports failures
  128. # from observational gates without allowing them to fail the required job.
  129. windows:
  130. if: github.event_name == 'pull_request'
  131. runs-on: dsh-windows-2025-32core
  132. name: windows node 24 / complete
  133. env:
  134. # Keep ESLint itself single-threaded: 16 ESLint workers took 174 seconds on
  135. # this image. The outer scheduler still overlaps lint with the other gates.
  136. DSH_COVERAGE_MAX_WORKERS: '12'
  137. DSH_ESLINT_CACHE: '1'
  138. DSH_GATE_CONCURRENCY: '16'
  139. DSH_PUBLINT_CONCURRENCY: '16'
  140. steps:
  141. - uses: actions/checkout@v6
  142. - uses: actions/setup-node@v6
  143. with:
  144. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  145. - uses: actions/cache/restore@v4
  146. with:
  147. path: .cache/eslint
  148. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'tsconfig.json', 'packages/*/*/tsconfig.json', 'examples/*/tsconfig.json') }}
  149. restore-keys: |
  150. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-
  151. # Extracting the many-file pnpm store cache is slower on this image than
  152. # a clean parallel install, and saving it adds more latency after gates.
  153. - name: Enable corepack and install (immutable)
  154. shell: pwsh
  155. run: |
  156. corepack enable
  157. pnpm install --frozen-lockfile
  158. - name: Run blocking and observational Windows gates concurrently
  159. shell: pwsh
  160. run: pnpm run check:ci:windows-complete
  161. # Master pushes run only the serial reference jobs below.
  162. # Each host executes the complete, unsharded primary Node aggregate with one
  163. # gate worker, giving reviewers a simple cross-platform oracle for completeness
  164. # and timing.
  165. serial-linux:
  166. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  167. name: serial / linux
  168. runs-on: ubuntu-latest
  169. steps:
  170. - uses: actions/checkout@v6
  171. - uses: actions/setup-node@v6
  172. with:
  173. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  174. - name: Enable corepack and resolve pnpm store path
  175. id: pnpm-store
  176. run: |
  177. corepack enable
  178. echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  179. # Master refreshes the caches that pull requests restore without saving.
  180. - uses: actions/cache@v4
  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. - uses: actions/cache@v4
  187. with:
  188. path: .cache/eslint
  189. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'tsconfig.json', 'packages/*/*/tsconfig.json', 'examples/*/tsconfig.json') }}
  190. restore-keys: |
  191. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-
  192. - name: Install (immutable)
  193. run: pnpm install --frozen-lockfile
  194. - name: Prepare bubblewrap (unrestrict userns)
  195. run: bash scripts/prepare-ci-bubblewrap.sh
  196. - name: Run complete unsharded primary Node CI serially
  197. env:
  198. DSH_COVERAGE_MAX_WORKERS: '1'
  199. DSH_E2E_MAX_WORKERS: '1'
  200. DSH_ESLINT_CACHE: '1'
  201. DSH_GATE_CONCURRENCY: '1'
  202. DSH_PUBLINT_CONCURRENCY: '1'
  203. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  204. run: pnpm run check:ci
  205. serial-macos:
  206. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  207. name: serial / macos
  208. runs-on: macos-latest
  209. steps:
  210. - uses: actions/checkout@v6
  211. - uses: actions/setup-node@v6
  212. with:
  213. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  214. - name: Enable corepack (pnpm)
  215. run: corepack enable
  216. - name: Install (immutable)
  217. run: pnpm install --frozen-lockfile
  218. - name: Run complete unsharded primary Node CI serially
  219. env:
  220. DSH_COVERAGE_MAX_WORKERS: '1'
  221. DSH_E2E_MAX_WORKERS: '1'
  222. DSH_GATE_CONCURRENCY: '1'
  223. DSH_PUBLINT_CONCURRENCY: '1'
  224. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  225. run: pnpm run check:ci
  226. serial-windows:
  227. if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  228. name: serial / windows
  229. runs-on: windows-2025
  230. steps:
  231. - uses: actions/checkout@v6
  232. - name: Enable Developer Mode (symlink support)
  233. shell: pwsh
  234. run: >-
  235. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  236. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  237. - uses: actions/setup-node@v6
  238. with:
  239. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  240. - name: Enable corepack (pnpm)
  241. shell: pwsh
  242. run: corepack enable
  243. # Master refreshes the small cache that pull requests restore without
  244. # putting package-store extraction back on the Windows critical path.
  245. - uses: actions/cache@v4
  246. with:
  247. path: .cache/eslint
  248. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'tsconfig.json', 'packages/*/*/tsconfig.json', 'examples/*/tsconfig.json') }}
  249. restore-keys: |
  250. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-
  251. - name: Install (immutable)
  252. shell: pwsh
  253. run: pnpm install --frozen-lockfile
  254. - name: Run complete unsharded primary Node CI serially
  255. shell: pwsh
  256. env:
  257. DSH_COVERAGE_MAX_WORKERS: '1'
  258. DSH_E2E_MAX_WORKERS: '1'
  259. DSH_ESLINT_CACHE: '1'
  260. DSH_GATE_CONCURRENCY: '1'
  261. DSH_PUBLINT_CONCURRENCY: '1'
  262. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  263. run: pnpm run check:ci
  264. # Manual, bounded comparison of the actual critical Linux and Windows lanes.
  265. # The named pools are restricted at the organization level to this repository.
  266. larger-runner-benchmark:
  267. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'larger-runner-benchmark'
  268. runs-on: ${{ matrix.runner }}
  269. timeout-minutes: 15
  270. strategy:
  271. fail-fast: false
  272. max-parallel: 12
  273. matrix:
  274. include:
  275. - platform: linux
  276. cores: '4'
  277. runner: dsh-ubuntu-24-04-4core
  278. workload: typecheck
  279. - platform: linux
  280. cores: '8'
  281. runner: dsh-ubuntu-24-04-8core
  282. workload: typecheck
  283. - platform: linux
  284. cores: '16'
  285. runner: dsh-ubuntu-24-04-16core
  286. workload: typecheck
  287. - platform: linux
  288. cores: '32'
  289. runner: dsh-ubuntu-24-04-32core
  290. workload: typecheck
  291. - platform: linux
  292. cores: '64'
  293. runner: dsh-ubuntu-24-04-64core
  294. workload: typecheck
  295. - platform: linux
  296. cores: '96'
  297. runner: dsh-ubuntu-24-04-96core
  298. workload: typecheck
  299. - platform: windows
  300. cores: '4'
  301. runner: dsh-windows-2025-4core
  302. workload: production-site
  303. - platform: windows
  304. cores: '8'
  305. runner: dsh-windows-2025-8core
  306. workload: production-site
  307. - platform: windows
  308. cores: '16'
  309. runner: dsh-windows-2025-16core
  310. workload: production-site
  311. - platform: windows
  312. cores: '32'
  313. runner: dsh-windows-2025-32core
  314. workload: production-site
  315. - platform: windows
  316. cores: '64'
  317. runner: dsh-windows-2025-64core
  318. workload: production-site
  319. - platform: windows
  320. cores: '96'
  321. runner: dsh-windows-2025-96core
  322. workload: production-site
  323. steps:
  324. - uses: actions/checkout@v6
  325. - uses: actions/setup-node@v6
  326. with:
  327. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  328. - name: Report runner capacity
  329. run: >-
  330. node -e "const os = require('node:os');
  331. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  332. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  333. - name: Enable corepack (pnpm)
  334. run: corepack enable
  335. - name: Resolve pnpm store path
  336. if: matrix.platform == 'linux'
  337. id: pnpm-store
  338. run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  339. - uses: actions/cache@v4
  340. if: matrix.platform == 'linux'
  341. with:
  342. path: ${{ steps.pnpm-store.outputs.path }}
  343. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  344. restore-keys: |
  345. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  346. - name: Install (immutable)
  347. run: pnpm install --frozen-lockfile
  348. - name: Run critical Linux typecheck lane
  349. if: matrix.platform == 'linux'
  350. run: pnpm run typecheck
  351. - name: Run critical Windows production-site lane
  352. if: matrix.platform == 'windows'
  353. run: pnpm run docs:build
  354. # Manual comparison of the intended low-fanout topology. Linux runs the
  355. # complete unsharded primary aggregate with bounded in-runner parallelism;
  356. # Windows runs both blocking build surfaces concurrently through run-gates.
  357. consolidated-runner-benchmark:
  358. if: github.event_name == 'workflow_dispatch' && inputs.suite == 'consolidated-runner-benchmark'
  359. runs-on: ${{ matrix.runner }}
  360. timeout-minutes: 15
  361. strategy:
  362. fail-fast: false
  363. max-parallel: 12
  364. matrix:
  365. include:
  366. - platform: linux
  367. cores: '4'
  368. runner: dsh-ubuntu-24-04-4core
  369. workers: '4'
  370. - platform: linux
  371. cores: '8'
  372. runner: dsh-ubuntu-24-04-8core
  373. workers: '8'
  374. - platform: linux
  375. cores: '16'
  376. runner: dsh-ubuntu-24-04-16core
  377. workers: '16'
  378. - platform: linux
  379. cores: '32'
  380. runner: dsh-ubuntu-24-04-32core
  381. workers: '32'
  382. - platform: linux
  383. cores: '64'
  384. runner: dsh-ubuntu-24-04-64core
  385. workers: '32'
  386. - platform: linux
  387. cores: '96'
  388. runner: dsh-ubuntu-24-04-96core
  389. workers: '32'
  390. - platform: windows
  391. cores: '4'
  392. runner: dsh-windows-2025-4core
  393. workers: '2'
  394. - platform: windows
  395. cores: '8'
  396. runner: dsh-windows-2025-8core
  397. workers: '2'
  398. - platform: windows
  399. cores: '16'
  400. runner: dsh-windows-2025-16core
  401. workers: '2'
  402. - platform: windows
  403. cores: '32'
  404. runner: dsh-windows-2025-32core
  405. workers: '2'
  406. - platform: windows
  407. cores: '64'
  408. runner: dsh-windows-2025-64core
  409. workers: '2'
  410. - platform: windows
  411. cores: '96'
  412. runner: dsh-windows-2025-96core
  413. workers: '2'
  414. steps:
  415. - uses: actions/checkout@v6
  416. - uses: actions/setup-node@v6
  417. with:
  418. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  419. - name: Report runner capacity
  420. run: >-
  421. node -e "const os = require('node:os');
  422. console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
  423. memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
  424. - name: Enable corepack (pnpm)
  425. run: corepack enable
  426. - name: Resolve pnpm store path (Linux)
  427. if: matrix.platform == 'linux'
  428. id: pnpm-store-linux
  429. run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  430. - name: Resolve pnpm store path (Windows)
  431. if: matrix.platform == 'windows'
  432. id: pnpm-store-windows
  433. shell: pwsh
  434. run: '"path=$(pnpm store path --silent)" >> $env:GITHUB_OUTPUT'
  435. - uses: actions/cache@v4
  436. with:
  437. path: ${{ steps.pnpm-store-linux.outputs.path || steps.pnpm-store-windows.outputs.path }}
  438. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  439. restore-keys: |
  440. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  441. - uses: actions/cache@v4
  442. if: matrix.platform == 'linux'
  443. with:
  444. path: .cache/eslint
  445. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'tsconfig.json', 'packages/*/*/tsconfig.json', 'examples/*/tsconfig.json') }}
  446. restore-keys: |
  447. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-full-
  448. - name: Install and prepare Linux
  449. if: matrix.platform == 'linux'
  450. run: |
  451. pnpm install --frozen-lockfile &
  452. install_pid=$!
  453. bash scripts/prepare-ci-bubblewrap.sh &
  454. sandbox_pid=$!
  455. install_status=0
  456. wait "$install_pid" || install_status=$?
  457. sandbox_status=0
  458. wait "$sandbox_pid" || sandbox_status=$?
  459. if (( install_status != 0 )); then exit "$install_status"; fi
  460. exit "$sandbox_status"
  461. - name: Install (immutable)
  462. if: matrix.platform == 'windows'
  463. shell: pwsh
  464. run: pnpm install --frozen-lockfile
  465. - name: Run complete unsharded primary Node CI concurrently
  466. if: matrix.platform == 'linux'
  467. env:
  468. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.workers }}
  469. DSH_ESLINT_CACHE: '1'
  470. DSH_ESLINT_CONCURRENCY: ${{ matrix.workers }}
  471. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  472. DSH_PUBLINT_CONCURRENCY: ${{ matrix.workers }}
  473. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.workers }}
  474. run: pnpm run check:ci
  475. - name: Run blocking Windows builds concurrently
  476. if: matrix.platform == 'windows'
  477. shell: pwsh
  478. env:
  479. DSH_GATE_CONCURRENCY: ${{ matrix.workers }}
  480. run: pnpm run check:ci:windows-blocking
  481. # Single stable required check for branch protection: require "all checks
  482. # passed" instead of enumerating matrix legs whose names change as lanes and
  483. # node versions evolve. Every blocking job in THIS workflow must be listed in
  484. # `needs`; observational Windows gates share the required Windows job but are
  485. # marked non-blocking inside run-gates. (`needs` cannot reach across workflow
  486. # files; e2e.yml stays its own check.)
  487. # `if: always()` is load-bearing: without it a failed dependency
  488. # would SKIP this job, and GitHub counts a skipped required check as passing
  489. # — so this job always runs and fails on any non-success result, including
  490. # 'cancelled' and 'skipped'.
  491. all-checks-passed:
  492. name: all checks passed
  493. runs-on: ubuntu-latest
  494. needs: [node-24, node-compat, python-sdk, windows]
  495. if: always() && github.event_name == 'pull_request'
  496. steps:
  497. - name: Fail if any needed job did not succeed
  498. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  499. run: |
  500. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  501. exit 1
  502. - name: All checks passed
  503. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"