1
- name : Node CI
1
+ name : ci
2
2
3
3
on :
4
- pull_request :
5
- branches :
6
- - v3
7
4
push :
8
5
branches :
9
- - v3
6
+ - v3
7
+ pull_request :
8
+ branches :
9
+ - v3
10
+
11
+ permissions :
12
+ contents : read
13
+
14
+ # Cancel in progress workflows
15
+ # in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run
16
+ concurrency :
17
+ group : " ${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
18
+ cancel-in-progress : true
10
19
11
20
jobs :
21
+ lint :
22
+ name : Lint
23
+ runs-on : ubuntu-latest
24
+ steps :
25
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26
+ - name : Setup Node.js
27
+ uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
28
+ with :
29
+ node-version : ' lts/*'
30
+
31
+ - name : Install dependencies
32
+ run : npm install --ignore-scripts --include=dev
33
+
34
+ - name : Run lint
35
+ run : npm run lint
36
+
12
37
test :
13
38
strategy :
14
39
fail-fast : false
15
40
matrix :
16
- os : [ubuntu-latest, macOS-latest, windows-latest]
17
- node : [12.20.0, 14.13.1, 16.0.0, 16, 17, 18, 19, 20, 21, 22, 23, 24]
41
+ os : [ubuntu-latest, macos-latest, windows-latest]
42
+ node-version : [18, 19, 20, 21, 22, 23, 24]
43
+ # Node.js release schedule: https://nodejs.org/en/about/releases/
44
+
45
+ name : Node.js ${{ matrix.node-version }} - ${{matrix.os}}
46
+
18
47
runs-on : ${{ matrix.os }}
19
48
steps :
20
- - uses : actions/checkout@v2
21
- - name : Use Node.js ${{ matrix.node }}
22
- uses : actions/setup-node@v2
23
- with :
24
- node-version : ${{ matrix.node }}
25
- - name : Install dependencies
26
- run : npm install
27
- - name : Run tests
28
- run : npm test
49
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50
+ with :
51
+ persist-credentials : false
52
+
53
+ - name : Setup Node.js ${{ matrix.node-version }}
54
+ uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
55
+ with :
56
+ node-version : ${{ matrix.node-version }}
57
+
58
+ - name : Configure npm loglevel
59
+ run : |
60
+ npm config set loglevel error
61
+ shell : bash
62
+
63
+ - name : Install dependencies
64
+ run : npm install
65
+
66
+ - name : Output Node and NPM versions
67
+ run : |
68
+ echo "Node.js version: $(node -v)"
69
+ echo "NPM version: $(npm -v)"
70
+
71
+ - name : Run tests
72
+ shell : bash
73
+ run : npm run test:ci
74
+
75
+ - name : Upload code coverage
76
+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
77
+ with :
78
+ name : coverage-node-${{ matrix.node-version }}-${{ matrix.os }}
79
+ path : ./coverage/lcov.info
80
+ retention-days : 1
81
+
82
+ coverage :
83
+ needs : test
84
+ runs-on : ubuntu-latest
85
+ permissions :
86
+ contents : read
87
+ checks : write
88
+ steps :
89
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
90
+
91
+ - name : Install lcov
92
+ shell : bash
93
+ run : sudo apt-get -y install lcov
94
+
95
+ - name : Collect coverage reports
96
+ uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
97
+ with :
98
+ path : ./coverage
99
+ pattern : coverage-node-*
100
+
101
+ - name : Merge coverage reports
102
+ shell : bash
103
+ run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
104
+
105
+ - name : Upload coverage report
106
+ uses : coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
107
+ with :
108
+ file : ./lcov.info
0 commit comments