Skip to content

Commit 816fba6

Browse files
committed
Add coverage support
1 parent d1db290 commit 816fba6

5 files changed

Lines changed: 39 additions & 3 deletions

File tree

.github/actions/nox-run/action.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,10 @@ runs:
2121
env:
2222
UV_LINK_MODE: copy
2323
shell: bash
24+
25+
- name: upload coverage artifact
26+
if: contains(inputs.nox-session, 'pytest')
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: coverage-${{ inputs.nox-session }}
30+
path: ci/coverage/${{ inputs.nox-session }}.xml

.github/workflows/nox.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}
1313
cancel-in-progress: true
1414

15+
16+
permissions:
17+
contents: read # for actions/checkout
18+
id-token: write # For codecov OIDC
19+
20+
1521
jobs:
1622
generate-matrix:
1723
runs-on: ubuntu-24.04
@@ -111,3 +117,26 @@ jobs:
111117
- uses: ./.github/actions/nox-run
112118
with:
113119
nox-session: ${{ matrix.session }}
120+
121+
122+
codecov:
123+
needs: [nox-other, nox-pg, nox-mssql]
124+
runs-on: ubuntu-latest
125+
126+
steps:
127+
# Codecov action says we have to have done a checkout
128+
- name: Checkout
129+
uses: actions/checkout@v4
130+
131+
- uses: actions/download-artifact@v5
132+
with:
133+
path: ci/github-coverage
134+
merge-multiple: true
135+
136+
- name: Coverage files
137+
run: ls -R ci/
138+
139+
- uses: codecov/codecov-action@v5
140+
with:
141+
use_oidc: true
142+
files: ci/github-coverage/*.xml

ci/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
artifacts
22
test-reports
3+
coverage

noxfile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ def pytest_run(session: Session, *args, **env):
2222
'--strict-markers',
2323
'--cov',
2424
'--cov-config=.coveragerc',
25-
'--cov-report=xml',
25+
f'--cov-report=xml:{package_path}/ci/coverage/{session.name}.xml',
2626
'--no-cov-on-fail',
27-
f'--junit-xml={package_path}/ci/test-reports/{session.name}.pytests.xml',
2827
'tests/webgrid_tests',
2928
*args,
3029
*session.posargs,

tasks/gh-nox-sessions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# mise description='Nox session list for GH CI'
2+
# mise description='Nox session groups for GH CI'
33
import json
44
from os import environ
55

0 commit comments

Comments
 (0)