|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths-ignore: |
| 7 | + # skip verify/test only for NON-shipped docs — a SHIPPED markdown artifact (skills/**/SKILL.md, commands/*.md) MUST run CI (verify checks dist-sync) |
| 8 | + - 'README.md' |
| 9 | + - 'CHANGELOG.md' |
| 10 | + - 'CONTRIBUTING.md' |
| 11 | + - 'PRIVACY.md' |
| 12 | + - 'SECURITY.md' |
| 13 | + - 'LICENSE' |
| 14 | + pull_request: |
| 15 | + branches: [main] |
| 16 | + paths-ignore: |
| 17 | + # skip verify/test only for NON-shipped docs — a SHIPPED markdown artifact (skills/**/SKILL.md, commands/*.md) MUST run CI (verify checks dist-sync) |
| 18 | + - 'README.md' |
| 19 | + - 'CHANGELOG.md' |
| 20 | + - 'CONTRIBUTING.md' |
| 21 | + - 'PRIVACY.md' |
| 22 | + - 'SECURITY.md' |
| 23 | + - 'LICENSE' |
| 24 | + |
| 25 | +permissions: |
| 26 | + contents: read |
| 27 | + |
| 28 | +jobs: |
| 29 | + gate: |
| 30 | + name: gate (${{ matrix.os }} · node ${{ matrix.node }}) |
| 31 | + strategy: |
| 32 | + fail-fast: false |
| 33 | + matrix: |
| 34 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 35 | + node: [22, 24] # supported LTS only (24 Active, 22 Maintenance); 18/20 are EOL — bump as the Node LTS schedule moves |
| 36 | + runs-on: ${{ matrix.os }} |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 39 | + with: |
| 40 | + # 0 = all history for ALL branches AND tags (action.yml @ this pinned tag: "0 |
| 41 | + # indicates all history for all branches and tags") — without this, git's |
| 42 | + # shallow default leaves no tag reachable, so task #38's dist-changelog gate |
| 43 | + # (scripts/lib/dist-changelog.mjs) SKIPs on every CI run. fetch-tags is NOT |
| 44 | + # needed alongside this: its own description scopes it to "even if |
| 45 | + # fetch-depth > 0" — the shallow case — which fetch-depth: 0 isn't. |
| 46 | + fetch-depth: 0 |
| 47 | + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 |
| 48 | + with: |
| 49 | + node-version: ${{ matrix.node }} |
| 50 | + # Zero-dependency: no install step. Run the same fail-loud gate as a local pre-push, |
| 51 | + # cross-platform — verify (dist-sync + repo consistency checks) then the test suite. |
| 52 | + # No build step here: rebuilding the dist in CI would mask a stale COMMITTED |
| 53 | + # plugin/ — the exact drift verify exists to catch. |
| 54 | + - run: node scripts/verify.mjs |
| 55 | + - run: node scripts/test.mjs |
| 56 | + # PowerShell parity tests (the PS twins of the Node hooks) — pwsh ships on the GitHub |
| 57 | + # runners; skip gracefully if it is ever absent so the node gate above still gates. |
| 58 | + - name: PowerShell parity tests |
| 59 | + shell: bash |
| 60 | + run: | |
| 61 | + if command -v pwsh >/dev/null 2>&1; then |
| 62 | + pwsh -NoProfile -File scripts/lib/ps-config.test.ps1 |
| 63 | + pwsh -NoProfile -File scripts/lib/ps-hooks.test.ps1 |
| 64 | + else |
| 65 | + echo "pwsh not found — skipping PS parity tests" |
| 66 | + fi |
| 67 | +
|
| 68 | +
|
| 69 | + # A single STABLE required-check context (the matrix names drift; this does not). |
| 70 | + # Succeeds iff every matrix gate passed or was legitimately skipped; fails if any |
| 71 | + # gate failed. Rulesets require `all-green`, never the per-matrix names. |
| 72 | + all-green: |
| 73 | + name: all-green |
| 74 | + needs: gate |
| 75 | + if: always() |
| 76 | + runs-on: ubuntu-latest |
| 77 | + steps: |
| 78 | + - name: gate result |
| 79 | + run: | |
| 80 | + case "${{ needs.gate.result }}" in |
| 81 | + success|skipped) echo "gate ${{ needs.gate.result }}"; exit 0 ;; |
| 82 | + *) echo "gate ${{ needs.gate.result }}"; exit 1 ;; |
| 83 | + esac |
0 commit comments