Skip to content

Commit badd6b2

Browse files
committed
build: fix code coverage aggregate upload
1 parent 96b448a commit badd6b2

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

.github/workflows/ci.yml

+32-7
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ jobs:
162162
run: |
163163
if npm -ps ls nyc | grep -q nyc; then
164164
npm run test-ci
165+
cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov"
165166
else
166167
npm test
167168
fi
@@ -171,19 +172,43 @@ jobs:
171172
run: npm run lint
172173

173174
- name: Collect code coverage
174-
uses: coverallsapp/github-action@master
175+
if: steps.list_env.outputs.nyc != ''
176+
run: |
177+
if [[ -d ./coverage ]]; then
178+
mv ./coverage "./${{ matrix.name }}"
179+
mkdir ./coverage
180+
mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}"
181+
fi
182+
183+
- name: Upload code coverage
184+
uses: actions/upload-artifact@v2
175185
if: steps.list_env.outputs.nyc != ''
176186
with:
177-
github-token: ${{ secrets.GITHUB_TOKEN }}
178-
flag-name: run-${{ matrix.test_number }}
179-
parallel: true
187+
name: coverage
188+
path: ./coverage
189+
retention-days: 1
180190

181191
coverage:
182192
needs: test
183193
runs-on: ubuntu-latest
184194
steps:
185-
- name: Uploade code coverage
195+
- uses: actions/checkout@v2
196+
197+
- name: Install lcov
198+
shell: bash
199+
run: sudo apt-get -y install lcov
200+
201+
- name: Collect coverage reports
202+
uses: actions/download-artifact@v2
203+
with:
204+
name: coverage
205+
path: ./coverage
206+
207+
- name: Merge coverage reports
208+
shell: bash
209+
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/lcov.info
210+
211+
- name: Upload coverage report
186212
uses: coverallsapp/github-action@master
187213
with:
188-
github-token: ${{ secrets.github_token }}
189-
parallel-finished: true
214+
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)