Skip to content

Commit

Permalink
build: fix code coverage aggregate upload
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jan 28, 2022
1 parent 96b448a commit badd6b2
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}

0 comments on commit badd6b2

Please sign in to comment.