9090 make install
9191 make install-test-requirements
9292
93+ - name : Reinstall in editable mode for coverage
94+ run : pip install -e .
95+
9396 - name : Run API smoke tests
94- run : |
97+ run : >-
9598 python -m pytest tests/test_api/ -v --tb=short -p no:warnings
99+ --cov=gradient_free_optimizers --cov-report=
100+
101+ - name : Rename coverage data
102+ run : mv .coverage .coverage.api-smoke
103+
104+ - name : Upload coverage data
105+ uses : actions/upload-artifact@v4
106+ with :
107+ name : coverage-api-smoke
108+ path : .coverage.api-smoke
109+ include-hidden-files : true
96110
97111 # ===========================================================================
98112 # STAGE 3a: Main Tests - OS Matrix
@@ -148,9 +162,26 @@ jobs:
148162 python -m pip install "numpy>=2.0,<3.0" "pandas>=2.0,<3.0"
149163 fi
150164
165+ - name : Reinstall in editable mode for coverage
166+ if : matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' && matrix.numpy-version == '2'
167+ run : pip install -e .
168+
151169 - name : Run main tests
152- run : |
170+ run : >-
153171 python -m pytest tests/test_main/ -v --tb=short -p no:warnings
172+ ${{ matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' && matrix.numpy-version == '2' && '--cov=gradient_free_optimizers --cov-report=' || '' }}
173+
174+ - name : Rename coverage data
175+ if : matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' && matrix.numpy-version == '2'
176+ run : mv .coverage .coverage.test-matrix
177+
178+ - name : Upload coverage data
179+ if : matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' && matrix.numpy-version == '2'
180+ uses : actions/upload-artifact@v4
181+ with :
182+ name : coverage-test-matrix
183+ path : .coverage.test-matrix
184+ include-hidden-files : true
154185
155186 # ===========================================================================
156187 # STAGE 3b: Dependency Isolation Tests - No sklearn
@@ -247,7 +278,7 @@ jobs:
247278 coverage :
248279 name : Coverage Report
249280 runs-on : ubuntu-latest
250- needs : [test-matrix] # Also depends on: test-no-sklearn , test-no-scipy (currently disabled)
281+ needs : [api-smoke-tests , test-matrix]
251282 steps :
252283 - name : Checkout code
253284 uses : actions/checkout@v4
@@ -257,23 +288,25 @@ jobs:
257288 with :
258289 python-version : " 3.11"
259290
260- - name : Install dependencies
261- run : |
262- python -m pip install --upgrade pip
263- python -m pip install build
264- make install
265- make install-test-requirements
291+ - name : Install coverage
292+ run : pip install "coverage[toml]"
293+
294+ - name : Download all coverage data
295+ uses : actions/download-artifact@v4
296+ with :
297+ pattern : coverage-*
298+ merge-multiple : true
266299
267- - name : Run tests with coverage
300+ - name : Combine coverage data
268301 run : |
269- python -m pytest tests/test_main/ tests/test_api/ \
270- --cov=gradient_free_optimizers \
271- --cov-report=term-missing \
272- --cov-report=xml \
273- -p no:warnings
274-
275- - name : Coverage Summary Report
276- uses : irongut/CodeCoverageSummary@v1.3.0
302+ coverage combine
303+ coverage report --show-missing
304+ coverage xml
305+
306+ - name : Upload coverage to Codecov
307+ uses : codecov/codecov-action@v5
277308 with :
278- filename : coverage.xml
279- badge : true
309+ token : ${{ secrets.CODECOV_TOKEN }}
310+ files : ./coverage.xml
311+ fail_ci_if_error : false
312+ verbose : true
0 commit comments