11name : ci
22
33on :
4- - pull_request
5- - push
4+ push :
5+ branches :
6+ - main
7+ paths-ignore :
8+ - ' *.md'
9+ pull_request :
10+ paths-ignore :
11+ - ' *.md'
612
713permissions :
814 contents : read
9-
1015jobs :
11- test :
12- permissions :
13- checks : write # for coverallsapp/github-action to create new checks
14- contents : read # for actions/checkout to fetch code
16+ lint :
17+ name : Lint
1518 runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v4
21+ - name : Setup Node.js
22+ uses : actions/setup-node@v4
23+ with :
24+ node-version : ' lts/*'
25+
26+ - name : Install dependencies
27+ run : npm install --ignore-scripts --include=dev
28+
29+ - name : Run lint
30+ run : npm run lint
31+ test :
1632 strategy :
1733 fail-fast : false
1834 matrix :
35+ os : [ubuntu-latest, windows-latest]
1936 name :
2037 - Node.js 10.x
2138 - Node.js 11.x
@@ -55,23 +72,23 @@ jobs:
55725673
5774 - name : Node.js 15.x
58- node-version : " 15.14"
75+ node-version : " 15.14.0 "
59766077
6178 - name : Node.js 16.x
62- node-version : " 16.20"
79+ node-version : " 16.20.2 "
6380
6481 - name : Node.js 17.x
65- node-version : " 17.9"
82+ node-version : " 17.9.1 "
6683
6784 - name : Node.js 18.x
68- node-version : " 18.18 "
85+ node-version : " 18.20.8 "
6986
7087 - name : Node.js 19.x
71- node-version : " 19.9"
88+ node-version : " 19.9.0 "
7289
7390 - name : Node.js 20.x
74- node-version : " 20.9 "
91+ node-version : " 20.19.2 "
7592
7693 - name : Node.js 21.x
7794 node-version : " 21"
@@ -85,26 +102,16 @@ jobs:
85102 - name : Node.js 24.x
86103 node-version : " 24"
87104
105+ runs-on : ${{ matrix.os }}
88106 steps :
89- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
90-
91- - name : Install Node.js ${{ matrix.node-version }}
92- shell : bash -eo pipefail -l {0}
93- run : |
94- nvm install --default ${{ matrix.node-version }}
95- if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
96- nvm install --alias=npm 0.10
97- nvm use ${{ matrix.node-version }}
98- if [[ "$(npm -v)" == 1.1.* ]]; then
99- nvm exec npm npm install -g [email protected] 100- ln -fs "$(which npm)" "$(dirname "$(nvm which npm)")/npm"
101- else
102- sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
103- fi
104- npm config set strict-ssl false
105- fi
106- dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
107+ - uses : actions/checkout@v4
108+ with :
109+ persist-credentials : false
107110
111+ - name : Setup Node.js ${{ matrix.node-version }}
112+ uses : actions/setup-node@v4
113+ with :
114+ node-version : ${{ matrix.node-version }}
108115 - name : Remove npm module(s) ${{ matrix.npm-rm }}
109116 run : npm rm --silent --save-dev ${{ matrix.npm-rm }}
110117 if : matrix.npm-rm != ''
@@ -116,43 +123,41 @@ jobs:
116123 - name : Install Node.js dependencies
117124 run : npm install
118125
119- - name : List environment
120- id : list_env
121- shell : bash
122- run : |
123- echo "node@$(node -v)"
124- echo "npm@$(npm -v)"
125- npm -s ls ||:
126- (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT"
127-
128- - name : Lint code
129- run : npm run lint
130-
131126 - name : Run tests
132127 shell : bash
133- run : |
134- if npm -ps ls nyc | grep -q nyc; then
135- npm run test-ci
136- else
137- npm test
138- fi
128+ run : npm run test-ci
139129
140- - name : Collect code coverage
141- uses : coverallsapp/github-action@09b709cf6a16e30b0808ba050c7a6e8a5ef13f8d # master
142- if : steps.list_env.outputs.nyc != ''
130+ - name : Upload code coverage
131+ uses : actions/upload-artifact@v4
143132 with :
144- github-token : ${{ secrets.GITHUB_TOKEN }}
145- flag-name : run-${{ matrix.test_number }}
146- parallel : true
133+ name : coverage-node- ${{ matrix.node-version }}-${{ matrix.os }}
134+ path : ./coverage/lcov.info
135+ retention-days : 1
147136
148137 coverage :
149- permissions :
150- checks : write # for coverallsapp/github-action to create new checks
151- needs : test
152- runs-on : ubuntu-latest
153- steps :
154- - name : Upload code coverage
155- uses : coverallsapp/github-action@09b709cf6a16e30b0808ba050c7a6e8a5ef13f8d # master
156- with :
157- github-token : ${{ secrets.GITHUB_TOKEN }}
158- parallel-finished : true
138+ needs : test
139+ runs-on : ubuntu-latest
140+ permissions :
141+ contents : read
142+ checks : write
143+ steps :
144+ - uses : actions/checkout@v4
145+
146+ - name : Install lcov
147+ shell : bash
148+ run : sudo apt-get -y install lcov
149+
150+ - name : Collect coverage reports
151+ uses : actions/download-artifact@v4
152+ with :
153+ path : ./coverage
154+ pattern : coverage-node-*
155+
156+ - name : Merge coverage reports
157+ shell : bash
158+ run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
159+
160+ - name : Upload coverage report
161+ uses : coverallsapp/github-action@v2
162+ with :
163+ file : ./lcov.info
0 commit comments