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