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,13 +64,12 @@ jobs:
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
- - name : Node.js 0.6
39
- node-version : " 0.6"
40
-
41
- npm-rm : nyc
42
-
43
73
- name : Node.js 0.8
44
74
node-version : " 0.8"
45
75
@@ -66,65 +96,75 @@ jobs:
66
96
67
97
68
98
- name : Node.js 4.x
69
- node-version : " 4.9 "
99
+ node-version : " 4"
70
100
71
101
72
102
- name : Node.js 5.x
73
- node-version : " 5.12 "
103
+ node-version : " 5"
74
104
75
105
76
106
- name : Node.js 6.x
77
- node-version : " 6.17 "
78
-
107
+ node-version : " 6"
108
+
79
109
80
110
- name : Node.js 7.x
81
- node-version : " 7.10 "
82
-
111
+ node-version : " 7"
112
+
83
113
84
114
- name : Node.js 8.x
85
- node-version : " 8.17 "
115
+ node-version : " 8"
86
116
87
117
88
118
- name : Node.js 9.x
89
- node-version : " 9.11 "
119
+ node-version : " 9"
90
120
91
121
92
122
- name : Node.js 10.x
93
- node-version : " 10.24 "
123
+ node-version : " 10"
94
124
95
125
96
126
- name : Node.js 11.x
97
- node-version : " 11.15 "
127
+ node-version : " 11"
98
128
99
129
100
130
- name : Node.js 12.x
101
- node-version : " 12.22"
102
-
131
+ node-version : " 12"
103
132
104
133
- name : Node.js 13.x
105
- node-version : " 13.14"
106
-
134
+ node-version : " 13"
107
135
108
136
- name : Node.js 14.x
109
- node-version : " 14.21 "
137
+ node-version : " 14"
110
138
111
139
- name : Node.js 15.x
112
- node-version : " 15.14 "
140
+ node-version : " 15"
113
141
114
142
- name : Node.js 16.x
115
- node-version : " 16.19 "
143
+ node-version : " 16"
116
144
117
145
- name : Node.js 17.x
118
- node-version : " 17.9 "
146
+ node-version : " 17"
119
147
120
148
- name : Node.js 18.x
121
- node-version : " 18.14 "
149
+ node-version : " 18"
122
150
123
151
- name : Node.js 19.x
124
- node-version : " 19.6"
152
+ node-version : " 19"
153
+
154
+ - name : Node.js 20.x
155
+ node-version : " 20"
156
+
157
+ - name : Node.js 21.x
158
+ node-version : " 21"
159
+
160
+ - name : Node.js 22.x
161
+ node-version : " 22"
162
+
163
+ - name : Node.js 23.x
164
+ node-version : " 23"
125
165
126
166
steps :
127
- - uses : actions/checkout@v3
167
+ - uses : actions/checkout@v4
128
168
129
169
- name : Install Node.js ${{ matrix.node-version }}
130
170
shell : bash -eo pipefail -l {0}
@@ -141,6 +181,7 @@ jobs:
141
181
if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
142
182
nvm install --alias=npm 0.10
143
183
nvm use ${{ matrix.node-version }}
184
+ sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
144
185
if [[ "$(npm -v)" == 1.1.* ]]; then
145
186
nvm exec npm npm install -g [email protected]
146
187
ln -fs "$(which npm)" "$(dirname "$(nvm which npm)")/npm"
@@ -176,8 +217,8 @@ jobs:
176
217
shell : bash
177
218
run : |
178
219
# eslint for linting
179
- # - remove on Node.js < 12
180
- if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; then
220
+ # - remove on Node.js < 10
221
+ if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
181
222
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
182
223
grep -E '^eslint(-|$)' | \
183
224
sort -r | \
@@ -194,60 +235,50 @@ jobs:
194
235
echo "node@$(node -v)"
195
236
echo "npm@$(npm -v)"
196
237
npm -s ls ||:
197
- (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "= " $3 }' >> "$GITHUB_OUTPUT"
238
+ (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 ":: " $3 }'
198
239
199
240
- name : Run tests
200
241
shell : bash
201
242
run : |
202
243
if npm -ps ls nyc | grep -q nyc; then
203
244
npm run test-ci
204
- cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov"
205
245
else
206
246
npm test
207
247
fi
208
248
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
249
- name : Upload code coverage
223
- uses : actions/upload-artifact@v3
224
250
if : steps.list_env.outputs.nyc != ''
251
+ uses : actions/upload-artifact@v4
225
252
with :
226
- name : coverage
227
- path : ./coverage
253
+ name : coverage-node-${{ matrix.node-version }}
254
+ path : ./coverage/lcov.info
228
255
retention-days : 1
229
256
230
257
coverage :
231
258
needs : test
232
259
runs-on : ubuntu-latest
260
+ permissions :
261
+ contents : read
262
+ checks : write
233
263
steps :
234
- - uses : actions/checkout@v3
264
+ - uses : actions/checkout@v4
235
265
236
266
- name : Install lcov
237
267
shell : bash
238
268
run : sudo apt-get -y install lcov
239
269
240
270
- name : Collect coverage reports
241
- uses : actions/download-artifact@v3
271
+ uses : actions/download-artifact@v4
242
272
with :
243
- name : coverage
244
273
path : ./coverage
274
+ pattern : coverage-node-*
245
275
246
276
- name : Merge coverage reports
247
277
shell : bash
248
- run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/ lcov.info
278
+ run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
249
279
250
280
- name : Upload coverage report
251
- uses : coverallsapp/github-action@master
281
+ uses : coverallsapp/github-action@v2
252
282
with :
253
283
github-token : ${{ secrets.GITHUB_TOKEN }}
284
+ file : ./lcov.info
0 commit comments