Skip to content

Commit 2d6fa70

Browse files
committed
Merge branch 'v2' of github.com:expressjs/compression into fernandolguevara/master
2 parents b89ebed + f1b3e1c commit 2d6fa70

File tree

8 files changed

+750
-270
lines changed

8 files changed

+750
-270
lines changed

.github/workflows/ci.yml

Lines changed: 98 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -1,206 +1,112 @@
11
name: ci
22

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

724
jobs:
8-
test:
25+
lint:
26+
name: Lint
927
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: 'lts/*'
34+
35+
- name: Install dependencies
36+
run: npm install --ignore-scripts --include=dev
37+
38+
- name: Run lint
39+
run: npm run lint
40+
41+
test:
1042
strategy:
43+
fail-fast: false
1144
matrix:
12-
name:
13-
- Node.js 0.8
14-
- Node.js 0.10
15-
- Node.js 0.12
16-
- io.js 1.x
17-
- io.js 2.x
18-
- io.js 3.x
19-
- Node.js 4.x
20-
- Node.js 5.x
21-
- Node.js 6.x
22-
- Node.js 7.x
23-
- Node.js 8.x
24-
- Node.js 9.x
25-
- Node.js 10.x
26-
- Node.js 11.x
27-
- Node.js 12.x
28-
- Node.js 13.x
29-
- Node.js 14.x
30-
- Node.js 15.x
31-
- Node.js 16.x
32-
- Node.js 17.x
33-
- Node.js 18.x
34-
- Node.js 19.x
35-
- Node.js 20.x
36-
37-
38-
include:
39-
- name: Node.js 0.8
40-
node-version: "0.8"
41-
42-
npm-rm: nyc
43-
44-
- name: Node.js 0.10
45-
node-version: "0.10"
46-
47-
48-
- name: Node.js 0.12
49-
node-version: "0.12"
50-
51-
52-
- name: io.js 1.x
53-
node-version: "1.8"
54-
55-
56-
- name: io.js 2.x
57-
node-version: "2.5"
58-
59-
60-
- name: io.js 3.x
61-
node-version: "3.3"
62-
63-
64-
- name: Node.js 4.x
65-
node-version: "4.9"
66-
67-
68-
- name: Node.js 5.x
69-
node-version: "5.12"
70-
71-
72-
- name: Node.js 6.x
73-
node-version: "6.17"
74-
75-
76-
- name: Node.js 7.x
77-
node-version: "7.10"
78-
79-
80-
- name: Node.js 8.x
81-
node-version: "8.16"
82-
83-
84-
- name: Node.js 9.x
85-
node-version: "9.11"
86-
87-
88-
- name: Node.js 10.x
89-
node-version: "10.16"
90-
91-
92-
- name: Node.js 11.x
93-
node-version: "11.15"
94-
95-
96-
- name: Node.js 12.x
97-
node-version: "12.22"
98-
99-
- name: Node.js 13.x
100-
node-version: "13.14"
101-
102-
- name: Node.js 14.x
103-
node-version: "14.19"
104-
105-
- name: Node.js 15.x
106-
node-version: "15.14"
107-
108-
- name: Node.js 16.x
109-
node-version: "16.15"
110-
111-
- name: Node.js 17.x
112-
node-version: "17.9"
113-
114-
- name: Node.js 18.x
115-
node-version: "18.19.1"
116-
117-
- name: Node.js 19.x
118-
node-version: "19.9.0"
119-
120-
- name: Node.js 20.x
121-
node-version: "20.11"
45+
os: [ubuntu-latest, windows-latest]
46+
node-version: [18, 19, 20, 21, 22, 23]
47+
# Node.js release schedule: https://nodejs.org/en/about/releases/
48+
49+
name: Node.js ${{ matrix.node-version }} - ${{matrix.os}}
50+
51+
runs-on: ${{ matrix.os }}
12252
steps:
123-
- uses: actions/checkout@v2
124-
125-
- name: Install Node.js ${{ matrix.node-version }}
126-
shell: bash -eo pipefail -l {0}
127-
run: |
128-
nvm install --default ${{ matrix.node-version }}
129-
if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
130-
nvm install --alias=npm 0.10
131-
nvm use ${{ matrix.node-version }}
132-
sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
133-
npm config set strict-ssl false
134-
fi
135-
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
136-
137-
- name: Configure npm
138-
run: |
139-
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -le 17 ]]; then
140-
npm config set shrinkwrap false
141-
else
142-
npm config set package-lock false
143-
fi
144-
145-
- name: Remove npm module(s) ${{ matrix.npm-rm }}
146-
run: npm rm --silent --save-dev ${{ matrix.npm-rm }}
147-
if: matrix.npm-rm != ''
148-
149-
- name: Install npm module(s) ${{ matrix.npm-i }}
150-
run: npm install --save-dev ${{ matrix.npm-i }}
151-
if: matrix.npm-i != ''
152-
153-
- name: Setup Node.js version-specific dependencies
154-
shell: bash
155-
run: |
156-
# eslint for linting
157-
# - remove on Node.js < 10
158-
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
159-
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
160-
grep -E '^eslint(-|$)' | \
161-
sort -r | \
162-
xargs -n1 npm rm --silent --save-dev
163-
fi
164-
165-
- name: Install Node.js dependencies
166-
run: npm install
167-
168-
- name: List environment
169-
id: list_env
170-
shell: bash
171-
run: |
172-
echo "node@$(node -v)"
173-
echo "npm@$(npm -v)"
174-
npm -s ls ||:
175-
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }'
176-
177-
- name: Run tests
178-
shell: bash
179-
run: |
180-
if npm -ps ls nyc | grep -q nyc; then
181-
npm run test-ci
182-
else
183-
npm test
184-
fi
185-
186-
- name: Lint code
187-
if: steps.list_env.outputs.eslint != ''
188-
run: npm run lint
189-
190-
- name: Collect code coverage
191-
uses: coverallsapp/github-action@master
192-
if: steps.list_env.outputs.nyc != ''
193-
with:
194-
github-token: ${{ secrets.GITHUB_TOKEN }}
195-
flag-name: run-${{ matrix.test_number }}
196-
parallel: true
53+
- uses: actions/checkout@v4
54+
with:
55+
persist-credentials: false
56+
57+
- name: Setup Node.js ${{ matrix.node-version }}
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: ${{ matrix.node-version }}
61+
62+
- name: Configure npm loglevel
63+
run: |
64+
npm config set loglevel error
65+
shell: bash
66+
67+
- name: Install dependencies
68+
run: npm install
69+
70+
- name: Output Node and NPM versions
71+
run: |
72+
echo "Node.js version: $(node -v)"
73+
echo "NPM version: $(npm -v)"
74+
75+
- name: Run tests
76+
shell: bash
77+
run: npm run test-ci
78+
79+
- name: Upload code coverage
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: coverage-node-${{ matrix.node-version }}-${{ matrix.os }}
83+
path: ./coverage/lcov.info
84+
retention-days: 1
19785

