@@ -57,33 +57,69 @@ jobs:
57
57
- name : Lint
58
58
run : poetry run ruff check .
59
59
60
- - name : Run pytest
61
- run : poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py --basetemp=tests/tmp
60
+ - name : Run pytest without coverage
61
+ if : matrix.os != 'ubuntu-latest'
62
+ run : poetry run pytest tests end_to_end_tests/test_end_to_end.py --basetemp=tests/tmp
62
63
env :
63
64
TASKIPY : true
64
65
65
- - name : Generate coverage report
66
- shell : bash
67
- run : poetry run coverage xml -o coverage-${{ matrix.os }}-${{ matrix.python }}.xml
66
+ - name : Run pytest with coverage
67
+ if : matrix.os == 'ubuntu-latest'
68
+ run : poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py --basetemp=tests/tmp
69
+ env :
70
+ TASKIPY : true
71
+
72
+ - run : mv .coverage .coverage.${{ matrix.python }}
73
+ if : matrix.os == 'ubuntu-latest'
68
74
69
75
- name : Store coverage report
70
76
77
+ if : matrix.os == 'ubuntu-latest'
71
78
with :
72
- name : coverage-${{ matrix.os }}-${{ matrix.python }}
73
- path : coverage-${{ matrix.os }}-${{ matrix.python }}.xml
79
+ name : coverage-${{ matrix.python }}
80
+ path : .coverage.${{ matrix.python }}
81
+ if-no-files-found : error
74
82
75
- upload_coverage :
83
+ coverage :
84
+ name : Combine & check coverage
76
85
needs : test
77
86
runs-on : ubuntu-latest
78
87
steps :
79
88
89
+ - uses : actions/setup-python@v4
90
+ with :
91
+ python-version : " 3.12"
80
92
- name : Download coverage reports
81
- uses : actions/download-artifact@v4.0 .0
93
+ uses : actions/download-artifact@v4.1 .0
82
94
with :
83
- path : coverage-report
84
-
95
+ merge-multiple : true
96
+
97
+ - name : Create Virtual Environment
98
+ run : python -m venv .venv
99
+
100
+ - name : Combine coverage & fail if it's <100%.
101
+ run : |
102
+ # Install coverage
103
+ .venv/bin/pip install --upgrade coverage[toml]
104
+
105
+ # Find all of the downloaded coverage reports and combine them
106
+ .venv/bin/python -m coverage combine
107
+
108
+ # Create html report
109
+ .venv/bin/python -m coverage html --skip-covered --skip-empty
110
+
111
+ # Report in Markdown and write to summary.
112
+ .venv/bin/python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
113
+
114
+ # Report again and fail if under 100%.
115
+ .venv/bin/python -m coverage report --fail-under=100
116
+
117
+ - name : Upload HTML report if check failed.
118
+
85
119
with :
86
- files : " coverage-report/**/*.xml"
120
+ name : html-report
121
+ path : htmlcov
122
+ if : ${{ failure() }}
87
123
88
124
integration :
89
125
name : Integration Tests
0 commit comments