1
1
name : ci
2
2
3
3
on :
4
- pull_request :
4
+ push :
5
5
branches :
6
- - master
6
+ - v2
7
7
paths-ignore :
8
8
- ' *.md'
9
- push :
9
+ pull_request :
10
+ branches :
11
+ - v2
10
12
paths-ignore :
11
13
- ' *.md'
12
14
@@ -31,209 +33,55 @@ jobs:
31
33
node-version : ' lts/*'
32
34
33
35
- name : Install dependencies
34
- run : npm install --ignore-scripts --only =dev
36
+ run : npm install --ignore-scripts --include =dev
35
37
36
38
- name : Run lint
37
39
run : npm run lint
38
40
39
41
test :
40
- runs-on : ubuntu-latest
41
42
strategy :
42
43
fail-fast : false
43
44
matrix :
44
- name :
45
- - Node.js 0.8
46
- - Node.js 0.10
47
- - Node.js 0.12
48
- - io.js 1.x
49
- - io.js 2.x
50
- - io.js 3.x
51
- - Node.js 4.x
52
- - Node.js 5.x
53
- - Node.js 6.x
54
- - Node.js 7.x
55
- - Node.js 8.x
56
- - Node.js 9.x
57
- - Node.js 10.x
58
- - Node.js 11.x
59
- - Node.js 12.x
60
- - Node.js 13.x
61
- - Node.js 14.x
62
- - Node.js 15.x
63
- - Node.js 16.x
64
- - Node.js 17.x
65
- - Node.js 18.x
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
71
-
72
- include :
73
- - name : Node.js 0.8
74
- node-version : " 0.8"
75
-
76
- npm-rm : nyc
77
-
78
- - name : Node.js 0.10
79
- node-version : " 0.10"
80
-
81
-
82
- - name : Node.js 0.12
83
- node-version : " 0.12"
84
-
85
-
86
- - name : io.js 1.x
87
- node-version : " 1.8"
88
-
89
-
90
- - name : io.js 2.x
91
- node-version : " 2.5"
92
-
93
-
94
- - name : io.js 3.x
95
- node-version : " 3.3"
96
-
97
-
98
- - name : Node.js 4.x
99
- node-version : " 4"
100
-
101
-
102
- - name : Node.js 5.x
103
- node-version : " 5"
104
-
105
-
106
- - name : Node.js 6.x
107
- node-version : " 6"
108
-
109
-
110
- - name : Node.js 7.x
111
- node-version : " 7"
112
-
113
-
114
- - name : Node.js 8.x
115
- node-version : " 8"
116
-
117
-
118
- - name : Node.js 9.x
119
- node-version : " 9"
120
-
121
-
122
- - name : Node.js 10.x
123
- node-version : " 10"
124
-
125
-
126
- - name : Node.js 11.x
127
- node-version : " 11"
128
-
129
-
130
- - name : Node.js 12.x
131
- node-version : " 12"
132
-
133
- - name : Node.js 13.x
134
- node-version : " 13"
45
+ os : [ubuntu-latest, windows-latest]
46
+ node-version : [18, 19, 20, 21, 22, 23]
47
+ # Node.js release schedule: https://nodejs.org/en/about/releases/
135
48
136
- - name : Node.js 14.x
137
- node-version : " 14"
138
-
139
- - name : Node.js 15.x
140
- node-version : " 15"
141
-
142
- - name : Node.js 16.x
143
- node-version : " 16"
144
-
145
- - name : Node.js 17.x
146
- node-version : " 17"
147
-
148
- - name : Node.js 18.x
149
- node-version : " 18"
150
-
151
- - name : Node.js 19.x
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"
49
+ name : Node.js ${{ matrix.node-version }} - ${{matrix.os}}
165
50
51
+ runs-on : ${{ matrix.os }}
166
52
steps :
167
- - uses : actions/checkout@v4
168
-
169
- - name : Install Node.js ${{ matrix.node-version }}
170
- shell : bash -eo pipefail -l {0}
171
- run : |
172
- nvm install --default ${{ matrix.node-version }}
173
- if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
174
- nvm install --alias=npm 0.10
175
- nvm use ${{ matrix.node-version }}
176
- sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
177
- npm config set strict-ssl false
178
- fi
179
- dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
180
-
181
- - name : Configure npm
182
- run : |
183
- if [[ "$(npm config get package-lock)" == "true" ]]; then
184
- npm config set package-lock false
185
- else
186
- npm config set shrinkwrap false
187
- fi
188
-
189
- - name : Remove npm module(s) ${{ matrix.npm-rm }}
190
- run : npm rm --silent --save-dev ${{ matrix.npm-rm }}
191
- if : matrix.npm-rm != ''
53
+ - uses : actions/checkout@v4
54
+ with :
55
+ persist-credentials : false
192
56
193
- - name : Install npm module(s) ${{ matrix.npm-i }}
194
- run : npm install --save-dev ${{ matrix.npm-i }}
195
- if : matrix.npm-i != ''
57
+ - name : Setup Node.js ${{ matrix.node-version }}
58
+ uses : actions/setup-node@v4
59
+ with :
60
+ node-version : ${{ matrix.node-version }}
196
61
197
- - name : Setup Node.js version-specific dependencies
198
- shell : bash
199
- run : |
200
- # eslint for linting
201
- # - remove on Node.js < 10
202
- if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
203
- node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
204
- grep -E '^eslint(-|$)' | \
205
- sort -r | \
206
- xargs -n1 npm rm --silent --save-dev
207
- fi
62
+ - name : Configure npm loglevel
63
+ run : |
64
+ npm config set loglevel error
65
+ shell : bash
208
66
209
- - name : Install Node.js dependencies
210
- run : npm install
67
+ - name : Install dependencies
68
+ run : npm install
211
69
212
- - name : List environment
213
- id : list_env
214
- shell : bash
215
- run : |
216
- echo "node@$(node -v)"
217
- echo "npm@$(npm -v)"
218
- npm -s ls ||:
219
- (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }'
70
+ - name : Output Node and NPM versions
71
+ run : |
72
+ echo "Node.js version: $(node -v)"
73
+ echo "NPM version: $(npm -v)"
220
74
221
- - name : Run tests
222
- shell : bash
223
- run : |
224
- if npm -ps ls nyc | grep -q nyc; then
225
- npm run test-ci
226
- else
227
- npm test
228
- fi
75
+ - name : Run tests
76
+ shell : bash
77
+ run : npm run test-ci
229
78
230
- - name : Upload code coverage
231
- if : steps.list_env.outputs.nyc != ''
232
- uses : actions/upload-artifact@v4
233
- with :
234
- name : coverage-node-${{ matrix.node-version }}
235
- path : ./coverage/lcov.info
236
- retention-days : 1
79
+ - name : Upload code coverage
80
+ uses : actions/upload-artifact@v4
81
+ with :
82
+ name : coverage-node-${{ matrix.node-version }}-${{ matrix.os }}
83
+ path : ./coverage/lcov.info
84
+ retention-days : 1
237
85
238
86
coverage :
239
87
needs : test
@@ -242,24 +90,23 @@ jobs:
242
90
contents : read
243
91
checks : write
244
92
steps :
245
- - uses : actions/checkout@v4
93
+ - uses : actions/checkout@v4
246
94
247
- - name : Install lcov
248
- shell : bash
249
- run : sudo apt-get -y install lcov
95
+ - name : Install lcov
96
+ shell : bash
97
+ run : sudo apt-get -y install lcov
250
98
251
- - name : Collect coverage reports
252
- uses : actions/download-artifact@v4
253
- with :
254
- path : ./coverage
255
- pattern : coverage-node-*
99
+ - name : Collect coverage reports
100
+ uses : actions/download-artifact@v4
101
+ with :
102
+ path : ./coverage
103
+ pattern : coverage-node-*
256
104
257
- - name : Merge coverage reports
258
- shell : bash
259
- run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
105
+ - name : Merge coverage reports
106
+ shell : bash
107
+ run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
260
108
261
- - name : Upload coverage report
262
- uses : coverallsapp/github-action@v2
263
- with :
264
- github-token : ${{ secrets.GITHUB_TOKEN }}
265
- file : ./lcov.info
109
+ - name : Upload coverage report
110
+ uses : coverallsapp/github-action@v2
111
+ with :
112
+ file : ./lcov.info
0 commit comments