Skip to content

Commit 088856c

Browse files
committed
💚 add legacy CI, clean up
1 parent 4b3b8cc commit 088856c

File tree

2 files changed

+188
-20
lines changed

2 files changed

+188
-20
lines changed

.github/workflows/ci.yml

+6-20
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,10 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
name:
14-
- Node.js 18.x
15-
- Node.js 19.x
16-
- Node.js 20.x
17-
- Node.js 21.x
13+
node-version: [18, 19, 20, 21, 22]
14+
# Node.js release schedule: https://nodejs.org/en/about/releases/
1815

19-
include:
20-
- name: Node.js 18.x
21-
node-version: "18.19"
22-
23-
- name: Node.js 19.x
24-
node-version: "19.9"
25-
26-
- name: Node.js 20.x
27-
node-version: "20.11"
28-
29-
- name: Node.js 21.x
30-
node-version: "21.6"
16+
name: Node.js ${{ matrix.node-version }}
3117

3218
steps:
3319
- uses: actions/checkout@v4
@@ -70,17 +56,17 @@ jobs:
7056
shell: bash
7157
run: |
7258
npm run test-ci
73-
cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov"
59+
cp coverage/lcov.info "coverage/${{ matrix.node-version }}.lcov"
7460
7561
- name: Lint code
7662
if: steps.list_env.outputs.eslint != ''
7763
run: npm run lint
7864

7965
- name: Collect code coverage
8066
run: |
81-
mv ./coverage "./${{ matrix.name }}"
67+
mv ./coverage "./${{ matrix.node-version }}"
8268
mkdir ./coverage
83-
mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}"
69+
mv "./${{ matrix.node-version }}" "./coverage/${{ matrix.node-version }}"
8470
8571
- name: Upload code coverage
8672
uses: actions/upload-artifact@v3

.github/workflows/legacy.yml

+182
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
name: legacy
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
name:
14+
- Node.js 4.0
15+
- Node.js 4.x
16+
- Node.js 5.x
17+
- Node.js 6.x
18+
- Node.js 7.x
19+
- Node.js 8.x
20+
- Node.js 9.x
21+
- Node.js 10.x
22+
- Node.js 11.x
23+
- Node.js 12.x
24+
- Node.js 13.x
25+
- Node.js 14.x
26+
- Node.js 15.x
27+
- Node.js 16.x
28+
- Node.js 17.x
29+
30+
include:
31+
- name: Node.js 4.0
32+
node-version: "4.0"
33+
34+
35+
- name: Node.js 4.x
36+
node-version: "4.9"
37+
38+
39+
- name: Node.js 5.x
40+
node-version: "5.12"
41+
42+
43+
- name: Node.js 6.x
44+
node-version: "6.17"
45+
46+
47+
- name: Node.js 7.x
48+
node-version: "7.10"
49+
50+
51+
- name: Node.js 8.x
52+
node-version: "8.17"
53+
54+
55+
- name: Node.js 9.x
56+
node-version: "9.11"
57+
58+
59+
- name: Node.js 10.x
60+
node-version: "10.24"
61+
62+
63+
- name: Node.js 11.x
64+
node-version: "11.15"
65+
66+
67+
- name: Node.js 12.x
68+
node-version: "12.22"
69+
70+
71+
- name: Node.js 13.x
72+
node-version: "13.14"
73+
74+
75+
- name: Node.js 14.x
76+
node-version: "14.20"
77+
78+
- name: Node.js 15.x
79+
node-version: "15.14"
80+
81+
- name: Node.js 16.x
82+
node-version: "16.20"
83+
84+
- name: Node.js 17.x
85+
node-version: "17.9"
86+
87+
steps:
88+
- uses: actions/checkout@v4
89+
90+
- name: Install Node.js ${{ matrix.node-version }}
91+
shell: bash -eo pipefail -l {0}
92+
run: |
93+
nvm install --default ${{ matrix.node-version }}
94+
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
95+
96+
- name: Configure npm
97+
run: |
98+
npm config set loglevel error
99+
if [[ "$(npm config get package-lock)" == "true" ]]; then
100+
npm config set package-lock false
101+
else
102+
npm config set shrinkwrap false
103+
fi
104+
105+
- name: Install npm module(s) ${{ matrix.npm-i }}
106+
run: npm install --save-dev ${{ matrix.npm-i }}
107+
if: matrix.npm-i != ''
108+
109+
- name: Remove non-test dependencies
110+
run: npm rm --silent --save-dev connect-redis
111+
112+
- name: Setup Node.js version-specific dependencies
113+
shell: bash
114+
run: |
115+
# eslint for linting
116+
# - remove on Node.js < 12
117+
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; then
118+
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
119+
grep -E '^eslint(-|$)' | \
120+
sort -r | \
121+
xargs -n1 npm rm --silent --save-dev
122+
fi
123+
124+
- name: Install Node.js dependencies
125+
run: npm install
126+
127+
- name: List environment
128+
id: list_env
129+
shell: bash
130+
run: |
131+
echo "node@$(node -v)"
132+
echo "npm@$(npm -v)"
133+
npm -s ls ||:
134+
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT"
135+
136+
- name: Run tests
137+
shell: bash
138+
run: |
139+
npm run test-ci
140+
cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov"
141+
142+
- name: Lint code
143+
if: steps.list_env.outputs.eslint != ''
144+
run: npm run lint
145+
146+
- name: Collect code coverage
147+
run: |
148+
mv ./coverage "./${{ matrix.name }}"
149+
mkdir ./coverage
150+
mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}"
151+
152+
- name: Upload code coverage
153+
uses: actions/upload-artifact@v3
154+
with:
155+
name: coverage
156+
path: ./coverage
157+
retention-days: 1
158+
159+
coverage:
160+
needs: test
161+
runs-on: ubuntu-latest
162+
steps:
163+
- uses: actions/checkout@v4
164+
165+
- name: Install lcov
166+
shell: bash
167+
run: sudo apt-get -y install lcov
168+
169+
- name: Collect coverage reports
170+
uses: actions/download-artifact@v3
171+
with:
172+
name: coverage
173+
path: ./coverage
174+
175+
- name: Merge coverage reports
176+
shell: bash
177+
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/lcov.info
178+
179+
- name: Upload coverage report
180+
uses: coverallsapp/github-action@master
181+
with:
182+
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)