@@ -180,7 +180,7 @@ jobs:
180180
181181 - name : Set up Python ${{ matrix.python-version }}
182182 run : uv python install ${{ matrix.python-version }}
183-
183+
184184 - name : Check formatting
185185 if : ${{ matrix.group == 1 && matrix.python-version == '3.11' }}
186186 run : ./format.sh check
@@ -198,17 +198,70 @@ jobs:
198198 sed -i '/def _launch/a\ \ \ \ \ \ \ \ raise Exception("fork is not allowed.")' /home/runner/.local/share/uv/python/cpython-${{ matrix.python-version }}.*-linux-x86_64-gnu/lib/python${{ matrix.python-version }}/multiprocessing/popen_fork.py
199199 cat /home/runner/.local/share/uv/python/cpython-${{ matrix.python-version }}.*-linux-x86_64-gnu/lib/python${{ matrix.python-version }}/multiprocessing/popen_fork.py
200200
201+ - name : Python tests (with coverage)
202+ if : ${{ matrix.python-version == '3.11' }}
203+ timeout-minutes : 30
204+ env :
205+ PYTHON_VERSION : ${{ matrix.python-version }}
206+ COVERAGE_FILE : " ~/.local/share/coverage/${{ matrix.group }}.coverage"
207+ run : ./test.sh --splits 3 --group ${{ matrix.group }} --splitting-algorithm least_duration --cov=webknossos --cov-report=
208+
201209 - name : Python tests
210+ if : ${{ matrix.python-version != '3.11' }}
202211 timeout-minutes : 30
203212 env :
204213 PYTHON_VERSION : ${{ matrix.python-version }}
205214 run : ./test.sh --splits 3 --group ${{ matrix.group }} --splitting-algorithm least_duration
206215
216+ - name : Persist coverage reports
217+ if : ${{ matrix.python-version == '3.11' }}
218+ uses : actions/upload-artifact@v4
219+ with :
220+ name : coverage-report-${{ matrix.group }}
221+ path : " ~/.local/share/coverage/${{ matrix.group }}.coverage"
222+ retention-days : 1 # Automatically deletes after 1 day
223+
207224 - name : Check if git is dirty
208225 run : |
209226 git diff --no-ext-diff --exit-code
210227 [[ -z $(git status -s) ]]
211228
229+ coverage_report :
230+ needs : [webknossos_linux]
231+ if : success()
232+ runs-on : ubuntu-latest
233+ defaults :
234+ run :
235+ working-directory : webknossos
236+ steps :
237+ - uses : actions/checkout@v3
238+
239+ - name : Install coverage.py
240+ run : pip install coverage
241+
242+ - name : Download all coverage reports
243+ uses : actions/download-artifact@v4
244+ with :
245+ path : ~/coverage-files
246+
247+ - name : Generate coverage report
248+ env :
249+ COVERAGE_FILE : " ~/coverage-files/result.coverage"
250+ run : |
251+ coverage combine ~/coverage-files/**/*.coverage
252+ coverage xml -i -o ~/coverage-files/result.xml
253+
254+ - name : Report coverage
255+ 256+ with :
257+ coverageFile : /home/runner/coverage-files/result.xml
258+ token : ${{ secrets.GITHUB_TOKEN }}
259+ thresholdAll : 0.8
260+ thresholdNew : 0.8
261+
262+ - name : Cleanup temporary files
263+ run : rm -rf ~/coverage-files
264+
212265 webknossos_cli_docker :
213266 needs : [cluster_tools, webknossos_linux]
214267 if : |
0 commit comments