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
- - Node.js 0.6
14
45
- Node.js 0.8
15
46
- Node.js 0.10
16
47
- Node.js 0.12
33
64
- Node.js 17.x
34
65
- Node.js 18.x
35
66
- Node.js 19.x
67
+ - Node.js 20.x
68
+ - Node.js 21.x
69
+ - Node.js 22.x
70
+ - Node.js 23.x
36
71
37
72
include :
38
73
- name : Node.js 0.6
@@ -66,65 +101,75 @@ jobs:
66
101
67
102
68
103
- name : Node.js 4.x
69
- node-version : " 4.9 "
104
+ node-version : " 4"
70
105
71
106
72
107
- name : Node.js 5.x
73
- node-version : " 5.12 "
108
+ node-version : " 5"
74
109
75
110
76
111
- name : Node.js 6.x
77
- node-version : " 6.17 "
78
-
112
+ node-version : " 6"
113
+
79
114
80
115
- name : Node.js 7.x
81
- node-version : " 7.10 "
82
-
116
+ node-version : " 7"
117
+
83
118
84
119
- name : Node.js 8.x
85
- node-version : " 8.17 "
120
+ node-version : " 8"
86
121
87
122
88
123
- name : Node.js 9.x
89
- node-version : " 9.11 "
124
+ node-version : " 9"
90
125
91
126
92
127
- name : Node.js 10.x
93
- node-version : " 10.24 "
128
+ node-version : " 10"
94
129
95
130
96
131
- name : Node.js 11.x
97
- node-version : " 11.15 "
132
+ node-version : " 11"
98
133
99
134
100
135
- name : Node.js 12.x
101
- node-version : " 12.22"
102
-
136
+ node-version : " 12"
103
137
104
138
- name : Node.js 13.x
105
- node-version : " 13.14"
106
-
139
+ node-version : " 13"
107
140
108
141
- name : Node.js 14.x
109
- node-version : " 14.21 "
142
+ node-version : " 14"
110
143
111
144
- name : Node.js 15.x
112
- node-version : " 15.14 "
145
+ node-version : " 15"
113
146
114
147
- name : Node.js 16.x
115
- node-version : " 16.19 "
148
+ node-version : " 16"
116
149
117
150
- name : Node.js 17.x
118
- node-version : " 17.9 "
151
+ node-version : " 17"
119
152
120
153
- name : Node.js 18.x
121
- node-version : " 18.14 "
154
+ node-version : " 18"
122
155
123
156
- name : Node.js 19.x
124
- node-version : " 19.6"
157
+ node-version : " 19"
158
+
159
+ - name : Node.js 20.x
160
+ node-version : " 20"
161
+
162
+ - name : Node.js 21.x
163
+ node-version : " 21"
164
+
165
+ - name : Node.js 22.x
166
+ node-version : " 22"
167
+
168
+ - name : Node.js 23.x
169
+ node-version : " 23"
125
170
126
171
steps :
127
- - uses : actions/checkout@v3
172
+ - uses : actions/checkout@v4
128
173
129
174
- name : Install Node.js ${{ matrix.node-version }}
130
175
shell : bash -eo pipefail -l {0}
@@ -141,6 +186,7 @@ jobs:
141
186
if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
142
187
nvm install --alias=npm 0.10
143
188
nvm use ${{ matrix.node-version }}
189
+ sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
144
190
if [[ "$(npm -v)" == 1.1.* ]]; then
145
191
nvm exec npm npm install -g [email protected]
146
192
ln -fs "$(which npm)" "$(dirname "$(nvm which npm)")/npm"
@@ -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