Skip to content

Commit

Permalink
Add Coverage Reports to Pull Requests
Browse files Browse the repository at this point in the history
Add `pytest-cov` dependency to generate lcov coverage reports. Update
the ci_python.yaml workflow to use the mbta action that reports coverage
to a pull request as a comment.
  • Loading branch information
mzappitello authored Apr 3, 2024
1 parent 5c637a3 commit 79f4fac
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 3 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/ci_python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,19 @@ jobs:
- uses: actions/checkout@v3
- uses: ./.github/actions/python_deps

- run: poetry run pytest
# Execute tests and generate coverage report
- name: Run pytest With Coverage
run: |
poetry run pytest \
--cov-report lcov:coverage.info \
--cov-report term-missing \
--cov-branch \
--cov=lamp_py
# Upload Coverage as an Artifact for Subsequent Jobs
- name: Report code coverage
uses: mbta/github-actions-report-lcov@v1
with:
coverage-files: coverage.info
artifact-name: python-code-coverage
github-token: ${{ secrets.GITHUB_TOKEN }}
89 changes: 87 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ black = "^24.3.0"
mypy = "^1.1.1"
pylint = "^3.1.0"
pytest = "^8.0.2"
pytest-cov = "^5.0.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down

0 comments on commit 79f4fac

Please sign in to comment.