44 push :
55 branches :
66 - master
7- - ' 1.x'
87 paths-ignore :
98 - ' *.md'
109 pull_request :
@@ -15,94 +14,76 @@ permissions:
1514 contents : read
1615
1716jobs :
17+ lint :
18+ name : Lint
19+ runs-on : ubuntu-latest
20+ steps :
21+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
23+ - uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
24+ with :
25+ node-version : ' lts/*'
26+
27+ - name : Install Node.js dependencies
28+ run : npm install --ignore-scripts --include=dev
29+
30+ - name : Lint code
31+ run : npm run lint
32+
1833 test :
19- permissions :
20- checks : write # for coverallsapp/github-action to create new checks
21- contents : read # for actions/checkout to fetch code
34+ name : Test - Node.js ${{ matrix.node-version }}
2235 runs-on : ubuntu-latest
2336 strategy :
37+ fail-fast : false
2438 matrix :
25- name :
26- - Node.js 18.x
27- - Node.js 19.x
28- - Node.js 20.x
29- - Node.js 21.x
30- - Node.js 22.x
31-
32- include :
33- - name : Node.js 18.x
34- node-version : " 18"
39+ # Node.js release schedule: https://nodejs.org/en/about/releases/
40+ node-version : [18, 19, 20, 21, 22, 23, 24]
3541
36- - name : Node.js 19.x
37- node-version : " 19 "
42+ steps :
43+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3844
39- - name : Node.js 20.x
40- node-version : " 20"
45+ - uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
46+ with :
47+ node-version : ${{ matrix.node-version }}
48+ check-latest : true
4149
42- - name : Node.js 21.x
43- node-version : " 21 "
50+ - name : Install Node.js dependencies
51+ run : npm install
4452
45- - name : Node.js 22.x
46- node-version : " 22 "
53+ - name : Run tests
54+ run : npm run test-ci
4755
48- steps :
49- - uses : actions/checkout@v4
50-
51- - name : Install Node.js ${{ matrix.node-version }}
52- shell : bash -eo pipefail -l {0}
53- run : |
54- nvm install --default ${{ matrix.node-version }}
55- dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
56-
57- - name : Configure npm
58- run : |
59- if [[ "$(npm config get package-lock)" == "true" ]]; then
60- npm config set package-lock false
61- else
62- npm config set shrinkwrap false
63- fi
64-
65- - name : Install Node.js dependencies
66- run : npm install
67-
68- - name : List environment
69- id : list_env
70- shell : bash
71- run : |
72- echo "node@$(node -v)"
73- echo "npm@$(npm -v)"
74- npm -s ls ||:
75- (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }'
76-
77- - name : Run tests
78- shell : bash
79- run : |
80- if npm -ps ls nyc | grep -q nyc; then
81- npm run test-ci
82- else
83- npm test
84- fi
85-
86- - name : Lint code
87- if : steps.list_env.outputs.eslint != ''
88- run : npm run lint
89-
90- - name : Collect code coverage
91- uses : coverallsapp/github-action@master
92- if : steps.list_env.outputs.nyc != ''
93- with :
94- github-token : ${{ secrets.GITHUB_TOKEN }}
95- flag-name : run-${{ matrix.test_number }}
96- parallel : true
56+ - name : Upload code coverage
57+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
58+ with :
59+ name : coverage-node-${{ matrix.node-version }}
60+ path : ./coverage/lcov.info
61+ retention-days : 1
9762
9863 coverage :
99- permissions :
100- checks : write # for coverallsapp/github-action to create new checks
10164 needs : test
10265 runs-on : ubuntu-latest
66+ permissions :
67+ contents : read
68+ checks : write
10369 steps :
104- - name : Upload code coverage
105- uses : coverallsapp/github-action@master
106- with :
107- github-token : ${{ secrets.GITHUB_TOKEN }}
108- parallel-finished : true
70+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
71+
72+ - name : Install lcov
73+ shell : bash
74+ run : sudo apt-get -y install lcov
75+
76+ - name : Collect coverage reports
77+ uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
78+ with :
79+ path : ./coverage
80+ pattern : coverage-node-*
81+
82+ - name : Merge coverage reports
83+ shell : bash
84+ run : find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
85+
86+ - name : Upload coverage report
87+ uses : coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
88+ with :
89+ file : ./lcov.info
0 commit comments