-
Notifications
You must be signed in to change notification settings - Fork 18
78 lines (66 loc) · 2.38 KB
/
node.js.yml
File metadata and controls
78 lines (66 loc) · 2.38 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
permissions:
contents: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [20, 22, 24, 25]
include:
- node-version: 24
is-main: true
- node-version: 25
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
continue-on-error: ${{ matrix.experimental == true }}
- name: Test
run: npm run test-with-report
continue-on-error: ${{ matrix.experimental == true }}
- name: Prepare Coverage Report
if: matrix.is-main == true && github.event_name == 'pull_request'
id: coverage
run: |
REPORT=$(<coverage/coverage-summary.json)
LINES=$(jq -r '.total.lines.pct' <<< "$REPORT")
STATEMENTS=$(jq -r '.total.statements.pct' <<< "$REPORT")
FUNCTIONS=$(jq -r '.total.functions.pct' <<< "$REPORT")
BRANCHES=$(jq -r '.total.branches.pct' <<< "$REPORT")
echo "lines=$LINES" >> $GITHUB_OUTPUT
echo "statements=$STATEMENTS" >> $GITHUB_OUTPUT
echo "functions=$FUNCTIONS" >> $GITHUB_OUTPUT
echo "branches=$BRANCHES" >> $GITHUB_OUTPUT
- name: Sticky Pull Request Comment
if: matrix.is-main == true && github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: coverage
message: |
## Test Coverage Summary Statistics
* __Lines:__ ${{ steps.coverage.outputs.lines }}%
* __Statements:__ ${{ steps.coverage.outputs.statements }}%
* __Functions:__ ${{ steps.coverage.outputs.functions }}%
* __Branches:__ ${{ steps.coverage.outputs.branches }}%
- name: Update Coverage Badge
if: |
matrix.is-main == true &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: we-cli/coverage-badge-action@8a0b6ee05f6dd0f294089cbe7a848452a2b43eef