ci.yml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. name: CI
  2. on:
  3. push:
  4. branches: [main, master]
  5. pull_request:
  6. concurrency:
  7. group: ${{ github.workflow }}-${{ github.ref }}
  8. cancel-in-progress: true
  9. permissions:
  10. contents: read
  11. env:
  12. PRIMARY_NODE_VERSION: '24'
  13. jobs:
  14. node-24:
  15. runs-on: ubuntu-latest
  16. name: node 24 / ${{ matrix.lane }}
  17. env:
  18. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  19. DSH_PUBLINT_CONCURRENCY: ${{ matrix.publint_concurrency }}
  20. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.coverage_max_workers }}
  21. DSH_ESLINT_CACHE: ${{ matrix.eslint_cache }}
  22. strategy:
  23. fail-fast: false
  24. matrix:
  25. include:
  26. - lane: static
  27. command: pnpm run check:ci:static
  28. gate_concurrency: '4'
  29. publint_concurrency: '8'
  30. coverage_max_workers: ''
  31. eslint_cache: ''
  32. - lane: lint
  33. command: pnpm run check:ci:lint
  34. gate_concurrency: '1'
  35. publint_concurrency: '8'
  36. coverage_max_workers: ''
  37. eslint_cache: '1'
  38. - lane: coverage
  39. command: pnpm run check:ci:coverage
  40. gate_concurrency: '1'
  41. publint_concurrency: '8'
  42. coverage_max_workers: '4'
  43. eslint_cache: ''
  44. - lane: snapshot
  45. command: pnpm run check:ci:snapshot
  46. gate_concurrency: '1'
  47. publint_concurrency: '8'
  48. coverage_max_workers: ''
  49. eslint_cache: ''
  50. - lane: artifacts
  51. command: pnpm run check:ci:artifacts
  52. gate_concurrency: '3'
  53. publint_concurrency: '8'
  54. coverage_max_workers: ''
  55. eslint_cache: ''
  56. steps:
  57. - uses: actions/checkout@v6
  58. - uses: actions/setup-node@v6
  59. with:
  60. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  61. - name: Enable corepack (pnpm)
  62. run: corepack enable
  63. - name: Resolve pnpm store path
  64. id: pnpm-store
  65. run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  66. - uses: actions/cache@v4
  67. with:
  68. path: ${{ steps.pnpm-store.outputs.path }}
  69. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  70. restore-keys: |
  71. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  72. - name: Install (immutable)
  73. run: pnpm install --frozen-lockfile
  74. # The snapshot lane REPLAYS the sandbox example's recorded scenarios,
  75. # re-executing their bash calls under a real runner. ubuntu-latest has
  76. # no bubblewrap preinstalled and no built Landlock launcher, so without
  77. # this the confined executions fail closed (SANDBOX_UNAVAILABLE). Same
  78. # install as sandbox.yml's bwrap leg (incl. the Ubuntu 24.04 AppArmor
  79. # userns knob).
  80. - name: Install bubblewrap (unrestrict userns)
  81. if: matrix.lane == 'snapshot'
  82. run: |
  83. sudo apt-get update -q
  84. sudo apt-get install -yq bubblewrap
  85. sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 \
  86. || echo "apparmor userns knob absent — the functional probe decides"
  87. - uses: actions/cache@v4
  88. if: matrix.lane == 'lint'
  89. with:
  90. path: .cache/eslint
  91. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'tsconfig.json', 'packages/*/*/tsconfig.json', 'examples/*/tsconfig.json') }}
  92. restore-keys: |
  93. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-
  94. - name: Run gates
  95. run: ${{ matrix.command }}
  96. node-compat:
  97. runs-on: ubuntu-latest
  98. name: node ${{ matrix.node }}
  99. env:
  100. DSH_GATE_CONCURRENCY: '2'
  101. strategy:
  102. fail-fast: false
  103. matrix:
  104. node: ['22.19', 24, 26]
  105. steps:
  106. - uses: actions/checkout@v6
  107. - uses: actions/setup-node@v6
  108. with:
  109. node-version: ${{ matrix.node }}
  110. - name: Enable corepack (pnpm)
  111. run: corepack enable
  112. - name: Resolve pnpm store path
  113. id: pnpm-store
  114. run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
  115. - uses: actions/cache@v4
  116. with:
  117. path: ${{ steps.pnpm-store.outputs.path }}
  118. key: ${{ runner.os }}-node-${{ matrix.node }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  119. restore-keys: |
  120. ${{ runner.os }}-node-${{ matrix.node }}-pnpm-
  121. - name: Install (immutable)
  122. run: pnpm install --frozen-lockfile
  123. - name: Run compatibility gates
  124. run: pnpm run check:node-compat
  125. python-sdk:
  126. runs-on: ubuntu-latest
  127. name: python 3.10 / keyless SDK
  128. steps:
  129. - uses: actions/checkout@v6
  130. - uses: actions/setup-python@v6
  131. with:
  132. python-version: '3.10'
  133. cache: pip
  134. - name: Install uv
  135. run: python -m pip install uv==0.11.23
  136. - name: Run complete keyless Python suite
  137. run: uv run --python 3.10 --group test --project python/sdk pytest
  138. # Blocking Windows build lane: keep the already-green native build protected
  139. # while the broader observational gate matrix below exposes the remaining
  140. # portability work without blocking mainline merges.
  141. windows-build:
  142. runs-on: windows-2025
  143. name: windows / build
  144. steps:
  145. - uses: actions/checkout@v6
  146. - uses: actions/setup-node@v6
  147. with:
  148. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  149. - name: Enable corepack (pnpm)
  150. run: corepack enable
  151. - name: Install (immutable)
  152. run: pnpm install --frozen-lockfile
  153. - name: Build (tsc -b + tsdown)
  154. run: pnpm run build
  155. # Observational, non-blocking Windows mirror of the Linux gate lanes. Run the
  156. # gates from native PowerShell: an MSYS parent would change the environment
  157. # being measured. This job intentionally stays out of all-checks-passed.needs.
  158. windows-gates:
  159. continue-on-error: true
  160. runs-on: windows-2025
  161. name: windows node 24 / ${{ matrix.lane }}
  162. env:
  163. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  164. DSH_PUBLINT_CONCURRENCY: ${{ matrix.publint_concurrency }}
  165. DSH_COVERAGE_MAX_WORKERS: ${{ matrix.coverage_max_workers }}
  166. DSH_ESLINT_CACHE: ${{ matrix.eslint_cache }}
  167. strategy:
  168. fail-fast: false
  169. matrix:
  170. include:
  171. - lane: static
  172. command: pnpm run check:ci:static
  173. gate_concurrency: '4'
  174. publint_concurrency: '8'
  175. coverage_max_workers: ''
  176. eslint_cache: ''
  177. - lane: lint
  178. command: pnpm run check:ci:lint
  179. gate_concurrency: '1'
  180. publint_concurrency: '8'
  181. coverage_max_workers: ''
  182. eslint_cache: '1'
  183. - lane: coverage
  184. command: pnpm run check:ci:coverage
  185. gate_concurrency: '1'
  186. publint_concurrency: '8'
  187. coverage_max_workers: '4'
  188. eslint_cache: ''
  189. - lane: snapshot
  190. command: pnpm run check:ci:snapshot
  191. gate_concurrency: '1'
  192. publint_concurrency: '8'
  193. coverage_max_workers: ''
  194. eslint_cache: ''
  195. - lane: artifacts
  196. command: pnpm run check:ci:artifacts
  197. gate_concurrency: '3'
  198. publint_concurrency: '8'
  199. coverage_max_workers: ''
  200. eslint_cache: ''
  201. steps:
  202. - uses: actions/checkout@v6
  203. - name: Enable Developer Mode (symlink support)
  204. shell: pwsh
  205. run: >-
  206. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  207. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  208. - uses: actions/setup-node@v6
  209. with:
  210. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  211. - name: Enable corepack (pnpm)
  212. shell: pwsh
  213. run: corepack enable
  214. - name: Resolve pnpm store path
  215. id: pnpm-store
  216. shell: pwsh
  217. run: '"path=$(pnpm store path --silent)" >> $env:GITHUB_OUTPUT'
  218. - uses: actions/cache@v4
  219. with:
  220. path: ${{ steps.pnpm-store.outputs.path }}
  221. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  222. restore-keys: |
  223. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  224. - name: Install (immutable)
  225. shell: pwsh
  226. run: pnpm install --frozen-lockfile
  227. - uses: actions/cache@v4
  228. if: matrix.lane == 'lint'
  229. with:
  230. path: .cache/eslint
  231. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'tsconfig.json', 'packages/*/*/tsconfig.json', 'examples/*/tsconfig.json') }}
  232. restore-keys: |
  233. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-
  234. - name: Run gates
  235. shell: pwsh
  236. run: ${{ matrix.command }}
  237. # Single stable required check for branch protection: require "all checks
  238. # passed" instead of enumerating matrix legs whose names change as lanes and
  239. # node versions evolve. Every blocking job in THIS workflow must be listed in
  240. # `needs`; explicitly observational jobs such as windows-gates stay out
  241. # (`needs` cannot reach across workflow files; e2e.yml stays its own check).
  242. # `if: always()` is load-bearing: without it a failed dependency
  243. # would SKIP this job, and GitHub counts a skipped required check as passing
  244. # — so this job always runs and fails on any non-success result, including
  245. # 'cancelled' and 'skipped'.
  246. all-checks-passed:
  247. name: all checks passed
  248. runs-on: ubuntu-latest
  249. needs: [node-24, node-compat, python-sdk, windows-build]
  250. if: always()
  251. steps:
  252. - name: Fail if any needed job did not succeed
  253. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  254. run: |
  255. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  256. exit 1
  257. - name: All checks passed
  258. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"