Skip to content

Commit

Permalink
ci(coverage): add workflow and badges for test and coverage reports
Browse files Browse the repository at this point in the history
  • Loading branch information
kieran-mackle committed Jul 5, 2024
1 parent 6e16c66 commit 210b570
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,32 @@ jobs:

- name: Install packages
run: |
git config --global url."https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github".insteadOf https://github
python -m pip install --upgrade pip
pip install coverage-badge
pip install pytest
pip install pytest-cov
pip install pytest-html
pip install ./
- name: Test with pytest
run: |
pytest tests
pytest --cov=pysagas --cov-report xml --cov-report html --html=pytest_report.html --self-contained-html tests/
- name: Generate coverage badge
run: |
coverage-badge -f -o coverage.svg
- name: Clean up and organise
run: |
mkdir coverage
mv htmlcov/* coverage/
mkdir deploy
mv coverage deploy/
mv coverage.svg deploy/
mv pytest_report.html deploy/
- name: Publish to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: deploy
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
<img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg">
</a>

<a>
<img src="https://github.com/kieran-mackle/pysagas/actions/workflows/tests.yml/badge.svg" alt="Test Status" class="center">
<a href="https://kieran-mackle.github.io/pysagas/pytest_report">
<img src="https://github.com/kieran-mackle/pysagas/actions/workflows/tests.yml/badge.svg" alt="Test Status" >
</a>

<a href="https://kieran-mackle.github.io/pysagas/coverage">
<img src="https://github.com/kieran-mackle/pysagas/raw/gh-pages/coverage.svg?raw=true" alt="Test Coverage" >
</a>

</p>
Expand Down

0 comments on commit 210b570

Please sign in to comment.