|
1 | | -name: CI |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: [main] |
6 | | - pull_request: |
7 | | - |
8 | | -# Least privilege: this workflow only needs to read the repo. |
9 | | -permissions: |
10 | | - contents: read |
11 | | - |
12 | | -# Cancel superseded runs for the same ref to save CI minutes. |
13 | | -concurrency: |
14 | | - group: ci-${{ github.ref }} |
15 | | - cancel-in-progress: true |
16 | | - |
17 | | -jobs: |
18 | | - check: |
19 | | - runs-on: ubuntu-latest |
20 | | - strategy: |
21 | | - # Test the oldest Node we claim to support (package.json engines) |
22 | | - # alongside current, so "works on my machine" can't hide an engines |
23 | | - # violation. |
24 | | - matrix: |
25 | | - node-version: [22, 24] |
26 | | - steps: |
27 | | - # Actions are pinned to commit SHAs (supply-chain hardening); the |
28 | | - # trailing comment records the human-readable version. v6 runs on the |
29 | | - # Node 24 action runtime, clearing the Node 20 deprecation warning. |
30 | | - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
31 | | - with: |
32 | | - # No step here pushes or calls the API; don't leave the token in |
33 | | - # .git/config for the rest of the job. |
34 | | - persist-credentials: false |
35 | | - |
36 | | - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
37 | | - with: |
38 | | - node-version: ${{ matrix.node-version }} |
39 | | - cache: npm |
40 | | - |
41 | | - - run: npm ci |
42 | | - |
43 | | - - name: Validate manifest.json parses |
44 | | - run: node -e "JSON.parse(require('fs').readFileSync('manifest.json','utf8'))" |
45 | | - |
46 | | - - run: npm run lint |
47 | | - |
48 | | - - run: npm run format:check |
49 | | - |
50 | | - - run: npm run typecheck |
51 | | - |
52 | | - - run: npm run coverage |
53 | | - |
54 | | - - run: npm run build |
55 | | - |
56 | | - # Merge gate: branch protection requires a single status named "check". |
57 | | - # Reporting that name from an aggregate job (instead of the matrix legs, |
58 | | - # whose names carry the Node version) keeps the required-check name |
59 | | - # stable no matter how the matrix changes. |
60 | | - ci-ok: |
61 | | - name: check |
62 | | - needs: check |
63 | | - if: always() |
64 | | - runs-on: ubuntu-latest |
65 | | - steps: |
66 | | - - name: Fail unless every matrix leg succeeded |
67 | | - run: test "${{ needs.check.result }}" = "success" |
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +# Least privilege: this workflow only needs to read the repo. |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +# Cancel superseded runs for the same ref to save CI minutes. |
| 13 | +concurrency: |
| 14 | + group: ci-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + check: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + strategy: |
| 21 | + # Test the oldest Node we claim to support (package.json engines) |
| 22 | + # alongside current, so "works on my machine" can't hide an engines |
| 23 | + # violation. |
| 24 | + matrix: |
| 25 | + node-version: [22, 24] |
| 26 | + steps: |
| 27 | + # Actions are pinned to commit SHAs (supply-chain hardening); the |
| 28 | + # trailing comment records the human-readable version. v6 runs on the |
| 29 | + # Node 24 action runtime, clearing the Node 20 deprecation warning. |
| 30 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 31 | + with: |
| 32 | + # No step here pushes or calls the API; don't leave the token in |
| 33 | + # .git/config for the rest of the job. |
| 34 | + persist-credentials: false |
| 35 | + |
| 36 | + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| 37 | + with: |
| 38 | + node-version: ${{ matrix.node-version }} |
| 39 | + cache: npm |
| 40 | + |
| 41 | + - run: npm ci |
| 42 | + |
| 43 | + - name: Validate manifest.json parses |
| 44 | + run: node -e "JSON.parse(require('fs').readFileSync('manifest.json','utf8'))" |
| 45 | + |
| 46 | + - run: npm run lint |
| 47 | + |
| 48 | + - run: npm run format:check |
| 49 | + |
| 50 | + - run: npm run typecheck |
| 51 | + |
| 52 | + - run: npm run coverage |
| 53 | + |
| 54 | + - run: npm run build |
| 55 | + |
| 56 | + # Merge gate: branch protection requires a single status named "check". |
| 57 | + # Reporting that name from an aggregate job (instead of the matrix legs, |
| 58 | + # whose names carry the Node version) keeps the required-check name |
| 59 | + # stable no matter how the matrix changes. |
| 60 | + ci-ok: |
| 61 | + name: check |
| 62 | + needs: check |
| 63 | + if: always() |
| 64 | + runs-on: ubuntu-latest |
| 65 | + steps: |
| 66 | + - name: Fail unless every matrix leg succeeded |
| 67 | + run: test "${{ needs.check.result }}" = "success" |
0 commit comments