Skip to content

Commit

Permalink
ci: add generation of coverage badge.
Browse files Browse the repository at this point in the history
  • Loading branch information
paquiteau committed Jan 21, 2024
1 parent 732db51 commit 2f43d1e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/workflows/master-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ jobs:
run: |
python -m sphinx docs docs_build
- name: Get the badge from CI
uses: actions/download-artifacts@v2
continue-on-error: true
with:
name: coverage_build
path: docs_build/_static

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,31 @@ jobs:
python -m pip install -e .
- name: Combine coverage
run: coverage combine -a coverage_data/*
run: |
export COVERAGE_FILE=coverage_combined
coverage combine -a coverage_data/*
- name: Upload Combined coverage
uses: actions/upload-artifact@v3
with:
name: coverage_combined
path: coverage_combined

- name: Reports
run: |
export COVERAGE_FILE=coverage_combined
coverage xml
coverage report
echo COVERAGE_PERC=$(coverage report | tail -n 1 | grep -oE [0-9\.]*?% | cut -d '%' -f1) >> $GITHUB_ENV
- name: Create a Coverage Badge
if: ${{github.event_name == 'push'}}
run: |
wget https://img.shields.io/badge/coverage-${{env.COVERAGE_PERC}}%25-darkgreen -O coverage_badge.svg
- name: Upload badge as artifact
if: ${{github.event_name == 'push'}}
uses: actions/upload-artifact@v3
with:
name: coverage_badge
path: coverage_badge.svg

0 comments on commit 2f43d1e

Please sign in to comment.