Skip to content

Commit ea49706

Browse files
committed
Merge branch 'master' into 5-merge
2 parents dde1f7d + 2177f67 commit ea49706

File tree

4 files changed

+122
-143
lines changed

4 files changed

+122
-143
lines changed

.github/workflows/ci.yml

Lines changed: 115 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -20,163 +20,137 @@ concurrency:
2020
cancel-in-progress: true
2121

2222
jobs:
23-
test:
23+
lint:
24+
name: Lint
2425
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Setup Node.js {{ matrix.node-version }}
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 'lts/*'
32+
persist-credentials: false
33+
34+
- name: Install dependencies
35+
run: npm install --ignore-scripts --only=dev
36+
37+
- name: Run lint
38+
run: npm run lint
39+
40+
test:
41+
name: Run tests
2542
strategy:
2643
fail-fast: false
2744
matrix:
28-
name:
29-
- Node.js 4.0
30-
- Node.js 4.x
31-
- Node.js 5.x
32-
- Node.js 6.x
33-
- Node.js 7.x
34-
- Node.js 8.x
35-
- Node.js 9.x
36-
- Node.js 10.x
37-
- Node.js 11.x
38-
- Node.js 12.x
39-
- Node.js 13.x
40-
- Node.js 14.x
41-
- Node.js 15.x
42-
- Node.js 16.x
43-
- Node.js 17.x
44-
- Node.js 18.x
45-
- Node.js 19.x
46-
- Node.js 20.x
47-
- Node.js 21.x
48-
- Node.js 22.x
49-
45+
os: [ubuntu-latest, windows-latest]
46+
node-version:
47+
- "4"
48+
- "5"
49+
- "6"
50+
- "7"
51+
- "8"
52+
- "9"
53+
- "10"
54+
- "11"
55+
- "12"
56+
- "13"
57+
- "14"
58+
- "15"
59+
- "16"
60+
- "17"
61+
- "18"
62+
- "19"
63+
- "20"
64+
- "21"
65+
- "22"
66+
# Use supported versions of our testing tools under older versions of Node
67+
# Install npm in some specific cases where we need to
5068
include:
51-
- name: Node.js 4.x
52-
node-version: "4"
53-
54-
55-
- name: Node.js 5.x
56-
node-version: "5"
57-
58-
59-
- name: Node.js 6.x
60-
node-version: "6"
61-
62-
63-
- name: Node.js 7.x
64-
node-version: "7"
65-
66-
67-
- name: Node.js 8.x
68-
node-version: "8"
69-
70-
71-
- name: Node.js 9.x
72-
node-version: "9"
73-
74-
75-
- name: Node.js 10.x
76-
node-version: "10"
77-
78-
79-
- name: Node.js 11.x
80-
node-version: "11"
81-
69+
- node-version: "4"
70+
8271

83-
- name: Node.js 12.x
84-
node-version: "12"
85-
72+
- node-version: "5"
73+
74+
# fixes https://github.com/npm/cli/issues/681
75+
npm-version: "[email protected]"
8676

87-
- name: Node.js 13.x
88-
node-version: "13"
89-
77+
- node-version: "6"
78+
9079

91-
- name: Node.js 14.x
92-
node-version: "14"
80+
- node-version: "7"
81+
9382

94-
- name: Node.js 15.x
95-
node-version: "15"
83+
- node-version: "8"
84+
9685

97-
- name: Node.js 16.x
98-
node-version: "16"
86+
- node-version: "9"
87+
9988

100-
- name: Node.js 17.x
101-
node-version: "17"
89+
- node-version: "10"
90+
10291

103-
- name: Node.js 18.x
104-
node-version: "18"
92+
- node-version: "11"
93+
10594

106-
- name: Node.js 19.x
107-
node-version: "19"
95+
- node-version: "12"
96+
10897

109-
- name: Node.js 20.x
110-
node-version: "20"
111-
112-
- name: Node.js 21.x
113-
node-version: "21"
114-
115-
- name: Node.js 22.x
116-
node-version: "22"
98+
- node-version: "13"
99+
117100

