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-latest
10
41
strategy :
42
+ fail-fast : false
11
43
matrix :
12
44
name :
13
45
- Node.js 0.8
34
66
- Node.js 16.x
35
67
- Node.js 17.x
36
68
- Node.js 18.x
69
+ - Node.js 19.x
70
+ - Node.js 20.x
71
+ - Node.js 21.x
72
+ - Node.js 22.x
73
+ - Node.js 23.x
37
74
38
75
include :
39
76
- name : Node.js 0.8
@@ -62,27 +99,27 @@ jobs:
62
99
63
100
64
101
- name : Node.js 4.x
65
- node-version : " 4.9 "
102
+ node-version : " 4"
66
103
67
104
68
105
- name : Node.js 5.x
69
- node-version : " 5.12 "
106
+ node-version : " 5"
70
107
71
108
72
109
- name : Node.js 6.x
73
- node-version : " 6.17 "
74
-
110
+ node-version : " 6"
111
+
75
112
76
113
- name : Node.js 7.x
77
- node-version : " 7.10 "
78
-
114
+ node-version : " 7"
115
+
79
116
80
117
- name : Node.js 8.0
81
118
node-version : " 8.0"
82
119
83
120
84
121
- name : Node.js 8.x
85
- node-version : " 8.17 "
122
+ node-version : " 8"
86
123
87
124
88
125
# test fail on Node.js 9.x for unknown reasons
@@ -91,38 +128,51 @@ jobs:
91
128
# node-version: "9.11"
92
129
93
130
- name : Node.js 10.x
94
- node-version : " 10.24 "
131
+ node-version : " 10"
95
132
96
133
97
134
- name : Node.js 11.x
98
- node-version : " 11.15 "
99
- npm-i : mocha@9.2.2
135
+ node-version : " 11"
136
+ npm-i : mocha@8.4.0
100
137
101
138
- name : Node.js 12.x
102
- node-version : " 12.22"
103
-
139
+ node-version : " 12"
104
140
105
141
- name : Node.js 13.x
106
- node-version : " 13.14 "
142
+ node-version : " 13"
107
143
108
144
- name : Node.js 14.x
109
- node-version : " 14.19 "
145
+ node-version : " 14"
110
146
111
147
- name : Node.js 15.x
112
- node-version : " 15.14 "
148
+ node-version : " 15"
113
149
114
150
- name : Node.js 16.x
115
- node-version : " 16.15 "
151
+ node-version : " 16"
116
152
117
153
- name : Node.js 17.x
118
- node-version : " 17.9 "
154
+ node-version : " 17"
119
155
120
156
- name : Node.js 18.x
121
- node-version : " 18.1 "
157
+ node-version : " 18"
122
158
123
- steps :
124
- - uses : actions/checkout@v2
159
+ - name : Node.js 19.x
160
+ node-version : " 19"
161
+
162
+ - name : Node.js 20.x
163
+ node-version : " 20"
164
+
165
+ - name : Node.js 21.x
166
+ node-version : " 21"
167
+
168
+ - name : Node.js 22.x
169
+ node-version : " 22"
125
170
171
+ - name : Node.js 23.x
172
+ node-version : " 23"
173
+
174
+ steps :
175
+ - uses : actions/checkout@v4
126
176
- name : Install Node.js ${{ matrix.node-version }}
127
177
shell : bash -eo pipefail -l {0}
128
178
run : |
@@ -136,7 +186,12 @@ jobs:
136
186
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
137
187
138
188
- name : Configure npm
139
- run : npm config set shrinkwrap false
189
+ run : |
190
+ if [[ "$(npm config get package-lock)" == "true" ]]; then
191
+ npm config set package-lock false
192
+ else
193
+ npm config set shrinkwrap false
194
+ fi
140
195
141
196
- name : Remove npm module(s) ${{ matrix.npm-rm }}
142
197
run : npm rm --silent --save-dev ${{ matrix.npm-rm }}
@@ -150,8 +205,8 @@ jobs:
150
205
shell : bash
151
206
run : |
152
207
# eslint for linting
153
- # - remove on Node.js < 12
154
- if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; then
208
+ # - remove on Node.js < 10
209
+ if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
155
210
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
156
211
grep -E '^eslint(-|$)' | \
157
212
sort -r | \
@@ -175,53 +230,43 @@ jobs:
175
230
run : |
176
231
if npm -ps ls nyc | grep -q nyc; then
177
232
npm run test-ci
178
- cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov"
179
233
else
180
234
npm test
181
235
fi
182
236
183
- - name : Lint code
184
- if : steps.list_env.outputs.eslint != ''
185
- run : npm run lint
186
-
187
- - name : Collect code coverage
188
- if : steps.list_env.outputs.nyc != ''
189
- run : |
190
- if [[ -d ./coverage ]]; then
191
- mv ./coverage "./${{ matrix.name }}"
192
- mkdir ./coverage
193
- mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}"
194
- fi
195
-
196
237
- name : Upload code coverage
197
- uses : actions/upload-artifact@v2
198
238
if : steps.list_env.outputs.nyc != ''
239
+ uses : actions/upload-artifact@v4
199
240
with :
200
- name : coverage
201
- path : ./coverage
241
+ name : coverage-node-${{ matrix.node-version }}
242
+ path : ./coverage/lcov.info
202
243
retention-days : 1
203
244
204
245
coverage :
205
246
needs : test
206
247
runs-on : ubuntu-latest
248
+ permissions :
249
+ contents : read
250
+ checks : write
207
251
steps :
208
- - uses : actions/checkout@v2
252
+ - uses : actions/checkout@v4
209
253
210
254
- name : Install lcov
211
255
shell : bash
212
256
run : sudo apt-get -y install lcov
213
257
214
258
- name : Collect coverage reports
215
- uses : actions/download-artifact@v2
259
+ uses : actions/download-artifact@v4
216
260
with :
217
- name : coverage
218
261
path : ./coverage
262
+ pattern : coverage-node-*
219
263
220
264
- name : Merge coverage reports
221
265
shell : bash
222
- run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/ lcov.info
266
+ run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
223
267
224
268
- name : Upload coverage report
225
- uses : coverallsapp/github-action@master
269
+ uses : coverallsapp/github-action@v2
226
270
with :
227
271
github-token : ${{ secrets.GITHUB_TOKEN }}
272
+ file : ./lcov.info
0 commit comments