19886
coverage:
19987
needs: test
20088
runs-on: ubuntu-latest
89+
permissions:
90+
contents: read
91+
checks: write
20192
steps:
202-
- name: Uploade code coverage
203-
uses: coverallsapp/github-action@master
204-
with:
205-
github-token: ${{ secrets.github_token }}
206-
parallel-finished: true
93+
- uses: actions/checkout@v4
94+
95+
- name: Install lcov
96+
shell: bash
97+
run: sudo apt-get -y install lcov
98+
99+
- name: Collect coverage reports
100+
uses: actions/download-artifact@v4
101+
with:
102+
path: ./coverage
103+
pattern: coverage-node-*
104+
105+
- name: Merge coverage reports
106+
shell: bash
107+
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
108+
109+
- name: Upload coverage report
110+
uses: coverallsapp/github-action@v2
111+
with:
112+
file: ./lcov.info

.github/workflows/codeql.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: ["master"]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: ["master"]
20+
schedule:
21+
- cron: "0 0 * * 1"
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
analyze:
28+
name: Analyze
29+
runs-on: ubuntu-latest
30+
permissions:
31+
actions: read
32+
contents: read
33+
security-events: write
34+
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38+
39+
# Initializes the CodeQL tools for scanning.
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
42+
with:
43+
languages: javascript
44+
# If you wish to specify custom queries, you can do so here or in a config file.
45+
# By default, queries listed here will override any specified in a config file.
46+
# Prefix the list here with "+" to use these queries and those in the config file.
47+
48+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
49+
# If this step fails, then you should remove it and run the build manually (see below)
50+
# - name: Autobuild
51+
# uses: github/codeql-action/autobuild@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
52+
53+
# ℹ️ Command-line programs to run using the OS shell.
54+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
55+
56+
# If the Autobuild fails above, remove it and uncomment the following three lines.
57+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
58+
59+
# - run: |
60+
# echo "Run, Build Application using script"
61+
# ./location_of_script_within_repo/buildscript.sh
62+
63+
- name: Perform CodeQL Analysis
64+
uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
65+
with:
66+
category: "/language:javascript"

0 commit comments

Comments
 (0)