1
1
name : ci
2
2
3
3
on :
4
- - pull_request
5
- - push
4
+ push :
5
+ branches :
6
+ - master
7
+ - ' 2.x'
8
+ paths-ignore :
9
+ - ' *.md'
10
+ pull_request :
11
+ paths-ignore :
12
+ - ' *.md'
6
13
7
14
jobs :
8
15
test :
9
16
runs-on : ubuntu-latest
10
17
strategy :
11
18
matrix :
12
19
name :
13
- - Node.js 0.8
14
- - Node.js 0.10
15
- - Node.js 0.12
16
- - io.js 1.x
17
- - io.js 2.x
18
- - io.js 3.x
19
- - Node.js 4.x
20
- - Node.js 5.x
21
- - Node.js 6.x
22
- - Node.js 7.x
23
- - Node.js 8.x
24
- - Node.js 9.x
25
- - Node.js 10.x
26
- - Node.js 11.x
27
- - Node.js 12.x
28
- - Node.js 13.x
29
- - Node.js 14.x
20
+ - Node.js 18.x
21
+ - Node.js 20.x
22
+ - Node.js 22.x
30
23
31
24
include :
32
- - name : Node.js 0.8
33
- node-version : " 0.8"
34
-
35
- npm-rm : nyc
25
+ - name : Node.js 18.x
26
+ node-version : " 18"
36
27
37
- - name : Node.js 0.10
38
- node-version : " 0.10"
39
-
28
+ - name : Node.js 20.x
29
+ node-version : " 20"
40
30
41
- - name : Node.js 0.12
42
- node-version : " 0.12"
43
-
44
-
45
- - name : io.js 1.x
46
- node-version : " 1.8"
47
-
48
-
49
- - name : io.js 2.x
50
- node-version : " 2.5"
51
-
52
-
53
- - name : io.js 3.x
54
- node-version : " 3.3"
55
-
56
-
57
- - name : Node.js 4.x
58
- node-version : " 4.9"
59
-
60
-
61
- - name : Node.js 5.x
62
- node-version : " 5.12"
63
-
64
-
65
- - name : Node.js 6.x
66
- node-version : " 6.17"
67
-
68
-
69
- - name : Node.js 7.x
70
- node-version : " 7.10"
71
-
72
-
73
- - name : Node.js 8.x
74
- node-version : " 8.17"
75
-
76
-
77
- - name : Node.js 9.x
78
- node-version : " 9.11"
79
-
80
-
81
- - name : Node.js 10.x
82
- node-version : " 10.24"
83
-
84
-
85
- - name : Node.js 11.x
86
- node-version : " 11.15"
87
-
88
-
89
- - name : Node.js 12.x
90
- node-version : " 12.22"
91
-
92
- - name : Node.js 13.x
93
- node-version : " 13.14"
94
-
95
- - name : Node.js 14.x
96
- node-version : " 14.18"
97
-
98
- - name : Node.js 15.x
99
- node-version : " 15.14"
100
-
101
- - name : Node.js 16.x
102
- node-version : " 16.13"
103
-
104
- - name : Node.js 17.x
105
- node-version : " 17.1"
31
+ - name : Node.js 22.x
32
+ node-version : " 22"
106
33
107
34
steps :
108
- - uses : actions/checkout@v2
35
+ - uses : actions/checkout@v4
109
36
110
37
- name : Install Node.js ${{ matrix.node-version }}
111
38
shell : bash -eo pipefail -l {0}
112
39
run : |
113
40
nvm install --default ${{ matrix.node-version }}
114
- if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
115
- nvm install --alias=npm 0.10
116
- nvm use ${{ matrix.node-version }}
117
- sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
118
- npm config set strict-ssl false
119
- fi
120
41
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
121
42
122
43
- name : Configure npm
123
- run : npm config set shrinkwrap false
124
-
125
- - name : Remove npm module(s) ${{ matrix.npm-rm }}
126
- run : npm rm --silent --save-dev ${{ matrix.npm-rm }}
127
- if : matrix.npm-rm != ''
128
-
129
- - name : Install npm module(s) ${{ matrix.npm-i }}
130
- run : npm install --save-dev ${{ matrix.npm-i }}
131
- if : matrix.npm-i != ''
132
-
133
- - name : Setup Node.js version-specific dependencies
134
- shell : bash
135
44
run : |
136
- # eslint for linting
137
- # - remove on Node.js < 10
138
- if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
139
- node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
140
- grep -E '^eslint(-|$)' | \
141
- sort -r | \
142
- xargs -n1 npm rm --silent --save-dev
45
+ if [[ "$(npm config get package-lock)" == "true" ]]; then
46
+ npm config set package-lock false
47
+ else
48
+ npm config set shrinkwrap false
143
49
fi
144
50
145
51
- name : Install Node.js dependencies
@@ -152,35 +58,54 @@ jobs:
152
58
echo "node@$(node -v)"
153
59
echo "npm@$(npm -v)"
154
60
npm -s ls ||:
155
- (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 ":: " $3 }'
61
+ (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "= " $3 }' >> "$GITHUB_OUTPUT"
156
62
157
63
- name : Run tests
158
64
shell : bash
159
65
run : |
160
- if npm -ps ls nyc | grep -q nyc; then
161
- npm run test-ci
162
- else
163
- npm test
164
- fi
66
+ npm run test-ci
67
+ cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov"
165
68
166
69
- name : Lint code
167
70
if : steps.list_env.outputs.eslint != ''
168
71
run : npm run lint
169
72
170
73
- name : Collect code coverage
171
- uses : coverallsapp/github-action@master
172
- if : steps.list_env.outputs.nyc != ''
74
+ run : |
75
+ if [[ -d ./coverage ]]; then
76
+ mv ./coverage "./${{ matrix.name }}"
77
+ mkdir ./coverage
78
+ mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}"
79
+ fi
80
+
81
+ - name : Upload code coverage
82
+ uses : actions/upload-artifact@v3
173
83
with :
174
- github-token : ${{ secrets.GITHUB_TOKEN }}
175
- flag-name : run-${{ matrix.test_number }}
176
- parallel : true
84
+ name : coverage
85
+ path : ./coverage
86
+ retention-days : 1
177
87
178
88
coverage :
179
89
needs : test
180
90
runs-on : ubuntu-latest
181
91
steps :
182
- - name : Uploade code coverage
92
+ - uses : actions/checkout@v4
93
+
94
+ - name : Install lcov
95
+ shell : bash
96
+ run : sudo apt-get -y install lcov
97
+
98
+ - name : Collect coverage reports
99
+ uses : actions/download-artifact@v3
100
+ with :
101
+ name : coverage
102
+ path : ./coverage
103
+
104
+ - name : Merge coverage reports
105
+ shell : bash
106
+ run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/lcov.info
107
+
108
+ - name : Upload coverage report
183
109
uses : coverallsapp/github-action@master
184
110
with :
185
- github-token : ${{ secrets.github_token }}
186
- parallel-finished : true
111
+ github-token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments