Skip to content

Commit f4bd86e

Browse files
authored
Replace Appveyor windows testing with GHA (expressjs#5599)
This PR moves us off of Appveyor for windows testing. We are now doing windows/linux testing on GHA. With the exception of iojs, which we are only testing on Linux and have split out to it's own workflow. We have also added npm-shrinkwrap.json to our gitignore, in order to not have to configure npm in CI to ignore it. If it's never checked in, it shouldn't exist in CI as you need to go out of your way to create it w/ npm.
1 parent 2ec589c commit f4bd86e

File tree

4 files changed

+197
-165
lines changed

4 files changed

+197
-165
lines changed

.github/workflows/ci.yml

+125-163
Original file line numberDiff line numberDiff line change
@@ -20,187 +20,149 @@ 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 0.10
30-
- Node.js 0.12
31-
- io.js 1.x
32-
- io.js 2.x
33-
- io.js 3.x
34-
- Node.js 4.x
35-
- Node.js 5.x
36-
- Node.js 6.x
37-
- Node.js 7.x
38-
- Node.js 8.x
39-
- Node.js 9.x
40-
- Node.js 10.x
41-
- Node.js 11.x
42-
- Node.js 12.x
43-
- Node.js 13.x
44-
- Node.js 14.x
45-
- Node.js 15.x
46-
- Node.js 16.x
47-
- Node.js 17.x
48-
- Node.js 18.x
49-
- Node.js 19.x
50-
- Node.js 20.x
51-
- Node.js 21.x
52-
- Node.js 22.x
53-
45+
os: [ubuntu-latest, windows-latest]
46+
node-version:
47+
- "0.10"
48+
- "0.12"
49+
- "4"
50+
- "5"
51+
- "6"
52+
- "7"
53+
- "8"
54+
- "9"
55+
- "10"
56+
- "11"
57+
- "12"
58+
- "13"
59+
- "14"
60+
- "15"
61+
- "16"
62+
- "17"
63+
- "18"
64+
- "19"
65+
- "20"
66+
- "21"
67+
- "22"
68+
# Use supported versions of our testing tools under older versions of Node
69+
# Install npm in some specific cases where we need to
5470
include:
55-
- name: Node.js 0.10
56-
node-version: "0.10"
57-
58-
59-
- name: Node.js 0.12
60-
node-version: "0.12"
61-
62-
63-
- name: io.js 1.x
64-
node-version: "1"
65-
66-
67-
- name: io.js 2.x
68-
node-version: "2"
69-
70-
71-
- name: io.js 3.x
72-
node-version: "3"
73-
74-
75-
- name: Node.js 4.x
76-
node-version: "4"
77-
78-
79-
- name: Node.js 5.x
80-
node-version: "5"
81-
82-
83-
- name: Node.js 6.x
84-
node-version: "6"
85-
86-
87-
- name: Node.js 7.x
88-
node-version: "7"
89-
90-
91-
- name: Node.js 8.x
92-
node-version: "8"
93-
71+
- node-version: "0.10"
72+
73+
# Npm isn't being installed on windows w/ setup-node for
74+
# 0.10 and 0.12, which will end up choking when npm uses es6
75+
npm-version: "[email protected]"
9476

95-
- name: Node.js 9.x
96-
node-version: "9"
97-
77+
- node-version: "0.12"
78+
79+
npm-version: "[email protected]"
9880

99-
- name: Node.js 10.x
100-
node-version: "10"
101-
81+
- node-version: "4"
82+
10283

103-
- name: Node.js 11.x
104-
node-version: "11"
105-
84+
- node-version: "5"
85+
86+
# fixes https://github.com/npm/cli/issues/681
87+
npm-version: "[email protected]"
10688

107-
- name: Node.js 12.x
108-
node-version: "12"
109-
89+
- node-version: "6"
90+
11091

111-
- name: Node.js 13.x
112-
node-version: "13"
113-
92+
- node-version: "7"
93+
11494

115-
- name: Node.js 14.x
116-
node-version: "14"
95+
- node-version: "8"
96+
11797

118-
- name: Node.js 15.x
119-
node-version: "15"
98+
- node-version: "9"
99+
120100

121-
- name: Node.js 16.x
122-
node-version: "16"
101+
- node-version: "10"
102+
123103

124-
- name: Node.js 17.x
125-
node-version: "17"
104+
- node-version: "11"
105+
126106

127-
- name: Node.js 18.x
128-
node-version: "18"
107+
- node-version: "12"
108+
129109

130-
- name: Node.js 19.x
131-
node-version: "19"
132-
133-
- name: Node.js 20.x
134-
node-version: "20"
135-
136-
- name: Node.js 21.x
137-
node-version: "21"
138-
139-
- name: Node.js 22.x
140-
node-version: "22"
110+
- node-version: "13"
111+
141112

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

205167
coverage:
206168
needs: test

.github/workflows/iojs.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: iojs-ci
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- '4.x'
8+
paths-ignore:
9+
- '*.md'
10+
pull_request:
11+
paths-ignore:
12+
- '*.md'
13+
14+
concurrency:
15+
group: "${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
16+
cancel-in-progress: true
17+
18+
jobs:
19+
test:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
node-version: ["1.8", "2.5", "3.3"]
25+
include:
26+
- node-version: "1.8"
27+
28+
- node-version: "2.5"
29+
30+
- node-version: "3.3"
31+
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Install iojs ${{ matrix.node-version }}
37+
shell: bash -eo pipefail -l {0}
38+
run: |
39+
nvm install --default ${{ matrix.node-version }}
40+
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
41+
42+
- name: Configure npm
43+
run: |
44+
npm config set loglevel error
45+
npm config set shrinkwrap false
46+
47+
- name: Install npm module(s) ${{ matrix.npm-i }}
48+
run: npm install --save-dev ${{ matrix.npm-i }}
49+
if: matrix.npm-i != ''
50+
51+
- name: Remove non-test dependencies
52+
run: npm rm --silent --save-dev connect-redis
53+
54+
- name: Install Node.js dependencies
55+
run: npm install
56+
57+
- name: List environment
58+
id: list_env
59+
shell: bash
60+
run: |
61+
echo "node@$(node -v)"
62+
echo "npm@$(npm -v)"
63+
npm -s ls ||:
64+
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT"
65+
66+
- name: Run tests
67+
shell: bash
68+
run: npm run test
69+

.gitignore

+1
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

0 commit comments

Comments
 (0)