chore: sync repo to shared standard (#47) #98
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Node.js CI | |
| on: | |
| push: | |
| branches: [master, main] | |
| pull_request: | |
| branches: [master, main] | |
| # Least privilege for GITHUB_TOKEN. Without an explicit block a workflow inherits the | |
| # repository default, which on many repos is read *and write* to everything -- flagged by | |
| # CodeQL as actions/missing-workflow-permissions. This job only reads the checkout; the | |
| # artifact upload authenticates with the runtime token, not GITHUB_TOKEN. | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [22.x, 24.x] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run lint | |
| - run: npm run format:check | |
| - run: npm test | |
| - run: npm run coverage:check | |
| # Uploaded from one matrix leg only — the report is identical across them, and | |
| # two legs writing the same artifact name is an error. Makes a coverage | |
| # regression inspectable from the failing run instead of only reproducible locally. | |
| - name: Upload coverage report | |
| if: matrix.node-version == '22.x' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage-report | |
| # Only the readable report, not all of `coverage/`. c8 also writes its | |
| # raw V8 dump to coverage/tmp, which is ~97% of the bytes and inspectable | |
| # by nothing — measured at 23 MB of tmp against a 647 kB report. Uploading | |
| # the directory ships that dead weight on every run for the whole | |
| # retention window, and the step exists to make a failure *readable*. | |
| # Requires c8 to emit a report: `"reporter": ["text", "lcov"]`. | |
| path: | | |
| coverage/lcov-report | |
| coverage/lcov.info | |
| retention-days: 14 |