Export coverage report to workflow summary #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Unit Test via Pytest | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Setup environment | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry config virtualenvs.in-project true | |
- name: Install dependencies | |
run: poetry install --with tests | |
- name: Test with pytest | |
run: | | |
poetry run coverage run -m pytest -v -s | |
- name: Generate coverage report | |
run: | | |
poetry run coverage report -m | |
- name: Export coverage report | |
run: | | |
poetry run coverage xml -o report.xml | |
- name: Code Coverage Report | |
uses: irongut/CodeCoverageSummary@v1.3.0 | |
with: | |
filename: report.xml | |
format: markdown | |
indicators: true | |
output: both | |
- name: Write summary | |
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY |