-
-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (48 loc) · 2.15 KB
/
Copy pathnode.js.yml
File metadata and controls
51 lines (48 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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