Skip to content

improve ci workflow #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 73 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,47 @@
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
- Node.js 0.12
- io.js 1.x
- io.js 2.x
- io.js 3.x
- Node.js 4.x
- Node.js 5.x
- Node.js 6.x
Expand All @@ -35,6 +61,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 All @@ -45,22 +72,12 @@ jobs:
- name: Node.js 0.10
node-version: "0.10"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.1
npm-version: "npm@2.15.1"

- name: Node.js 0.12
node-version: "0.12"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.1

- name: io.js 1.x
node-version: "1.8"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.1

- name: io.js 2.x
node-version: "2.5"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.1

- name: io.js 3.x
node-version: "3.3"
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.1
npm-version: "npm@2.15.1"

- name: Node.js 4.x
node-version: "4.9"
Expand All @@ -69,6 +86,7 @@ jobs:
- name: Node.js 5.x
node-version: "5.12"
npm-i: mocha@5.2.0 nyc@11.9.0 supertest@3.4.2
npm-version: npm@3.10.10

- name: Node.js 6.x
node-version: "6.17"
Expand Down Expand Up @@ -107,59 +125,72 @@ jobs:
npm-i: supertest@6.1.3

- name: Node.js 15.x
node-version: "15.14"
node-version: "15"
npm-i: supertest@6.1.3

- name: Node.js 16.x
node-version: "16.20"
node-version: "16"
npm-i: supertest@6.1.3

- name: Node.js 17.x
node-version: "17.9"
node-version: "17"
npm-i: supertest@6.1.3

- 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
with:
persist-credentials: false

- name: Setup Node.js ${{ matrix.node-version }}
if: ${{ matrix.node-version != '0.8' }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install Node.js ${{ matrix.node-version }}
- name: Setup Node.js 0.8
if: ${{ matrix.node-version == '0.8' && matrix.os == 'ubuntu-latest' }}
shell: bash -eo pipefail -l {0}
run: |
nvm install --default ${{ matrix.node-version }}
if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
nvm install --alias=npm 0.10
nvm use ${{ matrix.node-version }}
if [[ "$(npm -v)" == 1.1.* ]]; then
nvm exec npm npm install -g npm@1.1
ln -fs "$(which npm)" "$(dirname "$(nvm which npm)")/npm"
else
sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
fi
npm config set strict-ssl false
nvm install --alias=npm 0.10
nvm use ${{ matrix.node-version }}
if [[ "$(npm -v)" == 1.1.* ]]; then
nvm exec npm npm install -g npm@1.1
ln -fs "$(which npm)" "$(dirname "$(nvm which npm)")/npm"
else
sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
fi
npm config set strict-ssl false
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"

- name: Npm version fixes
if: ${{matrix.npm-version != ''}}
shell: bash -eo pipefail -l {0}
run: |
npm install -g ${{ matrix.npm-version }}

- name: Configure npm
shell: bash -eo pipefail -l {0}
run: |
if [[ "$(npm config get package-lock)" == "true" ]]; then
npm config set package-lock false
else
npm config set shrinkwrap false
fi
npm config set package-lock false

- name: Remove npm module(s) ${{ matrix.npm-rm }}
if: matrix.npm-rm != ''
Expand Down Expand Up @@ -202,10 +233,6 @@ 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
if: steps.list_env.outputs.nyc != ''
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/iojs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: iojs-ci

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

concurrency:
group: "${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ["1.8", "2.5", "3.3"]
include:
- node-version: "1.8"
npm-i: "mocha@3.5.3 nyc@10.3.2 supertest@2.0.0"
- node-version: "2.5"
npm-i: "mocha@3.5.3 nyc@10.3.2 supertest@2.0.0"
- node-version: "3.3"
npm-i: "mocha@3.5.3 nyc@10.3.2 supertest@2.0.0"

steps:
- uses: actions/checkout@v4

- name: Install iojs ${{ matrix.node-version }}
shell: bash -eo pipefail -l {0}
run: |
nvm install --default ${{ matrix.node-version }}
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"

- name: Configure npm
run: |
npm config set loglevel error
npm config set shrinkwrap false

- name: Install npm module(s) ${{ matrix.npm-i }}
run: npm install --save-dev ${{ matrix.npm-i }}
if: matrix.npm-i != ''

- name: Remove non-test dependencies
run: npm rm --silent --save-dev connect-redis

- name: Install Node.js dependencies
run: npm install

- name: List environment
id: list_env
shell: bash
run: |
echo "node@$(node -v)"
echo "npm@$(npm -v)"
npm -s ls ||:
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT"

- name: Run tests
shell: bash
run: npm run test
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
Loading