ci.yml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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 static, lint, and artifact lanes. Coverage
  156. # and snapshot stay Linux-only until their platform-specific runtime failures
  157. # have dedicated support. Run the gates from native PowerShell: an MSYS parent
  158. # would change the environment being measured. This job intentionally stays
  159. # out of all-checks-passed.needs.
  160. windows-gates:
  161. continue-on-error: true
  162. runs-on: windows-2025
  163. name: windows node 24 / ${{ matrix.lane }}
  164. env:
  165. DSH_GATE_CONCURRENCY: ${{ matrix.gate_concurrency }}
  166. DSH_PUBLINT_CONCURRENCY: ${{ matrix.publint_concurrency }}
  167. DSH_ESLINT_CACHE: ${{ matrix.eslint_cache }}
  168. strategy:
  169. fail-fast: false
  170. matrix:
  171. include:
  172. - lane: static
  173. command: pnpm run check:ci:static
  174. gate_concurrency: '4'
  175. publint_concurrency: '8'
  176. eslint_cache: ''
  177. - lane: lint
  178. command: pnpm run check:ci:lint
  179. gate_concurrency: '1'
  180. publint_concurrency: '8'
  181. eslint_cache: '1'
  182. - lane: artifacts
  183. command: pnpm run check:ci:artifacts
  184. gate_concurrency: '3'
  185. publint_concurrency: '8'
  186. eslint_cache: ''
  187. steps:
  188. - uses: actions/checkout@v6
  189. - name: Enable Developer Mode (symlink support)
  190. shell: pwsh
  191. run: >-
  192. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  193. /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  194. - uses: actions/setup-node@v6
  195. with:
  196. node-version: ${{ env.PRIMARY_NODE_VERSION }}
  197. - name: Enable corepack (pnpm)
  198. shell: pwsh
  199. run: corepack enable
  200. - name: Resolve pnpm store path
  201. id: pnpm-store
  202. shell: pwsh
  203. run: '"path=$(pnpm store path --silent)" >> $env:GITHUB_OUTPUT'
  204. - uses: actions/cache@v4
  205. with:
  206. path: ${{ steps.pnpm-store.outputs.path }}
  207. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
  208. restore-keys: |
  209. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
  210. - name: Install (immutable)
  211. shell: pwsh
  212. run: pnpm install --frozen-lockfile
  213. - uses: actions/cache@v4
  214. if: matrix.lane == 'lint'
  215. with:
  216. path: .cache/eslint
  217. key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'tsconfig.json', 'packages/*/*/tsconfig.json', 'examples/*/tsconfig.json') }}
  218. restore-keys: |
  219. ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-eslint-
  220. - name: Run gates
  221. shell: pwsh
  222. run: ${{ matrix.command }}
  223. # Single stable required check for branch protection: require "all checks
  224. # passed" instead of enumerating matrix legs whose names change as lanes and
  225. # node versions evolve. Every blocking job in THIS workflow must be listed in
  226. # `needs`; explicitly observational jobs such as windows-gates stay out
  227. # (`needs` cannot reach across workflow files; e2e.yml stays its own check).
  228. # `if: always()` is load-bearing: without it a failed dependency
  229. # would SKIP this job, and GitHub counts a skipped required check as passing
  230. # — so this job always runs and fails on any non-success result, including
  231. # 'cancelled' and 'skipped'.
  232. all-checks-passed:
  233. name: all checks passed
  234. runs-on: ubuntu-latest
  235. needs: [node-24, node-compat, python-sdk, windows-build]
  236. if: always()
  237. steps:
  238. - name: Fail if any needed job did not succeed
  239. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  240. run: |
  241. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  242. exit 1
  243. - name: All checks passed
  244. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"