ci.yml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. name: CI
  2. on:
  3. push:
  4. branches: [main, master]
  5. pull_request:
  6. workflow_dispatch:
  7. concurrency:
  8. group: ${{ github.workflow }}-${{ github.ref }}
  9. cancel-in-progress: true
  10. permissions:
  11. contents: read
  12. env:
  13. PRIMARY_NODE_VERSION: '24'
  14. jobs:
  15. node-24:
  16. if: github.event_name != 'workflow_dispatch'
  17. runs-on: ubuntu-latest
  18. name: node 24 / ${{ matrix.lane }}
  19. env:
  20. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  21. DSH_PUBLINT_CONCURRENCY: ${{ matrix.publint_concurrency }}
  22. DSH_ARTIFACT_SHARD: ${{ matrix.artifact_shard }}
  23. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.coverage_max_workers }}
  24. DSH_COVERAGE_SHARD: ${{ matrix.coverage_shard }}
  25. DSH_LINT_SHARD: ${{ matrix.lint_shard }}
  26. DSH_SNAPSHOT_LANE: ${{ matrix.snapshot_lane }}
  27. DSH_STATIC_SHARD: ${{ matrix.static_shard }}
  28. DSH_SNAPSHOT_MAX_CONCURRENCY: ${{ matrix.snapshot_max_concurrency }}
  29. DSH_SNAPSHOT_PREBUILT: ${{ matrix.snapshot_prebuilt }}
  30. DSH_ESLINT_CACHE: ${{ matrix.eslint_cache }}
  31. strategy:
  32. fail-fast: false
  33. matrix:
  34. include:
  35. - lane: static-foundation
  36. command: pnpm run check:ci:static
  37. gate_concurrency: '4'
  38. static_shard: foundation
  39. - lane: static-doc-types
  40. command: pnpm run check:ci:static
  41. gate_concurrency: '1'
  42. static_shard: doc-types
  43. - lane: static-api-contracts
  44. command: pnpm run check:ci:static
  45. gate_concurrency: '4'
  46. static_shard: api-contracts
  47. - lane: static-catalogs
  48. command: pnpm run check:ci:static
  49. gate_concurrency: '4'
  50. static_shard: catalogs
  51. - lane: static-prose
  52. command: pnpm run check:ci:static
  53. gate_concurrency: '4'
  54. static_shard: prose
  55. - lane: static-site-projection
  56. command: pnpm run check:ci:static
  57. gate_concurrency: '1'
  58. static_shard: site-projection
  59. - lane: static-site-mpa
  60. command: pnpm run check:ci:static
  61. gate_concurrency: '1'
  62. static_shard: site-build
  63. - lane: typecheck
  64. command: pnpm run typecheck
  65. - lane: lint-package-sources
  66. command: pnpm run check:ci:lint
  67. gate_concurrency: '1'
  68. eslint_cache: '1'
  69. lint_shard: package-sources
  70. - lane: lint-package-tests
  71. command: pnpm run check:ci:lint
  72. gate_concurrency: '1'
  73. eslint_cache: '1'
  74. lint_shard: package-tests
  75. - lane: lint-repository
  76. command: pnpm run check:ci:lint
  77. gate_concurrency: '1'
  78. eslint_cache: '1'
  79. lint_shard: repository
  80. - lane: coverage-core-loop
  81. command: pnpm run check:ci:coverage
  82. gate_concurrency: '1'
  83. coverage_max_workers: '4'
  84. coverage_shard: core-loop
  85. - lane: coverage-state-session
  86. command: pnpm run check:ci:coverage
  87. gate_concurrency: '1'
  88. coverage_max_workers: '4'
  89. coverage_shard: state-session
  90. - lane: coverage-models-integrations
  91. command: pnpm run check:ci:coverage
  92. gate_concurrency: '1'
  93. coverage_max_workers: '4'
  94. coverage_shard: models-integrations
  95. - lane: coverage-sdk-capabilities
  96. command: pnpm run check:ci:coverage
  97. gate_concurrency: '1'
  98. coverage_max_workers: '4'
  99. coverage_shard: sdk-capabilities
  100. - lane: coverage-interfaces
  101. command: pnpm run check:ci:coverage
  102. gate_concurrency: '1'
  103. coverage_max_workers: '4'
  104. coverage_shard: interfaces
  105. - lane: coverage-execution
  106. command: pnpm run check:ci:coverage
  107. gate_concurrency: '1'
  108. coverage_max_workers: '4'
  109. coverage_shard: execution
  110. - lane: coverage-workflow
  111. command: pnpm run check:ci:coverage
  112. gate_concurrency: '1'
  113. coverage_max_workers: '4'
  114. coverage_shard: workflow
  115. - lane: coverage-workflow-worker
  116. command: pnpm run check:ci:coverage
  117. gate_concurrency: '1'
  118. coverage_max_workers: '4'
  119. coverage_shard: workflow-worker
  120. - lane: coverage-delegation
  121. command: pnpm run check:ci:coverage
  122. gate_concurrency: '1'
  123. coverage_max_workers: '4'
  124. coverage_shard: delegation
  125. - lane: coverage-repository
  126. command: pnpm run check:ci:coverage
  127. gate_concurrency: '1'
  128. coverage_max_workers: '4'
  129. coverage_shard: repository
  130. - lane: snapshot-support
  131. command: pnpm run check:ci:snapshot
  132. gate_concurrency: '1'
  133. snapshot_lane: support
  134. snapshot_max_concurrency: '5'
  135. snapshot_prebuilt: '1'
  136. - lane: snapshot-agents
  137. command: pnpm run check:ci:snapshot
  138. gate_concurrency: '1'
  139. snapshot_lane: agents
  140. snapshot_max_concurrency: '5'
  141. snapshot_prebuilt: '1'
  142. - lane: snapshot-acp-1
  143. command: pnpm run check:ci:snapshot
  144. gate_concurrency: '1'
  145. snapshot_lane: acp-1
  146. snapshot_max_concurrency: '5'
  147. snapshot_prebuilt: '1'
  148. - lane: snapshot-acp-2
  149. command: pnpm run check:ci:snapshot
  150. gate_concurrency: '1'
  151. snapshot_lane: acp-2
  152. snapshot_max_concurrency: '5'
  153. snapshot_prebuilt: '1'
  154. - lane: snapshot-acp-3
  155. command: pnpm run check:ci:snapshot
  156. gate_concurrency: '1'
  157. snapshot_lane: acp-3
  158. snapshot_max_concurrency: '5'
  159. snapshot_prebuilt: '1'
  160. - lane: snapshot-acp-4
  161. command: pnpm run check:ci:snapshot
  162. gate_concurrency: '1'
  163. snapshot_lane: acp-4
  164. snapshot_max_concurrency: '5'
  165. snapshot_prebuilt: '1'
  166. - lane: snapshot-acp-5
  167. command: pnpm run check:ci:snapshot
  168. gate_concurrency: '1'
  169. snapshot_lane: acp-5
  170. snapshot_max_concurrency: '5'
  171. snapshot_prebuilt: '1'
  172. - lane: snapshot-acp-6
  173. command: pnpm run check:ci:snapshot
  174. gate_concurrency: '1'
  175. snapshot_lane: acp-6
  176. snapshot_max_concurrency: '5'
  177. snapshot_prebuilt: '1'
  178. - lane: artifacts-metadata
  179. command: pnpm run check:ci:artifacts
  180. gate_concurrency: '3'
  181. publint_concurrency: '8'
  182. artifact_shard: metadata
  183. - lane: artifacts-smoke
  184. command: pnpm run check:ci:artifacts
  185. gate_concurrency: '1'
  186. artifact_shard: smoke
  187. steps:
  188. - uses: actions/checkout@v6
  189. - uses: actions/setup-node@v6
  190. with:
  191. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  192. - name: Enable corepack and resolve pnpm store path
  193. id: pnpm-store
  194. run: |
  195. corepack enable
  196. echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  197. - uses: actions/cache@v4
  198. with:
  199. path: ${{ steps.pnpm-store.outputs.path }}
  200. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  201. restore-keys: |
  202. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  203. - name: Install (immutable)
  204. run: pnpm install --frozen-lockfile
  205. # The snapshot lanes REPLAY the sandbox example's recorded scenarios,
  206. # re-executing their bash calls under a real runner. ubuntu-latest has
  207. # no bubblewrap preinstalled and no built Landlock launcher, so without
  208. # this the confined executions fail closed (SANDBOX_UNAVAILABLE). Same
  209. # install as sandbox.yml's bwrap leg (incl. the Ubuntu 24.04 AppArmor
  210. # userns knob). Building does not depend on bubblewrap, so overlap them.
  211. - name: Prepare built snapshot runtime and bubblewrap
  212. if: startsWith(matrix.lane, 'snapshot-')
  213. run: |
  214. pnpm run build &
  215. build_pid=$!
  216. (
  217. sudo apt-get install -yq --no-install-recommends bubblewrap
  218. sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 \
  219. || echo "apparmor userns knob absent — the functional probe decides"
  220. ) &
  221. sandbox_pid=$!
  222. build_status=0
  223. sandbox_status=0
  224. wait "$build_pid" || build_status=$?
  225. wait "$sandbox_pid" || sandbox_status=$?
  226. if (( build_status != 0 )); then exit "$build_status"; fi
  227. exit "$sandbox_status"
  228. - uses: actions/cache@v4
  229. if: startsWith(matrix.lane, 'lint-')
  230. with:
  231. path: .cache/eslint
  232. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'tsconfig.json', 'packages/*/*/tsconfig.json', 'examples/*/tsconfig.json') }}
  233. restore-keys: |
  234. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-
  235. - name: Run gates
  236. run: ${{ matrix.command }}
  237. node-compat:
  238. if: github.event_name != 'workflow_dispatch'
  239. runs-on: ubuntu-latest
  240. name: node ${{ matrix.node }}
  241. env:
  242. DSH_GATE_CONCURRENCY: '2'
  243. DSH_NODE_COMPAT_SKIP_TYPECHECK: ${{ matrix.skip_typecheck }}
  244. strategy:
  245. fail-fast: false
  246. matrix:
  247. include:
  248. - node: '22.19'
  249. skip_typecheck: '1'
  250. - node: 24
  251. skip_typecheck: '1'
  252. - node: 26
  253. skip_typecheck: '1'
  254. steps:
  255. - uses: actions/checkout@v6
  256. - uses: actions/setup-node@v6
  257. with:
  258. node-version: ${{ matrix.node }}
  259. - name: Enable corepack and resolve pnpm store path
  260. id: pnpm-store
  261. run: |
  262. corepack enable
  263. echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  264. - uses: actions/cache@v4
  265. with:
  266. path: ${{ steps.pnpm-store.outputs.path }}
  267. key: ${{ runner.os }}-node-${{ matrix.node }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  268. restore-keys: |
  269. ${{ runner.os }}-node-${{ matrix.node }}-pnpm-
  270. - name: Install (immutable)
  271. run: pnpm install --frozen-lockfile
  272. - name: Run compatibility gates
  273. run: pnpm run check:node-compat
  274. python-sdk:
  275. if: github.event_name != 'workflow_dispatch'
  276. runs-on: ubuntu-latest
  277. name: python 3.10 / keyless SDK
  278. steps:
  279. - uses: actions/checkout@v6
  280. - uses: actions/setup-python@v6
  281. with:
  282. python-version: '3.10'
  283. cache: pip
  284. - name: Install uv
  285. run: python -m pip install uv==0.11.23
  286. - name: Run complete keyless Python suite
  287. run: uv run --python 3.10 --group test --project python/sdk pytest
  288. # Blocking Windows build and production-site lanes keep the already-green
  289. # native outputs protected without putting both critical paths in one job.
  290. # The broader observational gate matrix below exposes the remaining
  291. # portability work without blocking mainline merges.
  292. windows-build:
  293. if: github.event_name != 'workflow_dispatch'
  294. runs-on: windows-2025
  295. name: windows / build
  296. steps:
  297. - uses: actions/checkout@v6
  298. - uses: actions/setup-node@v6
  299. with:
  300. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  301. - name: Install (immutable)
  302. run: |
  303. corepack enable
  304. pnpm install --frozen-lockfile
  305. - name: Build (tsc -b + tsdown)
  306. run: pnpm run build
  307. windows-site:
  308. if: github.event_name != 'workflow_dispatch'
  309. runs-on: windows-2025
  310. name: windows / production site
  311. steps:
  312. - uses: actions/checkout@v6
  313. - uses: actions/setup-node@v6
  314. with:
  315. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  316. - name: Install (immutable)
  317. run: |
  318. corepack enable
  319. pnpm install --frozen-lockfile
  320. - name: Build documentation site (production SPA)
  321. run: pnpm run docs:build
  322. # Observational, non-blocking Windows static, lint, and artifact lanes. Coverage
  323. # and snapshot stay Linux-only until their platform-specific runtime failures
  324. # have dedicated support. Run the gates from native PowerShell: an MSYS parent
  325. # would change the environment being measured. This job intentionally stays
  326. # out of all-checks-passed.needs.
  327. windows-gates:
  328. if: github.event_name != 'workflow_dispatch'
  329. continue-on-error: true
  330. runs-on: windows-2025
  331. name: windows node 24 / ${{ matrix.lane }}
  332. env:
  333. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  334. DSH_PUBLINT_CONCURRENCY: ${{ matrix.publint_concurrency }}
  335. DSH_ARTIFACT_SHARD: ${{ matrix.artifact_shard }}
  336. DSH_LINT_SHARD: ${{ matrix.lint_shard }}
  337. DSH_STATIC_SHARD: ${{ matrix.static_shard }}
  338. DSH_ESLINT_CACHE: ${{ matrix.eslint_cache }}
  339. strategy:
  340. fail-fast: false
  341. matrix:
  342. include:
  343. - lane: static-general
  344. command: pnpm run check:ci:static
  345. gate_concurrency: '4'
  346. static_shard: 'foundation,catalogs,prose'
  347. - lane: static-contracts
  348. command: pnpm run check:ci:static
  349. gate_concurrency: '4'
  350. static_shard: 'doc-types,api-contracts'
  351. - lane: lint-package-sources
  352. command: pnpm run check:ci:lint
  353. gate_concurrency: '1'
  354. eslint_cache: '1'
  355. lint_shard: package-sources
  356. - lane: lint-package-tests
  357. command: pnpm run check:ci:lint
  358. gate_concurrency: '1'
  359. eslint_cache: '1'
  360. lint_shard: package-tests
  361. - lane: lint-repository
  362. command: pnpm run check:ci:lint
  363. gate_concurrency: '1'
  364. eslint_cache: '1'
  365. lint_shard: repository
  366. - lane: artifacts-metadata
  367. command: pnpm run check:ci:artifacts
  368. gate_concurrency: '3'
  369. publint_concurrency: '8'
  370. artifact_shard: metadata
  371. - lane: artifacts-smoke
  372. command: pnpm run check:ci:artifacts
  373. gate_concurrency: '1'
  374. artifact_shard: smoke
  375. steps:
  376. - uses: actions/checkout@v6
  377. - name: Enable Developer Mode (symlink support)
  378. shell: pwsh
  379. run: >-
  380. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  381. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  382. - uses: actions/setup-node@v6
  383. with:
  384. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  385. - name: Enable corepack and resolve pnpm store path
  386. id: pnpm-store
  387. shell: pwsh
  388. run: |
  389. corepack enable
  390. "path=$(pnpm store path --silent)" >> $env:GITHUB_OUTPUT
  391. - uses: actions/cache@v4
  392. with:
  393. path: ${{ steps.pnpm-store.outputs.path }}
  394. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  395. restore-keys: |
  396. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  397. - name: Install (immutable)
  398. shell: pwsh
  399. run: pnpm install --frozen-lockfile
  400. - uses: actions/cache@v4
  401. if: startsWith(matrix.lane, 'lint-')
  402. with:
  403. path: .cache/eslint
  404. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'tsconfig.json', 'packages/*/*/tsconfig.json', 'examples/*/tsconfig.json') }}
  405. restore-keys: |
  406. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-
  407. - name: Run gates
  408. shell: pwsh
  409. run: ${{ matrix.command }}
  410. # Manual reference runs deliberately avoid the optimized matrices above.
  411. # Each host executes the complete, unsharded primary Node aggregate with one
  412. # gate worker, giving reviewers a simple cross-platform oracle for completeness
  413. # and timing.
  414. serial-linux:
  415. if: github.event_name == 'workflow_dispatch'
  416. name: serial / linux
  417. runs-on: ubuntu-latest
  418. steps:
  419. - uses: actions/checkout@v6
  420. - uses: actions/setup-node@v6
  421. with:
  422. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  423. - name: Enable corepack (pnpm)
  424. run: corepack enable
  425. - name: Install (immutable)
  426. run: pnpm install --frozen-lockfile
  427. - name: Install bubblewrap (unrestrict userns)
  428. run: |
  429. sudo apt-get update -q
  430. sudo apt-get install -yq --no-install-recommends bubblewrap
  431. sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 \
  432. || echo "apparmor userns knob absent — the functional probe decides"
  433. - name: Run complete unsharded primary Node CI serially
  434. env:
  435. DSH_COVERAGE_MAX_WORKERS: '1'
  436. DSH_E2E_MAX_WORKERS: '1'
  437. DSH_GATE_CONCURRENCY: '1'
  438. DSH_PUBLINT_CONCURRENCY: '1'
  439. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  440. run: pnpm run check:ci
  441. serial-macos:
  442. if: github.event_name == 'workflow_dispatch'
  443. name: serial / macos
  444. runs-on: macos-latest
  445. steps:
  446. - uses: actions/checkout@v6
  447. - uses: actions/setup-node@v6
  448. with:
  449. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  450. - name: Enable corepack (pnpm)
  451. run: corepack enable
  452. - name: Install (immutable)
  453. run: pnpm install --frozen-lockfile
  454. - name: Run complete unsharded primary Node CI serially
  455. env:
  456. DSH_COVERAGE_MAX_WORKERS: '1'
  457. DSH_E2E_MAX_WORKERS: '1'
  458. DSH_GATE_CONCURRENCY: '1'
  459. DSH_PUBLINT_CONCURRENCY: '1'
  460. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  461. run: pnpm run check:ci
  462. serial-windows:
  463. if: github.event_name == 'workflow_dispatch'
  464. name: serial / windows
  465. runs-on: windows-2025
  466. steps:
  467. - uses: actions/checkout@v6
  468. - name: Enable Developer Mode (symlink support)
  469. shell: pwsh
  470. run: >-
  471. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  472. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  473. - uses: actions/setup-node@v6
  474. with:
  475. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  476. - name: Enable corepack (pnpm)
  477. shell: pwsh
  478. run: corepack enable
  479. - name: Install (immutable)
  480. shell: pwsh
  481. run: pnpm install --frozen-lockfile
  482. - name: Run complete unsharded primary Node CI serially
  483. shell: pwsh
  484. env:
  485. DSH_COVERAGE_MAX_WORKERS: '1'
  486. DSH_E2E_MAX_WORKERS: '1'
  487. DSH_GATE_CONCURRENCY: '1'
  488. DSH_PUBLINT_CONCURRENCY: '1'
  489. DSH_SNAPSHOT_MAX_CONCURRENCY: '1'
  490. run: pnpm run check:ci
  491. # Single stable required check for branch protection: require "all checks
  492. # passed" instead of enumerating matrix legs whose names change as lanes and
  493. # node versions evolve. Every blocking job in THIS workflow must be listed in
  494. # `needs`; explicitly observational jobs such as windows-gates stay out
  495. # (`needs` cannot reach across workflow files; e2e.yml stays its own check).
  496. # `if: always()` is load-bearing: without it a failed dependency
  497. # would SKIP this job, and GitHub counts a skipped required check as passing
  498. # — so this job always runs and fails on any non-success result, including
  499. # 'cancelled' and 'skipped'.
  500. all-checks-passed:
  501. name: all checks passed
  502. runs-on: ubuntu-latest
  503. needs: [node-24, node-compat, python-sdk, windows-build, windows-site]
  504. if: always() && github.event_name != 'workflow_dispatch'
  505. steps:
  506. - name: Fail if any needed job did not succeed
  507. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  508. run: |
  509. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  510. exit 1
  511. - name: All checks passed
  512. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"