Skip to content

Commit

Permalink
improve ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bjohansebas committed Feb 1, 2025
1 parent 544279a commit 7c185b3
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 119 deletions.
94 changes: 71 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,43 @@
name: ci

on:
- pull_request
- push
push:
branches:
- master
paths-ignore:
- '*.md'
pull_request:
paths-ignore:
- '*.md'

# Cancel in progress workflows
# in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run
concurrency:
group: "${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- name: Install dependencies
run: npm install --ignore-scripts --only=dev

- name: Run lint
run: npm run lint

test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
name:
- Node.js 0.8
- Node.js 0.10
Expand All @@ -35,6 +64,7 @@ jobs:
- Node.js 20.x
- Node.js 21.x
- Node.js 22.x
- Node.js 23.x

include:
- name: Node.js 0.8
Expand Down Expand Up @@ -107,32 +137,35 @@ jobs:
npm-i: [email protected]

- name: Node.js 15.x
node-version: "15.14"
node-version: "15"
npm-i: [email protected]

- name: Node.js 16.x
node-version: "16.20"
node-version: "16"
npm-i: [email protected]

- name: Node.js 17.x
node-version: "17.9"
node-version: "17"
npm-i: [email protected]

- name: Node.js 18.x
node-version: "18.18"
node-version: "18"

- name: Node.js 19.x
node-version: "19.9"
node-version: "19"

- name: Node.js 20.x
node-version: "20.9"
node-version: "20"

- name: Node.js 21.x
node-version: "21.1"
node-version: "21"

- name: Node.js 22.x
node-version: "22.0"
node-version: "22"

- name: Node.js 23.x
node-version: "23"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -202,24 +235,39 @@ jobs:
npm test
fi
- name: Lint code
if: steps.list_env.outputs.eslint != ''
run: npm run lint

- name: Collect code coverage
uses: coverallsapp/github-action@master
- name: Upload code coverage
if: steps.list_env.outputs.nyc != ''
uses: actions/upload-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.test_number }}
parallel: true
name: coverage-node-${{ matrix.node-version }}
path: ./coverage/lcov.info
retention-days: 1

coverage:
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Upload code coverage
uses: coverallsapp/github-action@master
- uses: actions/checkout@v4

- name: Install lcov
shell: bash
run: sudo apt-get -y install lcov

- name: Collect coverage reports
uses: actions/download-artifact@v4
with:
path: ./coverage
pattern: coverage-node-*

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

- name: Upload coverage report
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
file: ./lcov.info
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Linux Build Status][ci-image]][ci-url]
[![Windows Build][appveyor-image]][appveyor-url]
[![Coverage Status][coveralls-image]][coveralls-url]

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

[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/serve-index/master.svg?label=windows
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-index
[ci-image]: https://badgen.net/github/checks/expressjs/serve-index/master?label=ci
[ci-url]: https://github.com/expressjs/serve-index/actions/workflows/ci.yml
[coveralls-image]: https://img.shields.io/coveralls/expressjs/serve-index/master.svg
Expand Down
92 changes: 0 additions & 92 deletions appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"scripts": {
"lint": "eslint .",
"test": "mocha --reporter spec --bail --check-leaks test/",
"test": "mocha --reporter spec --check-leaks test/",
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
"test-cov": "nyc --reporter=html --reporter=text npm test"
}
Expand Down

0 comments on commit 7c185b3

Please sign in to comment.