Skip to content

Commit e2a7918

Browse files
committed
update ci
1 parent ba984a1 commit e2a7918

File tree

2 files changed

+85
-49
lines changed

2 files changed

+85
-49
lines changed

.github/workflows/ci.yml

+84-48
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,45 @@
11
name: ci
22

33
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
621

722
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+
839
test:
940
runs-on: ubuntu-20.04
1041
strategy:
42+
fail-fast: false
1143
matrix:
1244
name:
1345
- Node.js 0.6
@@ -33,6 +65,10 @@ jobs:
3365
- Node.js 17.x
3466
- Node.js 18.x
3567
- Node.js 19.x
68+
- Node.js 20.x
69+
- Node.js 21.x
70+
- Node.js 22.x
71+
- Node.js 23.x
3672

3773
include:
3874
- name: Node.js 0.6
@@ -66,65 +102,75 @@ jobs:
66102
67103

68104
- name: Node.js 4.x
69-
node-version: "4.9"
105+
node-version: "4"
70106
71107

72108
- name: Node.js 5.x
73-
node-version: "5.12"
109+
node-version: "5"
74110
75111

76112
- name: Node.js 6.x
77-
node-version: "6.17"
78-
113+
node-version: "6"
114+
79115

80116
- name: Node.js 7.x
81-
node-version: "7.10"
82-
117+
node-version: "7"
118+
83119

84120
- name: Node.js 8.x
85-
node-version: "8.17"
121+
node-version: "8"
86122
87123

88124
- name: Node.js 9.x
89-
node-version: "9.11"
125+
node-version: "9"
90126
91127

92128
- name: Node.js 10.x
93-
node-version: "10.24"
129+
node-version: "10"
94130
95131

96132
- name: Node.js 11.x
97-
node-version: "11.15"
133+
node-version: "11"
98134
99135

100136
- name: Node.js 12.x
101-
node-version: "12.22"
102-
137+
node-version: "12"
103138

104139
- name: Node.js 13.x
105-
node-version: "13.14"
106-
140+
node-version: "13"
107141

108142
- name: Node.js 14.x
109-
node-version: "14.21"
143+
node-version: "14"
110144

111145
- name: Node.js 15.x
112-
node-version: "15.14"
146+
node-version: "15"
113147

114148
- name: Node.js 16.x
115-
node-version: "16.19"
149+
node-version: "16"
116150

117151
- name: Node.js 17.x
118-
node-version: "17.9"
152+
node-version: "17"
119153

120154
- name: Node.js 18.x
121-
node-version: "18.14"
155+
node-version: "18"
122156

123157
- name: Node.js 19.x
124-
node-version: "19.6"
158+
node-version: "19"
159+
160+
- name: Node.js 20.x
161+
node-version: "20"
162+
163+
- name: Node.js 21.x
164+
node-version: "21"
165+
166+
- name: Node.js 22.x
167+
node-version: "22"
168+
169+
- name: Node.js 23.x
170+
node-version: "23"
125171

126172
steps:
127-
- uses: actions/checkout@v3
173+
- uses: actions/checkout@v4
128174

129175
- name: Install Node.js ${{ matrix.node-version }}
130176
shell: bash -eo pipefail -l {0}
@@ -176,8 +222,8 @@ jobs:
176222
shell: bash
177223
run: |
178224
# eslint for linting
179-
# - remove on Node.js < 12
180-
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; then
225+
# - remove on Node.js < 10
226+
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
181227
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
182228
grep -E '^eslint(-|$)' | \
183229
sort -r | \
@@ -194,60 +240,50 @@ jobs:
194240
echo "node@$(node -v)"
195241
echo "npm@$(npm -v)"
196242
npm -s ls ||:
197-
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT"
243+
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }'
198244
199245
- name: Run tests
200246
shell: bash
201247
run: |
202248
if npm -ps ls nyc | grep -q nyc; then
203249
npm run test-ci
204-
cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov"
205250
else
206251
npm test
207252
fi
208253
209-
- name: Lint code
210-
if: steps.list_env.outputs.eslint != ''
211-
run: npm run lint
212-
213-
- name: Collect code coverage
214-
if: steps.list_env.outputs.nyc != ''
215-
run: |
216-
if [[ -d ./coverage ]]; then
217-
mv ./coverage "./${{ matrix.name }}"
218-
mkdir ./coverage
219-
mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}"
220-
fi
221-
222254
- name: Upload code coverage
223-
uses: actions/upload-artifact@v3
224255
if: steps.list_env.outputs.nyc != ''
256+
uses: actions/upload-artifact@v4
225257
with:
226-
name: coverage
227-
path: ./coverage
258+
name: coverage-node-${{ matrix.node-version }}
259+
path: ./coverage/lcov.info
228260
retention-days: 1
229261

230262
coverage:
231263
needs: test
232264
runs-on: ubuntu-latest
265+
permissions:
266+
contents: read
267+
checks: write
233268
steps:
234-
- uses: actions/checkout@v3
269+
- uses: actions/checkout@v4
235270

236271
- name: Install lcov
237272
shell: bash
238273
run: sudo apt-get -y install lcov
239274

240275
- name: Collect coverage reports
241-
uses: actions/download-artifact@v3
276+
uses: actions/download-artifact@v4
242277
with:
243-
name: coverage
244278
path: ./coverage
279+
pattern: coverage-node-*
245280

246281
- name: Merge coverage reports
247282
shell: bash
248-
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/lcov.info
283+
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
249284

250285
- name: Upload coverage report
251-
uses: coverallsapp/github-action@master
286+
uses: coverallsapp/github-action@v2
252287
with:
253288
github-token: ${{ secrets.GITHUB_TOKEN }}
289+
file: ./lcov.info

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"build": "node scripts/build",
4848
"fetch": "node scripts/fetch-apache && node scripts/fetch-iana && node scripts/fetch-nginx",
4949
"lint": "eslint .",
50-
"test": "mocha --reporter spec --bail --check-leaks test/",
50+
"test": "mocha --reporter spec --check-leaks test/",
5151
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
5252
"test-cov": "nyc --reporter=html --reporter=text npm test",
5353
"update": "npm run fetch && npm run build",

0 commit comments

Comments
 (0)