1
1
name : ci
2
2
3
3
on :
4
- - pull_request
5
- - push
4
+ pull_request :
5
+ branches :
6
+ - master
7
+ paths-ignore :
8
+ - ' *.md'
9
+ push :
10
+ paths-ignore :
11
+ - ' *.md'
12
+
13
+ permissions :
14
+ contents : read
15
+
16
+ # Cancel in progress workflows
17
+ # in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run
18
+ concurrency :
19
+ group : " ${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
20
+ cancel-in-progress : true
6
21
7
22
jobs :
23
+ lint :
24
+ name : Lint
25
+ runs-on : ubuntu-latest
26
+ steps :
27
+ - uses : actions/checkout@v4
28
+ - name : Setup Node.js
29
+ uses : actions/setup-node@v4
30
+ with :
31
+ node-version : ' lts/*'
32
+
33
+ - name : Install dependencies
34
+ run : npm install --ignore-scripts --only=dev
35
+
36
+ - name : Run lint
37
+ run : npm run lint
38
+
8
39
test :
9
40
runs-on : ubuntu-20.04
10
41
strategy :
42
+ fail-fast : false
11
43
matrix :
12
44
name :
13
45
- Node.js 0.6
33
65
- Node.js 17.x
34
66
- Node.js 18.x
35
67
- Node.js 19.x
68
+ - Node.js 20.x
69
+ - Node.js 21.x
70
+ - Node.js 22.x
71
+ - Node.js 23.x
36
72
37
73
include :
38
74
- name : Node.js 0.6
@@ -66,65 +102,75 @@ jobs:
66
102
67
103
68
104
- name : Node.js 4.x
69
- node-version : " 4.9 "
105
+ node-version : " 4"
70
106
71
107
72
108
- name : Node.js 5.x
73
- node-version : " 5.12 "
109
+ node-version : " 5"
74
110
75
111
76
112
- name : Node.js 6.x
77
- node-version : " 6.17 "
78
-
113
+ node-version : " 6"
114
+
79
115
80
116
- name : Node.js 7.x
81
- node-version : " 7.10 "
82
-
117
+ node-version : " 7"
118
+
83
119
84
120
- name : Node.js 8.x
85
- node-version : " 8.17 "
121
+ node-version : " 8"
86
122
87
123
88
124
- name : Node.js 9.x
89
- node-version : " 9.11 "
125
+ node-version : " 9"
90
126
91
127
92
128
- name : Node.js 10.x
93
- node-version : " 10.24 "
129
+ node-version : " 10"
94
130
95
131
96
132
- name : Node.js 11.x
97
- node-version : " 11.15 "
133
+ node-version : " 11"
98
134
99
135
100
136
- name : Node.js 12.x
101
- node-version : " 12.22"
102
-
137
+ node-version : " 12"
103
138
104
139
- name : Node.js 13.x
105
- node-version : " 13.14"
106
-
140
+ node-version : " 13"
107
141
108
142
- name : Node.js 14.x
109
- node-version : " 14.21 "
143
+ node-version : " 14"
110
144
111
145
- name : Node.js 15.x
112
- node-version : " 15.14 "
146
+ node-version : " 15"
113
147
114
148
- name : Node.js 16.x
115
- node-version : " 16.19 "
149
+ node-version : " 16"
116
150
117
151
- name : Node.js 17.x
118
- node-version : " 17.9 "
152
+ node-version : " 17"
119
153
120
154
- name : Node.js 18.x
121
- node-version : " 18.14 "
155
+ node-version : " 18"
122
156
123
157
- name : Node.js 19.x
124
- node-version : " 19.6"
158
+ node-version : " 19"
159
+
160
+ - name : Node.js 20.x
161
+ node-version : " 20"
162
+
163
+ - name : Node.js 21.x
164
+ node-version : " 21"
165
+
166
+ - name : Node.js 22.x
167
+ node-version : " 22"
168
+
169
+ - name : Node.js 23.x
170
+ node-version : " 23"
125
171
126
172
steps :
127
- - uses : actions/checkout@v3
173
+ - uses : actions/checkout@v4
128
174
129
175
- name : Install Node.js ${{ matrix.node-version }}
130
176
shell : bash -eo pipefail -l {0}
@@ -176,8 +222,8 @@ jobs:
176
222
shell : bash
177
223
run : |
178
224
# eslint for linting
179
- # - remove on Node.js < 12
180
- if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; then
225
+ # - remove on Node.js < 10
226
+ if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
181
227
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
182
228
grep -E '^eslint(-|$)' | \
183
229
sort -r | \
@@ -194,60 +240,50 @@ jobs:
194
240
echo "node@$(node -v)"
195
241
echo "npm@$(npm -v)"
196
242
npm -s ls ||:
197
- (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "= " $3 }' >> "$GITHUB_OUTPUT"
243
+ (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 ":: " $3 }'
198
244
199
245
- name : Run tests
200
246
shell : bash
201
247
run : |
202
248
if npm -ps ls nyc | grep -q nyc; then
203
249
npm run test-ci
204
- cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov"
205
250
else
206
251
npm test
207
252
fi
208
253
209
- - name : Lint code
210
- if : steps.list_env.outputs.eslint != ''
211
- run : npm run lint
212
-
213
- - name : Collect code coverage
214
- if : steps.list_env.outputs.nyc != ''
215
- run : |
216
- if [[ -d ./coverage ]]; then
217
- mv ./coverage "./${{ matrix.name }}"
218
- mkdir ./coverage
219
- mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}"
220
- fi
221
-
222
254
- name : Upload code coverage
223
- uses : actions/upload-artifact@v3
224
255
if : steps.list_env.outputs.nyc != ''
256
+ uses : actions/upload-artifact@v4
225
257
with :
226
- name : coverage
227
- path : ./coverage
258
+ name : coverage-node-${{ matrix.node-version }}
259
+ path : ./coverage/lcov.info
228
260
retention-days : 1
229
261
230
262
coverage :
231
263
needs : test
232
264
runs-on : ubuntu-latest
265
+ permissions :
266
+ contents : read
267
+ checks : write
233
268
steps :
234
- - uses : actions/checkout@v3
269
+ - uses : actions/checkout@v4
235
270
236
271
- name : Install lcov
237
272
shell : bash
238
273
run : sudo apt-get -y install lcov
239
274
240
275
- name : Collect coverage reports
241
- uses : actions/download-artifact@v3
276
+ uses : actions/download-artifact@v4
242
277
with :
243
- name : coverage
244
278
path : ./coverage
279
+ pattern : coverage-node-*
245
280
246
281
- name : Merge coverage reports
247
282
shell : bash
248
- run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/ lcov.info
283
+ run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
249
284
250
285
- name : Upload coverage report
251
- uses : coverallsapp/github-action@master
286
+ uses : coverallsapp/github-action@v2
252
287
with :
253
288
github-token : ${{ secrets.GITHUB_TOKEN }}
289
+ file : ./lcov.info
0 commit comments