Skip to content

Commit 354c488

Browse files
committed
ci: add coverage reporting to PRs
1 parent ecb4a9c commit 354c488

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/coverage.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will install dependencies, create coverage tests and run Pytest Coverage Comment
2+
# For more information see: https://github.com/MishaKav/pytest-coverage-comment/
3+
name: pytest-coverage-comment
4+
on:
5+
pull_request:
6+
branches:
7+
- '*'
8+
9+
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
10+
# `contents` is for permission to the contents of the repository.
11+
# `pull-requests` is for permission to pull request
12+
permissions:
13+
contents: write
14+
checks: write
15+
pull-requests: write
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Set up PDM
26+
uses: pdm-project/setup-pdm@v4
27+
28+
- name: Install dependencies
29+
run: |
30+
pdm install
31+
32+
- name: Build coverage file
33+
run: |
34+
pdm run pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=app tests/ | tee pytest-coverage.txt
35+
36+
- name: Pytest coverage comment
37+
uses: MishaKav/pytest-coverage-comment@main
38+
with:
39+
pytest-coverage-path: ./pytest-coverage.txt
40+
junitxml-path: ./pytest.xml

0 commit comments

Comments
 (0)