Skip to content

Commit 7c185b3

Browse files
committed
improve ci workflow
1 parent 544279a commit 7c185b3

File tree

4 files changed

+72
-119
lines changed

4 files changed

+72
-119
lines changed

.github/workflows/ci.yml

Lines changed: 71 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,43 @@
11
name: ci
22

33
on:
4-
- pull_request
5-
- push
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- '*.md'
9+
pull_request:
10+
paths-ignore:
11+
- '*.md'
12+
13+
# Cancel in progress workflows
14+
# in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run
15+
concurrency:
16+
group: "${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
17+
cancel-in-progress: true
618

719
jobs:
20+
lint:
21+
name: Lint
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 'lts/*'
29+
30+
- name: Install dependencies
31+
run: npm install --ignore-scripts --only=dev
32+
33+
- name: Run lint
34+
run: npm run lint
35+
836
test:
9-
runs-on: ubuntu-20.04
1037
strategy:
38+
fail-fast: false
1139
matrix:
40+
os: [ubuntu-latest, windows-latest]
1241
name:
1342
- Node.js 0.8
1443
- Node.js 0.10
@@ -35,6 +64,7 @@ jobs:
3564
- Node.js 20.x
3665
- Node.js 21.x
3766
- Node.js 22.x
67+
- Node.js 23.x
3868

3969
include:
4070
- name: Node.js 0.8
@@ -107,32 +137,35 @@ jobs:
107137
npm-i: supertest@6.1.3
108138

109139
- name: Node.js 15.x
110-
node-version: "15.14"
140+
node-version: "15"
111141
npm-i: supertest@6.1.3
112142

113143
- name: Node.js 16.x
114-
node-version: "16.20"
144+
node-version: "16"
115145
npm-i: supertest@6.1.3
116146

117147
- name: Node.js 17.x
118-
node-version: "17.9"
148+
node-version: "17"
119149
npm-i: supertest@6.1.3
120150

121151
- name: Node.js 18.x
122-
node-version: "18.18"
152+
node-version: "18"
123153

124154
- name: Node.js 19.x
125-
node-version: "19.9"
155+
node-version: "19"
126156

127157
- name: Node.js 20.x
128-
node-version: "20.9"
158+
node-version: "20"
129159

130160
- name: Node.js 21.x
131-
node-version: "21.1"
161+
node-version: "21"
132162

133163
- name: Node.js 22.x
134-
node-version: "22.0"
164+
node-version: "22"
135165

166+
- name: Node.js 23.x
167+
node-version: "23"
168+
runs-on: ${{ matrix.os }}
136169
steps:
137170
- uses: actions/checkout@v4
138171

@@ -202,24 +235,39 @@ jobs:
202235
npm test
203236
fi
204237
205-
- name: Lint code
206-
if: steps.list_env.outputs.eslint != ''
207-
run: npm run lint
208-
209-
- name: Collect code coverage
210-
uses: coverallsapp/github-action@master
238+
- name: Upload code coverage
211239
if: steps.list_env.outputs.nyc != ''
240+
uses: actions/upload-artifact@v4
212241
with:
213-
github-token: ${{ secrets.GITHUB_TOKEN }}
214-
flag-name: run-${{ matrix.test_number }}
215-
parallel: true
242+
name: coverage-node-${{ matrix.node-version }}
243+
path: ./coverage/lcov.info
244+
retention-days: 1
216245

217246
coverage:
218247
needs: test
219248
runs-on: ubuntu-latest
249+
permissions:
250+
contents: read
251+
checks: write
220252
steps:
221-
- name: Upload code coverage
222-
uses: coverallsapp/github-action@master
253+
- uses: actions/checkout@v4
254+
255+
- name: Install lcov
256+
shell: bash
257+
run: sudo apt-get -y install lcov
258+
259+
- name: Collect coverage reports
260+
uses: actions/download-artifact@v4
261+
with:
262+
path: ./coverage
263+
pattern: coverage-node-*
264+
265+
- name: Merge coverage reports
266+
shell: bash
267+
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
268+
269+
- name: Upload coverage report
270+
uses: coverallsapp/github-action@v2
223271
with:
224272
github-token: ${{ secrets.GITHUB_TOKEN }}
225-
parallel-finished: true
273+
file: ./lcov.info

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![NPM Version][npm-image]][npm-url]
44
[![NPM Downloads][downloads-image]][downloads-url]
55
[![Linux Build Status][ci-image]][ci-url]
6-
[![Windows Build][appveyor-image]][appveyor-url]
76
[![Coverage Status][coveralls-image]][coveralls-url]
87

98
Serves pages that contain directory listings for a given path.
@@ -139,8 +138,6 @@ app.listen(3000)
139138
[MIT](LICENSE). The [Silk](http://www.famfamfam.com/lab/icons/silk/) icons
140139
are created by/copyright of [FAMFAMFAM](http://www.famfamfam.com/).
141140

142-
[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/serve-index/master.svg?label=windows
143-
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-index
144141
[ci-image]: https://badgen.net/github/checks/expressjs/serve-index/master?label=ci
145142
[ci-url]: https://github.com/expressjs/serve-index/actions/workflows/ci.yml
146143
[coveralls-image]: https://img.shields.io/coveralls/expressjs/serve-index/master.svg

appveyor.yml

Lines changed: 0 additions & 92 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"scripts": {
3535
"lint": "eslint .",
36-
"test": "mocha --reporter spec --bail --check-leaks test/",
36+
"test": "mocha --reporter spec --check-leaks test/",
3737
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
3838
"test-cov": "nyc --reporter=html --reporter=text npm test"
3939
}

0 commit comments

Comments
 (0)