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
13+ permissions :
14+ contents : read
715jobs :
8- test :
16+ lint :
17+ name : Lint
918 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 :
1032 strategy :
1133 fail-fast : false
1234 matrix :
35+ os : [ubuntu-latest, windows-latest, macos-latest]
1336 name :
1437 - Node.js 10.x
1538 - Node.js 11.x
@@ -79,25 +102,15 @@ jobs:
79102 - name : Node.js 24.x
80103 node-version : " 24"
81104
105+ runs-on : ${{ matrix.os }}
82106 steps :
83107 - uses : actions/checkout@v4
108+ with :
109+ persist-credentials : false
84110
85111 - name : Install Node.js ${{ matrix.node-version }}
86- shell : bash -eo pipefail -l {0}
87- run : |
88- nvm install --default ${{ matrix.node-version }}
89- if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
90- nvm install --alias=npm 0.10
91- nvm use ${{ matrix.node-version }}
92- if [[ "$(npm -v)" == 1.1.* ]]; then
93- nvm exec npm npm install -g [email protected] 94- ln -fs "$(which npm)" "$(dirname "$(nvm which npm)")/npm"
95- else
96- sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
97- fi
98- npm config set strict-ssl false
99- fi
100- dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
112+ shell : bash
113+ run : nvm install --default ${{ matrix.node-version }}
101114
102115 - name : Remove npm module(s) ${{ matrix.npm-rm }}
103116 run : npm rm --silent --save-dev ${{ matrix.npm-rm }}
@@ -110,41 +123,41 @@ jobs:
110123 - name : Install Node.js dependencies
111124 run : npm install
112125
113- - name : List environment
114- id : list_env
115- shell : bash
116- run : |
117- echo "node@$(node -v)"
118- echo "npm@$(npm -v)"
119- npm -s ls ||:
120- (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT"
121-
122- - name : Lint code
123- run : npm run lint
124-
125126 - name : Run tests
126127 shell : bash
127- run : |
128- if npm -ps ls nyc | grep -q nyc; then
129- npm run test-ci
130- else
131- npm test
132- fi
128+ run : npm run test-ci
133129
134- - name : Collect code coverage
135- uses : coverallsapp/github-action@v2
136- if : steps.list_env.outputs.nyc != ''
130+ - name : Upload code coverage
131+ uses : actions/upload-artifact@v4
137132 with :
138- github-token : ${{ secrets.GITHUB_TOKEN }}
139- flag-name : run-${{ matrix.test_number }}
140- parallel : true
133+ name : coverage-node- ${{ matrix.node-version }}-${{ matrix.os }}
134+ path : ./coverage/lcov.info
135+ retention-days : 1
141136
142137 coverage :
143- needs : test
144- runs-on : ubuntu-latest
145- steps :
146- - name : Upload code coverage
147- uses : coverallsapp/github-action@v2
148- with :
149- github-token : ${{ secrets.GITHUB_TOKEN }}
150- 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