11name : ci
22
33on :
4- - pull_request
5- - push
4+ push :
5+ branches :
6+ - v2
7+ paths-ignore :
8+ - ' *.md'
9+ pull_request :
10+ branches :
11+ - v2
12+ paths-ignore :
13+ - ' *.md'
14+
15+ permissions :
16+ contents : read
17+
18+ # Cancel in progress workflows
19+ # in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run
20+ concurrency :
21+ group : " ${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
22+ cancel-in-progress : true
623
724jobs :
8- test :
25+ lint :
26+ name : Lint
927 runs-on : ubuntu-latest
10- strategy :
11- matrix :
12- 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
30- - Node.js 15.x
31- - Node.js 16.x
32- - Node.js 17.x
33- - Node.js 18.x
34- - Node.js 19.x
35- - Node.js 20.x
36- - Node.js 21.x
37- - Node.js 22.x
38- - Node.js 23.x
39-
40- include :
41- - name : Node.js 0.8
42- node-version : " 0.8"
43- npm-i : mocha@2.5.3 supertest@1.1.0
44- npm-rm : nyc
45-
46- - name : Node.js 0.10
47- node-version : " 0.10"
48- npm-i : mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
49-
50- - name : Node.js 0.12
51- node-version : " 0.12"
52- npm-i : mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
53-
54- - name : io.js 1.x
55- node-version : " 1.8"
56- npm-i : mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
57-
58- - name : io.js 2.x
59- node-version : " 2.5"
60- npm-i : mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
61-
62- - name : io.js 3.x
63- node-version : " 3.3"
64- npm-i : mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
65-
66- - name : Node.js 4.x
67- node-version : " 4"
68- npm-i : mocha@5.2.0 nyc@11.9.0 supertest@3.4.2
69-
70- - name : Node.js 5.x
71- node-version : " 5"
72- npm-i : mocha@5.2.0 nyc@11.9.0 supertest@3.4.2
73-
74- - name : Node.js 6.x
75- node-version : " 6"
76- npm-i : mocha@6.2.3 nyc@14.1.1 supertest@6.1.6
77-
78- - name : Node.js 7.x
79- node-version : " 7"
80- npm-i : mocha@6.2.3 nyc@14.1.1 supertest@6.1.6
81-
82- - name : Node.js 8.x
83- node-version : " 8"
84- npm-i : mocha@7.2.0 nyc@14.1.1
85-
86- - name : Node.js 9.x
87- node-version : " 9"
88- npm-i : mocha@7.2.0 nyc@14.1.1
89-
90- - name : Node.js 10.x
91- node-version : " 10"
92- npm-i : mocha@8.4.0
93-
94- - name : Node.js 11.x
95- node-version : " 11"
96- npm-i : mocha@8.4.0
97-
98- - name : Node.js 12.x
99- node-version : " 12"
100-
101- - name : Node.js 13.x
102- node-version : " 13"
103-
104- - name : Node.js 14.x
105- node-version : " 14"
106-
107- - name : Node.js 15.x
108- node-version : " 15"
109-
110- - name : Node.js 16.x
111- node-version : " 16"
112-
113- - name : Node.js 17.x
114- node-version : " 17"
115-
116- - name : Node.js 18.x
117- node-version : " 18"
118-
119- - name : Node.js 19.x
120- node-version : " 19"
121-
122- - name : Node.js 20.x
123- node-version : " 20"
28+ steps :
29+ - uses : actions/checkout@v4
30+ - name : Setup Node.js
31+ uses : actions/setup-node@v4
32+ with :
33+ node-version : ' lts/*'
12434
125- - name : Node.js 21.x
126- node-version : " 21 "
35+ - name : Install dependencies
36+ run : npm install --ignore-scripts --include=dev
12737
128- - name : Node.js 22.x
129- node-version : " 22"
38+ - name : Run lint
39+ run : npm run lint
40+
41+ test :
42+ strategy :
43+ fail-fast : false
44+ matrix :
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/
13048
131- - name : Node.js 23.x
132- node-version : " 23"
49+ name : Node.js ${{ matrix.node-version }} - ${{matrix.os}}
13350
51+ runs-on : ${{ matrix.os }}
13452 steps :
135- - uses : actions/checkout@v4
136-
137- - name : Install Node.js ${{ matrix.node-version }}
138- shell : bash -eo pipefail -l {0}
139- run : |
140- nvm install --default ${{ matrix.node-version }}
141- if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
142- nvm install --alias=npm 0.10
143- nvm use ${{ matrix.node-version }}
144- sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
145- npm config set strict-ssl false
146- fi
147- dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
148-
149- - name : Configure npm
150- run : |
151- if [[ "$(npm config get package-lock)" == "true" ]]; then
152- npm config set package-lock false
153- else
154- npm config set shrinkwrap false
155- fi
156-
157- - name : Remove npm module(s) ${{ matrix.npm-rm }}
158- run : npm rm --silent --save-dev ${{ matrix.npm-rm }}
159- if : matrix.npm-rm != ''
160-
161- - name : Install npm module(s) ${{ matrix.npm-i }}
162- run : npm install --save-dev ${{ matrix.npm-i }}
163- if : matrix.npm-i != ''
164-
165- - name : Setup Node.js version-specific dependencies
166- shell : bash
167- run : |
168- # eslint for linting
169- # - remove on Node.js < 10
170- if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
171- node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
172- grep -E '^eslint(-|$)' | \
173- sort -r | \
174- xargs -n1 npm rm --silent --save-dev
175- fi
176-
177- - name : Install Node.js dependencies
178- run : npm install
179-
180- - name : List environment
181- id : list_env
182- shell : bash
183- run : |
184- echo "node@$(node -v)"
185- echo "npm@$(npm -v)"
186- npm -s ls ||:
187- (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }'
188-
189- - name : Run tests
190- shell : bash
191- run : |
192- if npm -ps ls nyc | grep -q nyc; then
193- npm run test-ci
194- else
195- npm test
196- fi
197-
198- - name : Lint code
199- if : steps.list_env.outputs.eslint != ''
200- run : npm run lint
201-
202- - name : Collect code coverage
203- uses : coverallsapp/github-action@master
204- if : steps.list_env.outputs.nyc != ''
205- with :
206- github-token : ${{ secrets.GITHUB_TOKEN }}
207- flag-name : run-${{ matrix.test_number }}
208- parallel : true
53+ - uses : actions/checkout@v4
54+ with :
55+ persist-credentials : false
56+
57+ - name : Setup Node.js ${{ matrix.node-version }}
58+ uses : actions/setup-node@v4
59+ with :
60+ node-version : ${{ matrix.node-version }}
61+
62+ - name : Configure npm loglevel
63+ run : |
64+ npm config set loglevel error
65+ shell : bash
66+
67+ - name : Install dependencies
68+ run : npm install
69+
70+ - name : Output Node and NPM versions
71+ run : |
72+ echo "Node.js version: $(node -v)"
73+ echo "NPM version: $(npm -v)"
74+
75+ - name : Run tests
76+ shell : bash
77+ run : npm run test-ci
78+
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
20985
21086 coverage :
21187 needs : test
21288 runs-on : ubuntu-latest
89+ permissions :
90+ contents : read
91+ checks : write
21392 steps :
214- - name : Upload code coverage
215- uses : coverallsapp/github-action@master
216- with :
217- github-token : ${{ secrets.github_token }}
218- parallel-finished : true
93+ - uses : actions/checkout@v4
94+
95+ - name : Install lcov
96+ shell : bash
97+ run : sudo apt-get -y install lcov
98+
99+ - name : Collect coverage reports
100+ uses : actions/download-artifact@v4
101+ with :
102+ path : ./coverage
103+ pattern : coverage-node-*
104+
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
108+
109+ - name : Upload coverage report
110+ uses : coverallsapp/github-action@v2
111+ with :
112+ file : ./lcov.info
0 commit comments