Skip to content

Commit ae10c57

Browse files
committed
Fix coverage report
1 parent 7a04132 commit ae10c57

File tree

1 file changed

+55
-9
lines changed

1 file changed

+55
-9
lines changed

.github/workflows/ci.yml

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ jobs:
5757
run: |
5858
uv sync --group testing --all-extras
5959
60+
- run: mkdir coverage
61+
6062
- name: test
6163
run: make test
6264
env:
63-
COVERAGE_FILE: .coverage.${{ runner.os }}-py${{ matrix.python }}
65+
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python }}
6466
CONTEXT: ${{ runner.os }}-py${{ matrix.python }}
6567

6668
- name: uninstall deps
@@ -69,20 +71,64 @@ jobs:
6971
- name: test without deps
7072
run: make test
7173
env:
72-
COVERAGE_FILE: .coverage.${{ runner.os }}-py${{ matrix.python }}-without-deps
74+
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python }}-without-deps
7375
CONTEXT: ${{ runner.os }}-py${{ matrix.python }}-without-deps
7476

75-
- run: uv run coverage combine
76-
- run: uv run coverage xml
77-
78-
- uses: codecov/codecov-action@v4
77+
- name: store coverage files
78+
uses: actions/upload-artifact@v4
7979
with:
80-
file: ./coverage.xml
81-
env_vars: PYTHON,OS
80+
name: coverage-${{ matrix.python }}-${{ runner.os }}
81+
path: coverage
82+
include-hidden-files: true
83+
84+
coverage:
85+
runs-on: ubuntu-latest
86+
needs: [test]
87+
steps:
88+
- uses: actions/checkout@v4
89+
with:
90+
# needed for diff-cover
91+
fetch-depth: 0
92+
93+
- name: get coverage files
94+
uses: actions/download-artifact@v4
95+
with:
96+
merge-multiple: true
97+
path: coverage
98+
99+
- uses: astral-sh/setup-uv@v5
100+
with:
101+
enable-cache: true
102+
103+
- run: uv sync --group testing --all-extras
104+
105+
- run: uv run coverage combine coverage
106+
107+
- run: uv run coverage html --show-contexts --title "Pydantic Settings coverage for ${{ github.sha }}"
108+
109+
- name: Store coverage html
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: coverage-html
113+
path: htmlcov
114+
include-hidden-files: true
115+
116+
- run: uv run coverage xml
117+
118+
- run: uv run diff-cover coverage.xml --html-report index.html
119+
120+
- name: Store diff coverage html
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: diff-coverage-html
124+
path: index.html
125+
126+
- run: uv run coverage report --fail-under 95
127+
- run: uv run diff-cover coverage.xml --fail-under 100
82128

83129
check: # This job does nothing and is only used for the branch protection
84130
if: always()
85-
needs: [lint, test]
131+
needs: [lint, test, coverage]
86132
runs-on: ubuntu-latest
87133

88134
outputs:

0 commit comments

Comments
 (0)