11name : ci
22
33on :
4- - pull_request
5- - push
4+ push :
5+ branches :
6+ - master
7+ pull_request :
68
79permissions :
810 contents : read
911
12+ # Cancel in progress workflows
13+ # in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run
14+ concurrency :
15+ group : " ${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
16+ cancel-in-progress : true
17+
1018jobs :
11- test :
19+ lint :
20+ name : Lint
1221 runs-on : ubuntu-latest
13- strategy :
14- matrix :
15- name :
16- - Node.js 0.8
17- - Node.js 0.10
18- - Node.js 0.12
19- - io.js 1.x
20- - io.js 2.x
21- - io.js 3.x
22- - Node.js 4.x
23- - Node.js 5.x
24- - Node.js 6.x
25- - Node.js 7.x
26- - Node.js 8.x
27- - Node.js 9.x
28- - Node.js 10.x
29- - Node.js 11.x
30- - Node.js 12.x
31- - Node.js 13.x
32- - Node.js 14.x
33- - Node.js 15.x
34- - Node.js 16.x
35- - Node.js 17.x
36- - Node.js 18.x
37- - Node.js 19.x
38- - Node.js 20.x
39- - Node.js 21.x
40-
41- include :
42- - name : Node.js 0.8
43- node-version : " 0.8"
44- 45- npm-rm : nyc
46-
47- - name : Node.js 0.10
48- node-version : " 0.10"
49- 50-
51- - name : Node.js 0.12
52- node-version : " 0.12"
53- 54-
55- - name : io.js 1.x
56- node-version : " 1.8"
57- 58-
59- - name : io.js 2.x
60- node-version : " 2.5"
61- 62-
63- - name : io.js 3.x
64- node-version : " 3.3"
65- 66-
67- - name : Node.js 4.x
68- node-version : " 4.9"
69- 70-
71- - name : Node.js 5.x
72- node-version : " 5.12"
73- 74-
75- - name : Node.js 6.x
76- node-version : " 6.17"
77- 22+ steps :
23+ - uses : actions/checkout@v4
24+ - name : Setup Node.js
25+ uses : actions/setup-node@v4
26+ with :
27+ node-version : ' lts/*'
7828
79- - name : Node.js 7.x
80- node-version : " 7.10"
81- 29+ - name : Install dependencies
30+ run : npm install --ignore-scripts --include=dev
8231
83- - name : Node.js 8.x
84- node-version : " 8.17"
85- 32+ - name : Run lint
33+ run : npm run lint
8634
87- - name : Node.js 9.x
88- node-version : " 9.11"
89- 35+ test :
36+ name : Run tests
37+ strategy :
38+ fail-fast : false
39+ matrix :
40+ os : [ubuntu-latest, windows-latest]
41+ node-version :
42+ - " 0.10"
43+ - " 0.12"
44+ - " 4"
45+ - " 5"
46+ - " 6"
47+ - " 7"
48+ - " 8"
49+ - " 9"
50+ - " 10"
51+ - " 11"
52+ - " 12"
53+ - " 13"
54+ - " 14"
55+ - " 15"
56+ - " 16"
57+ - " 17"
58+ - " 18"
59+ - " 19"
60+ - " 20"
61+ - " 21"
62+ - " 22"
63+ - " 23"
64+ - " 24"
65+ # Use supported versions of our testing tools under older versions of Node
66+ # Install npm in some specific cases where we need to
67+ include :
68+ - node-version : " 0.10"
69+ 70+ # Npm isn't being installed on windows w/ setup-node for
71+ # 0.10 and 0.12, which will end up choking when npm uses es6
72+ 9073
91- - name : Node.js 10.x
92- node-version : " 10.24 "
93- 74+ - node-version : " 0.12 "
75+ 76+ 9477
95- - name : Node.js 11.x
96- node-version : " 11.15"
97- 78+ - node-version : " 4"
79+ 9880
99- - name : Node.js 12.x
100- node-version : " 12.22"
101- 81+ - node-version : " 5"
82+ 83+ # fixes https://github.com/npm/cli/issues/681
84+ 10285
103- - name : Node.js 13.x
104- node-version : " 13.14"
105- 86+ - node-version : " 6"
87+ 10688
107- - name : Node.js 14.x
108- node-version : " 14.21 "
89+ - node-version : " 7 "
90+ 10991
110- - name : Node.js 15.x
111- node-version : " 15.14"
112- 92+ - node-version : " 8"
93+ 11394
114- - name : Node.js 16.x
115- node-version : " 16.20 "
95+ - node-version : " 9 "
96+ 11697
117- - name : Node.js 17.x
118- node-version : " 17.9 "
98+ - node-version : " 10 "
99+ 119100
120- - name : Node.js 18.x
121- node-version : " 18.19 "
101+ - node-version : " 11 "
102+ 122103
123- - name : Node.js 19.x
124- node-version : " 19.9 "
104+ - node-version : " 12 "
105+ 125106
126- - name : Node.js 20.x
127- node-version : " 20.11 "
107+ - node-version : " 13 "
108+ 128109
129- - name : Node.js 21.x
130- node-version : " 21 .6"
110+ - node-version : " 15 "
111+ 131112
113+ runs-on : ${{ matrix.os }}
132114 steps :
133- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
134-
135- - name : Install Node.js ${{ matrix.node-version }}
136- shell : bash -eo pipefail -l {0}
137- run : |
138- nvm install --default ${{ matrix.node-version }}
139- if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
140- nvm install --alias=npm 0.10
141- nvm use ${{ matrix.node-version }}
142- sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
143- npm config set strict-ssl false
144- fi
145- dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
146-
147- - name : Configure npm
148- run : |
149- if [[ "$(npm config get package-lock)" == "true" ]]; then
150- npm config set package-lock false
151- else
152- npm config set shrinkwrap false
153- fi
154-
155- - name : Remove npm module(s) ${{ matrix.npm-rm }}
156- run : npm rm --silent --save-dev ${{ matrix.npm-rm }}
157- if : matrix.npm-rm != ''
158-
159- - name : Install npm module(s) ${{ matrix.npm-i }}
160- run : npm install --save-dev ${{ matrix.npm-i }}
161- if : matrix.npm-i != ''
162-
163- - name : Setup Node.js version-specific dependencies
164- shell : bash
165- run : |
166- # eslint for linting
167- # - remove on Node.js < 12
168- if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; then
169- node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
170- grep -E '^eslint(-|$)' | \
171- sort -r | \
172- xargs -n1 npm rm --silent --save-dev
173- fi
174-
175- - name : Install Node.js dependencies
176- run : npm install
177-
178- - name : List environment
179- id : list_env
180- shell : bash
181- run : |
182- echo "node@$(node -v)"
183- echo "npm@$(npm -v)"
184- npm -s ls ||:
185- (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT"
186-
187- - name : Run tests
188- shell : bash
189- run : |
190- if npm -ps ls nyc | grep -q nyc; then
191- npm run test-ci
192- cp coverage/lcov.info "coverage/${{ matrix.node-version }}.lcov"
193- else
194- npm test
195- fi
196-
197- - name : Lint code
198- if : steps.list_env.outputs.eslint != ''
199- run : npm run lint
200-
201- - name : Collect code coverage
202- if : steps.list_env.outputs.nyc != ''
203- run : |
204- if [[ -d ./coverage ]]; then
205- mv ./coverage "./${{ matrix.node-version }}"
206- mkdir ./coverage
207- mv "./${{ matrix.node-version }}" "./coverage/${{ matrix.node-version }}"
208- fi
209-
210- - name : Upload code coverage
211- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
212- if : steps.list_env.outputs.nyc != ''
213- with :
214- name : coverage-${{ matrix.node-version }}
215- path : " ./coverage/${{ matrix.node-version }}"
216- 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 Node version specific dev deps
134+ if : ${{ matrix.npm-i != '' }}
135+ run : npm install --save-dev ${{ matrix.npm-i }}
136+
137+ - name : Install dependencies
138+ run : npm install
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 : npm run test-ci
151+
152+ - name : Upload code coverage
153+ uses : actions/upload-artifact@v4
154+ with :
155+ name : coverage-node-${{ matrix.node-version }}-${{ matrix.os }}
156+ path : ./coverage/lcov.info
157+ retention-days : 1
217158
218159 coverage :
219- permissions :
220- checks : write # for coverallsapp/github-action to create new checks
221- contents : read # for actions/checkout to fetch code
222160 needs : test
223161 runs-on : ubuntu-latest
162+ permissions :
163+ contents : read
164+ checks : write
224165 steps :
225- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
226-
227- - name : Install lcov
228- shell : bash
229- run : sudo apt-get -y install lcov
230-
231- - name : Collect coverage reports
232- uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
233- with :
234- path : ./coverage
235-
236- - name : Merge coverage reports
237- shell : bash
238- run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/lcov.info
239-
240- - name : Upload coverage report
241- uses : coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # master
242- with :
243- github-token : ${{ secrets.GITHUB_TOKEN }}
166+ - uses : actions/checkout@v4
167+
168+ - name : Install lcov
169+ shell : bash
170+ run : sudo apt-get -y install lcov
171+
172+ - name : Collect coverage reports
173+ uses : actions/download-artifact@v4
174+ with :
175+ path : ./coverage
176+ pattern : coverage-node-*
177+
178+ - name : Merge coverage reports
179+ shell : bash
180+ run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
181+
182+ - name : Upload coverage report
183+ uses : coverallsapp/github-action@v2
184+ with :
185+ file : ./lcov.info
0 commit comments