101+
runs-on: ${{ matrix.os }}
118102
steps:
119-
- uses: actions/checkout@v4
120-
121-
- name: Install Node.js ${{ matrix.node-version }}
122-
shell: bash -eo pipefail -l {0}
123-
run: |
124-
nvm install --default ${{ matrix.node-version }}
125-
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
126-
127-
- name: Install npm module(s) ${{ matrix.npm-i }}
128-
run: npm install --save-dev ${{ matrix.npm-i }}
129-
if: matrix.npm-i != ''
130-
131-
- name: Remove non-test dependencies
132-
run: npm rm --silent --save-dev connect-redis
133-
134-
- name: Setup Node.js version-specific dependencies
135-
shell: bash
136-
run: |
137-
# eslint for linting
138-
# - remove on Node.js < 12
139-
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; then
140-
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
141-
grep -E '^eslint(-|$)' | \
142-
sort -r | \
143-
xargs -n1 npm rm --silent --save-dev
144-
fi
145-
146-
- name: Install Node.js dependencies
147-
run: npm install
148-
149-
- name: List environment
150-
id: list_env
151-
shell: bash
152-
run: |
153-
echo "node@$(node -v)"
154-
echo "npm@$(npm -v)"
155-
npm -s ls ||:
156-
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT"
157-
158-
- name: Run tests
159-
shell: bash
160-
run: |
161-
npm run test-ci
162-
cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov"
163-
164-
- name: Lint code
165-
if: steps.list_env.outputs.eslint != ''
166-
run: npm run lint
167-
168-
- name: Collect code coverage
169-
run: |
170-
mv ./coverage "./${{ matrix.name }}"
171-
mkdir ./coverage
172-
mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}"
173-
174-
- name: Upload code coverage
175-
uses: actions/upload-artifact@v3
176-
with:
177-
name: coverage
178-
path: ./coverage
179-
retention-days: 1
103+
- uses: actions/checkout@v4
104+
with:
105+
persist-credentials: false
106+
107+
- name: Setup Node.js ${{ matrix.node-version }}
108+
uses: actions/setup-node@v4
109+
with:
110+
node-version: ${{ matrix.node-version }}
111+
112+
- name: Npm version fixes
113+
if: ${{matrix.npm-version != ''}}
114+
run: npm install -g ${{ matrix.npm-version }}
115+
116+
- name: Configure npm loglevel
117+
run: |
118+
npm config set loglevel error
119+
shell: bash
120+
121+
- name: Install dependencies
122+
run: npm install
123+
124+
- name: Install Node version specific dev deps
125+
if: ${{ matrix.npm-i != '' }}
126+
run: npm install --save-dev ${{ matrix.npm-i }}
127+
128+
- name: Remove non-test dependencies
129+
run: npm rm --silent --save-dev connect-redis
130+
131+
- name: Output Node and NPM versions
132+
run: |
133+
echo "Node.js version: $(node -v)"
134+
echo "NPM version: $(npm -v)"
135+
136+
- name: Run tests
137+
shell: bash
138+
run: |
139+
npm run test-ci
140+
cp coverage/lcov.info "coverage/${{ matrix.node-version }}.lcov"
141+
142+
- name: Collect code coverage
143+
run: |
144+
mv ./coverage "./${{ matrix.node-version }}"
145+
mkdir ./coverage
146+
mv "./${{ matrix.node-version }}" "./coverage/${{ matrix.node-version }}"
147+
148+
- name: Upload code coverage
149+
uses: actions/upload-artifact@v3
150+
with:
151+
name: coverage
152+
path: ./coverage
153+
retention-days: 1
180154

181155
coverage:
182156
needs: test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# npm
22
node_modules
33
package-lock.json
4+
npm-shrinkwrap.json
45
*.log
56
*.gz
67

Readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
[![NPM Version][npm-version-image]][npm-url]
2323
[![NPM Install Size][npm-install-size-image]][npm-install-size-url]
2424
[![NPM Downloads][npm-downloads-image]][npm-downloads-url]
25+
[![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
26+
2527

2628
```js
2729
const express = require('express')
@@ -252,4 +254,6 @@ The original author of Express is [TJ Holowaychuk](https://github.com/tj)
252254
[npm-install-size-url]: https://packagephobia.com/result?p=express
253255
[npm-url]: https://npmjs.org/package/express
254256
[npm-version-image]: https://badgen.net/npm/v/express
257+
[ossf-scorecard-badge]: https://api.securityscorecards.dev/projects/github.com/expressjs/express/badge
258+
[ossf-scorecard-visualizer]: https://kooltheba.github.io/openssf-scorecard-api-visualizer/#/projects/github.com/expressjs/express
255259
[Code of Conduct]: https://github.com/expressjs/express/blob/master/Code-Of-Conduct.md

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@
9393
"scripts": {
9494
"lint": "eslint .",
9595
"test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/ test/acceptance/",
96-
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
97-
"test-cov": "nyc --reporter=html --reporter=text npm test",
96+
"test-ci": "nyc --exclude examples --exclude test --exclude benchmarks --reporter=lcovonly --reporter=text npm test",
97+
"test-cov": "nyc --exclude examples --exclude test --exclude benchmarks --reporter=html --reporter=text npm test",
9898
"test-tap": "mocha --require test/support/env --reporter tap --check-leaks test/ test/acceptance/"
9999
}
100100
}

0 commit comments

Comments
 (0)