|
1 | 1 | name: ci |
2 | | - |
3 | 2 | on: |
4 | | -- pull_request |
5 | | -- push |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - v3 |
| 6 | + paths-ignore: |
| 7 | + - '*.md' |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - v3 |
| 11 | + paths-ignore: |
| 12 | + - '*.md' |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
6 | 16 |
|
7 | 17 | jobs: |
| 18 | + lint: |
| 19 | + name: Lint |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 23 | + |
| 24 | + - name: Install Node.js |
| 25 | + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 26 | + with: |
| 27 | + node-version: 'lts/*' |
| 28 | + |
| 29 | + - name: Install Node.js dependencies |
| 30 | + run: npm install --ignore-scripts --include=dev |
| 31 | + |
| 32 | + - name: Lint code |
| 33 | + run: npm run lint |
| 34 | + |
8 | 35 | test: |
| 36 | + name: Test - Node.js ${{ matrix.node-version }} |
9 | 37 | runs-on: ubuntu-latest |
10 | 38 | strategy: |
| 39 | + fail-fast: false |
11 | 40 | matrix: |
12 | | - name: |
13 | | - - Node.js 0.8 |
14 | | - - Node.js 0.10 |
15 | | - - Node.js 0.12 |
16 | | - - io.js 1.x |
17 | | - - io.js 2.x |
18 | | - - io.js 3.x |
19 | | - - Node.js 4.x |
20 | | - - Node.js 5.x |
21 | | - - Node.js 6.x |
22 | | - - Node.js 7.x |
23 | | - - Node.js 8.0 # test early async_hooks |
24 | | - - Node.js 8.x |
25 | | - # test fail on Node.js 9.x for unknown reasons |
26 | | - # See https://github.com/jshttp/on-finished/pull/49 for more information. |
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 | | - |
38 | | - include: |
39 | | - - name: Node.js 0.8 |
40 | | - node-version: "0.8" |
41 | | - npm-i: mocha@2.5.3 |
42 | | - npm-rm: nyc |
43 | | - |
44 | | - - name: Node.js 0.10 |
45 | | - node-version: "0.10" |
46 | | - npm-i: mocha@3.5.3 nyc@10.3.2 |
47 | | - |
48 | | - - name: Node.js 0.12 |
49 | | - node-version: "0.12" |
50 | | - npm-i: mocha@3.5.3 nyc@10.3.2 |
51 | | - |
52 | | - - name: io.js 1.x |
53 | | - node-version: "1.8" |
54 | | - npm-i: mocha@3.5.3 nyc@10.3.2 |
55 | | - |
56 | | - - name: io.js 2.x |
57 | | - node-version: "2.5" |
58 | | - npm-i: mocha@3.5.3 nyc@10.3.2 |
59 | | - |
60 | | - - name: io.js 3.x |
61 | | - node-version: "3.3" |
62 | | - npm-i: mocha@3.5.3 nyc@10.3.2 |
63 | | - |
64 | | - - name: Node.js 4.x |
65 | | - node-version: "4.9" |
66 | | - npm-i: mocha@5.2.0 nyc@11.9.0 |
67 | | - |
68 | | - - name: Node.js 5.x |
69 | | - node-version: "5.12" |
70 | | - npm-i: mocha@5.2.0 nyc@11.9.0 |
71 | | - |
72 | | - - name: Node.js 6.x |
73 | | - node-version: "6.17" |
74 | | - npm-i: mocha@6.2.2 nyc@14.1.1 |
75 | | - |
76 | | - - name: Node.js 7.x |
77 | | - node-version: "7.10" |
78 | | - npm-i: mocha@6.2.2 nyc@14.1.1 |
79 | | - |
80 | | - - name: Node.js 8.0 |
81 | | - node-version: "8.0" |
82 | | - npm-i: mocha@6.2.2 nyc@14.1.1 |
83 | | - |
84 | | - - name: Node.js 8.x |
85 | | - node-version: "8.17" |
86 | | - npm-i: mocha@7.2.0 nyc@14.1.1 |
87 | | - |
88 | | - # test fail on Node.js 9.x for unknown reasons |
89 | | - # See https://github.com/jshttp/on-finished/pull/49 for more information. |
90 | | - # - name: Node.js 9.x |
91 | | - # node-version: "9.11" |
92 | | - # npm-i: mocha@7.2.0 nyc@14.1.1 |
93 | | - - name: Node.js 10.x |
94 | | - node-version: "10.24" |
95 | | - npm-i: mocha@8.4.0 |
96 | | - |
97 | | - - name: Node.js 11.x |
98 | | - node-version: "11.15" |
99 | | - npm-i: mocha@9.2.2 |
100 | | - |
101 | | - - name: Node.js 12.x |
102 | | - node-version: "12.22" |
103 | | - npm-i: mocha@9.2.2 |
104 | | - |
105 | | - - name: Node.js 13.x |
106 | | - node-version: "13.14" |
107 | | - |
108 | | - - name: Node.js 14.x |
109 | | - node-version: "14.19" |
110 | | - |
111 | | - - name: Node.js 15.x |
112 | | - node-version: "15.14" |
113 | | - |
114 | | - - name: Node.js 16.x |
115 | | - node-version: "16.15" |
116 | | - |
117 | | - - name: Node.js 17.x |
118 | | - node-version: "17.9" |
119 | | - |
120 | | - - name: Node.js 18.x |
121 | | - node-version: "18.1" |
| 41 | + # Node.js release schedule: https://nodejs.org/en/about/releases/ |
| 42 | + node-version: [18, 19, 20, 21, 22, 23, 24] |
122 | 43 |
|
123 | 44 | steps: |
124 | | - - uses: actions/checkout@v2 |
125 | | - |
126 | | - - name: Install Node.js ${{ matrix.node-version }} |
127 | | - shell: bash -eo pipefail -l {0} |
128 | | - run: | |
129 | | - nvm install --default ${{ matrix.node-version }} |
130 | | - if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then |
131 | | - nvm install --alias=npm 0.10 |
132 | | - nvm use ${{ matrix.node-version }} |
133 | | - sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")" |
134 | | - npm config set strict-ssl false |
135 | | - fi |
136 | | - dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH" |
137 | | -
|
138 | | - - name: Configure npm |
139 | | - run: npm config set shrinkwrap false |
140 | | - |
141 | | - - name: Remove npm module(s) ${{ matrix.npm-rm }} |
142 | | - run: npm rm --silent --save-dev ${{ matrix.npm-rm }} |
143 | | - if: matrix.npm-rm != '' |
144 | | - |
145 | | - - name: Install npm module(s) ${{ matrix.npm-i }} |
146 | | - run: npm install --save-dev ${{ matrix.npm-i }} |
147 | | - if: matrix.npm-i != '' |
148 | | - |
149 | | - - name: Setup Node.js version-specific dependencies |
150 | | - shell: bash |
151 | | - run: | |
152 | | - # eslint for linting |
153 | | - # - remove on Node.js < 12 |
154 | | - if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; then |
155 | | - node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \ |
156 | | - grep -E '^eslint(-|$)' | \ |
157 | | - sort -r | \ |
158 | | - xargs -n1 npm rm --silent --save-dev |
159 | | - fi |
160 | | -
|
161 | | - - name: Install Node.js dependencies |
162 | | - run: npm install |
163 | | - |
164 | | - - name: List environment |
165 | | - id: list_env |
166 | | - shell: bash |
167 | | - run: | |
168 | | - echo "node@$(node -v)" |
169 | | - echo "npm@$(npm -v)" |
170 | | - npm -s ls ||: |
171 | | - (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }' |
172 | | -
|
173 | | - - name: Run tests |
174 | | - shell: bash |
175 | | - run: | |
176 | | - if npm -ps ls nyc | grep -q nyc; then |
177 | | - npm run test-ci |
178 | | - cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov" |
179 | | - else |
180 | | - npm test |
181 | | - fi |
182 | | -
|
183 | | - - name: Lint code |
184 | | - if: steps.list_env.outputs.eslint != '' |
185 | | - run: npm run lint |
186 | | - |
187 | | - - name: Collect code coverage |
188 | | - if: steps.list_env.outputs.nyc != '' |
189 | | - run: | |
190 | | - if [[ -d ./coverage ]]; then |
191 | | - mv ./coverage "./${{ matrix.name }}" |
192 | | - mkdir ./coverage |
193 | | - mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}" |
194 | | - fi |
195 | | -
|
196 | | - - name: Upload code coverage |
197 | | - uses: actions/upload-artifact@v2 |
198 | | - if: steps.list_env.outputs.nyc != '' |
199 | | - with: |
200 | | - name: coverage |
201 | | - path: ./coverage |
202 | | - retention-days: 1 |
| 45 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 46 | + |
| 47 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 48 | + with: |
| 49 | + node-version: ${{ matrix.node-version }} |
| 50 | + check-latest: true |
| 51 | + |
| 52 | + - name: Install Node.js dependencies |
| 53 | + run: npm install |
| 54 | + |
| 55 | + - name: Run tests |
| 56 | + run: npm run test-ci |
| 57 | + |
| 58 | + - name: Upload code coverage |
| 59 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 60 | + with: |
| 61 | + name: coverage-node-${{ matrix.node-version }} |
| 62 | + path: ./coverage/lcov.info |
| 63 | + retention-days: 1 |
203 | 64 |
|
204 | 65 | coverage: |
205 | 66 | needs: test |
206 | 67 | runs-on: ubuntu-latest |
| 68 | + permissions: |
| 69 | + contents: read |
| 70 | + checks: write |
207 | 71 | steps: |
208 | | - - uses: actions/checkout@v2 |
209 | | - |
210 | | - - name: Install lcov |
211 | | - shell: bash |
212 | | - run: sudo apt-get -y install lcov |
213 | | - |
214 | | - - name: Collect coverage reports |
215 | | - uses: actions/download-artifact@v2 |
216 | | - with: |
217 | | - name: coverage |
218 | | - path: ./coverage |
219 | | - |
220 | | - - name: Merge coverage reports |
221 | | - shell: bash |
222 | | - run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/lcov.info |
223 | | - |
224 | | - - name: Upload coverage report |
225 | | - uses: coverallsapp/github-action@master |
226 | | - with: |
227 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 73 | + |
| 74 | + - name: Install lcov |
| 75 | + shell: bash |
| 76 | + run: sudo apt-get -y install lcov |
| 77 | + |
| 78 | + - name: Collect coverage reports |
| 79 | + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 |
| 80 | + with: |
| 81 | + path: ./coverage |
| 82 | + pattern: coverage-node-* |
| 83 | + |
| 84 | + - name: Merge coverage reports |
| 85 | + shell: bash |
| 86 | + run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info |
| 87 | + |
| 88 | + - name: Upload coverage report |
| 89 | + uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6 |
| 90 | + with: |
| 91 | + file: ./lcov.info |
0 commit comments