88 - " tests/**"
99 - " requirements/**"
1010 - " pyproject.toml"
11+ - " .github/workflows/test-coverage.yml"
12+ - " .gitattributes"
1113 pull_request :
1214 branches : [main, dev]
1315 workflow_dispatch :
6870 run : |
6971 python -m pip install --upgrade pip setuptools wheel
7072 # Install build dependencies first, including meson for f2py
71- pip install build cython>=3.0.0 numpy meson ninja
73+ pip install build " cython>=3.0.0" numpy meson ninja
7274
7375 # Try to install package in development mode, but continue if it fails
7476 echo "=== Attempting to install package ==="
@@ -299,15 +301,22 @@ jobs:
299301 ls -la src/skyborn/gridfill/ || echo "gridfill directory not found"
300302
301303 echo "=== Running tests with coverage ==="
302- # Run all tests, allowing for some failures due to optional Fortran extensions
304+ # Run all tests, but preserve the exit code so later steps can still inspect coverage files.
305+ set +e
303306 pytest tests/ \
304307 --cov=src/skyborn \
305308 --cov-report=xml \
306309 --cov-report=html \
307310 --cov-report=term-missing \
308311 --cov-fail-under=15 \
309- -v --tb=short \
310- || echo "Some tests failed but continuing (likely due to optional Fortran extensions)"
312+ -v --tb=short
313+ pytest_exit=$?
314+ set -e
315+
316+ echo "pytest exit code: $pytest_exit"
317+ if [ "$pytest_exit" -ne 0 ]; then
318+ echo "Pytest reported failures. Coverage upload will continue if coverage.xml exists."
319+ fi
311320
312321 echo "=== Test execution completed ==="
313322
@@ -320,11 +329,24 @@ jobs:
320329 - name : Generate coverage report even if tests failed
321330 if : always()
322331 run : |
323- # If coverage.xml doesn't exist, try to generate it manually
332+ # If coverage.xml doesn't exist, try to generate it from raw coverage data.
324333 if [ ! -f coverage.xml ]; then
325- echo "Attempting to generate coverage report manually..."
326- coverage xml --fail-under=0 || echo "Failed to generate coverage.xml"
334+ if [ -f .coverage ]; then
335+ echo "Attempting to generate coverage report manually from .coverage ..."
336+ coverage xml --fail-under=0
337+ else
338+ echo "Raw .coverage data not found."
339+ fi
340+ fi
341+
342+ - name : Validate coverage report presence
343+ if : always()
344+ run : |
345+ if [ ! -f coverage.xml ]; then
346+ echo "::error::coverage.xml was not generated, so Codecov would show 0% or no data."
347+ exit 1
327348 fi
349+ echo "coverage.xml is present and ready for Codecov upload."
328350
329351 - name : Upload coverage to Codecov
330352 if : always()
0 commit comments