Skip to content

Commit c2361d5

Browse files
committed
feat(ci): diff coverage report
also creates coverage badge
1 parent 817f62e commit c2361d5

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

.github/workflows/pytest.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
name: Pytest
22

33
on:
4-
- push
5-
- pull_request
4+
pull_request:
5+
push:
6+
branches:
7+
- "main"
68

79
jobs:
810
pytest:
911
runs-on: ubuntu-latest
12+
permissions:
13+
# Gives the action the necessary permissions for publishing new
14+
# comments in pull requests.
15+
pull-requests: write
16+
# Gives the action the necessary permissions for pushing data to the
17+
# python-coverage-comment-action branch, and for editing existing
18+
# comments (to avoid publishing multiple comments in the same PR)
19+
contents: write
1020
steps:
1121
- name: Check out code
1222
uses: actions/checkout@v3
@@ -28,8 +38,9 @@ jobs:
2838
- name: Run tests
2939
run: ./tests/run.sh
3040

31-
- name: Upload coverage report
32-
uses: actions/upload-artifact@v3
41+
- name: Coverage comment
42+
uses: py-cov-action/python-coverage-comment-action@v3
3343
with:
34-
name: coverage-report
35-
path: ./tests/coverage
44+
GITHUB_TOKEN: ${{ github.token }}
45+
MINIMUM_GREEN: 90
46+
MINIMUM_ORANGE: 80

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ include = '\.pyi?$'
4545

4646
[tool.coverage.run]
4747
branch = true
48+
relative_files = true
4849
source = ["compiler_admin"]
4950

5051
[tool.pyright]

0 commit comments

Comments
 (0)