From badd6b260efae2f0dd69f138a0f28d2b8e46f985 Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Fri, 28 Jan 2022 00:18:42 -0500 Subject: [PATCH] build: fix code coverage aggregate upload --- .github/workflows/ci.yml | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 518e9d8b..7dcd12ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,6 +162,7 @@ jobs: run: | if npm -ps ls nyc | grep -q nyc; then npm run test-ci + cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov" else npm test fi @@ -171,19 +172,43 @@ jobs: run: npm run lint - name: Collect code coverage - uses: coverallsapp/github-action@master + if: steps.list_env.outputs.nyc != '' + run: | + if [[ -d ./coverage ]]; then + mv ./coverage "./${{ matrix.name }}" + mkdir ./coverage + mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}" + fi + + - name: Upload code coverage + uses: actions/upload-artifact@v2 if: steps.list_env.outputs.nyc != '' with: - github-token: ${{ secrets.GITHUB_TOKEN }} - flag-name: run-${{ matrix.test_number }} - parallel: true + name: coverage + path: ./coverage + retention-days: 1 coverage: needs: test runs-on: ubuntu-latest steps: - - name: Uploade code coverage + - uses: actions/checkout@v2 + + - name: Install lcov + shell: bash + run: sudo apt-get -y install lcov + + - name: Collect coverage reports + uses: actions/download-artifact@v2 + with: + name: coverage + path: ./coverage + + - name: Merge coverage reports + shell: bash + run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/lcov.info + + - name: Upload coverage report uses: coverallsapp/github-action@master with: - github-token: ${{ secrets.github_token }} - parallel-finished: true + github-token: ${{ secrets.GITHUB_TOKEN }}