Use codecov for tests coverage info

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko 2024-01-10 13:33:25 -08:00
parent 90e58b7b9f
commit dd07aefac5
1 changed files with 10 additions and 23 deletions

View File

@ -1,6 +1,6 @@
name: Coverage
on:
pull_request_target:
pull_request:
jobs:
coverage:
@ -37,34 +37,21 @@ jobs:
grcov . \
--source-dir . \
--binary-path ./target/debug/ \
--branch --ignore-not-existing \
--output-types html,markdown \
--branch \
--ignore-not-existing \
--output-types markdown,lcov \
--keep-only 'crates/*' \
--output-path ./target/coverage/
- uses: actions/upload-artifact@v4
- name: Upload coverage data
uses: codecov/codecov-action@v3
with:
name: coverage
path: target/coverage/html/
if-no-files-found: error
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
files: ./target/coverage/lcov
verbose: true
- name: Publish job summary
run: |
echo "# Coverage" >> $GITHUB_STEP_SUMMARY
cat target/coverage/markdown.md >> $GITHUB_STEP_SUMMARY
- run: echo "coverage=$(cat target/coverage/markdown.md | grep 'Total coverage')" >> $GITHUB_OUTPUT
id: coverage
- name: Create commit status
uses: actions/github-script@v7
if: success()
with:
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: 'success',
description: '${{ steps.coverage.outputs.coverage }}',
})