Skip to content

Commit 4aa733d

Browse files
committed
Add coverage to CI
1 parent 78521e2 commit 4aa733d

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
- name: Setup Python
1717
uses: actions/setup-python@v5
1818
with:
19-
python-version: '3.13'
20-
cache: 'pip'
21-
cache-dependency-path: 'requirements/*.txt'
19+
python-version: "3.13"
20+
cache: "pip"
21+
cache-dependency-path: "requirements/*.txt"
2222
- name: Run tox
2323
id: matrix
2424
run: |
@@ -45,8 +45,8 @@ jobs:
4545
uses: actions/setup-python@v5
4646
with:
4747
python-version: ${{ matrix.python }}
48-
cache: 'pip'
49-
cache-dependency-path: 'requirements/*.txt'
48+
cache: "pip"
49+
cache-dependency-path: "requirements/*.txt"
5050
- name: Run tests
5151
env:
5252
PGHOST: localhost
@@ -57,6 +57,13 @@ jobs:
5757
run: |
5858
pip install $(grep -E "^(tox|tox-uv)==" requirements/local.txt)
5959
tox -e ${{ matrix.tox_env }}
60+
- name: Upload coverage data
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: coverage-data-${{ matrix.tox_env }}
64+
include-hidden-files: true
65+
path: .coverage.*
66+
if-no-files-found: ignore
6067
services:
6168
postgres:
6269
image: postgres:17-alpine
@@ -65,3 +72,30 @@ jobs:
6572
ports:
6673
- 5432:5432
6774
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
75+
76+
coverage:
77+
name: Coverage
78+
runs-on: ubuntu-24.04
79+
needs: test
80+
if: always()
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@v4
84+
with:
85+
persist-credentials: false
86+
ref: ${{ github.event.pull_request.head.sha }}
87+
- name: Setup Python
88+
uses: actions/setup-python@v5
89+
with:
90+
python-version: "3.13"
91+
cache: "pip"
92+
cache-dependency-path: "requirements/*.txt"
93+
- uses: actions/download-artifact@v4
94+
with:
95+
pattern: coverage-data-*
96+
merge-multiple: true
97+
- name: Run coverage
98+
run: |
99+
pip install $(grep -E "^(tox|tox-uv)==" requirements/local.txt)
100+
tox -e coverage
101+
tox -qq exec -e coverage -- coverage report --format=markdown >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)