ci.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. # Single stable required check for branch protection: require "all checks
  126. # passed" instead of enumerating matrix legs whose names change as lanes and
  127. # node versions evolve. Every other job in THIS workflow must be listed in
  128. # `needs` (`needs` cannot reach across workflow files; e2e.yml stays its own
  129. # check). `if: always()` is load-bearing: without it a failed dependency
  130. # would SKIP this job, and GitHub counts a skipped required check as passing
  131. # — so this job always runs and fails on any non-success result, including
  132. # 'cancelled' and 'skipped'.
  133. all-checks-passed:
  134. name: all checks passed
  135. runs-on: ubuntu-latest
  136. needs: [node-24, node-compat]
  137. if: always()
  138. steps:
  139. - name: Fail if any needed job did not succeed
  140. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
  141. run: |
  142. echo "::error::Needed job results: ${{ join(needs.*.result, ', ') }}"
  143. exit 1
  144. - name: All checks passed
  145. run: echo "All needed jobs succeeded (${{ join(needs.*.result, ', ') }})"