Skip to content

CI: report Python coverage and upload it to Codecov - #164

Merged
eriknw merged 2 commits into
GraphBLAS:mainfrom
eriknw:codecov
Nov 26, 2026
Merged

eriknw merged 2 commits into
GraphBLAS:mainfrom
eriknw:codecov

Conversation

@eriknw

@eriknw eriknw commented Nov 25, 2026

Copy link
Copy Markdown
Member

Summary

Every test job ran the tests under coverage, but nothing read the result. This PR makes coverage of the Python code visible: in each job's log, and on Codecov across all 21 jobs. utils.pyx stays untraced. Cython's plugin was compiled out anyway, since line tracing was requested only after the Build step, and on Python 3.14+ coverage's default core can't run the plugin (a CoverageWarning in 9 jobs).

 test.yml, test job
-  Configure coverage: COV="coverage run -a --branch", or plain python where Cython.Coverage won't import
-  Test (CYTHON_COVERAGE=true): $COV -m pytest; $COV test_initialize.py
+  Test: coverage run -a -m pytest; coverage run -a test_initialize.py
   create_headers.py check: coverage run -a create_headers.py
+  Coverage report: coverage report --show-missing; coverage xml
+  Upload coverage to Codecov: codecov-action v7.1.1, coverage.xml, fail_ci_if_error: false
 pyproject.toml [tool.coverage.run]
-  plugins = ["Cython.Coverage"]
+  relative_files = true
+.github/codecov.yml: project and patch statuses are informational

Upload auth:

  • PRs from forks upload without a token.
  • Pushes to main use the repository secret CODECOV_TOKEN.
  • Dependabot PRs get no secrets, so their upload fails, and that doesn't fail the job.

Evidence

  • Before (test run 45658374185, on Update to SS:GB 10.5.3 #163's head): no job reports coverage.
    • Nine jobs (3.14, 3.14t and 3.15 on each OS) warn CoverageWarning: Plugin file tracers (Cython.Coverage.Plugin) aren't supported with SysMonitor.
    • The three 3.15t jobs run the tests without coverage.
  • After, locally (macOS arm64, these steps' commands):
    • Python 3.15.2: 387 passed. coverage report gives 71.4% (branches included). coverage.xml lists files as api/binaryop.py and so on, under the source suitesparse_graphblas.
    • Python 3.15.2t: the same results. The same holds with COVERAGE_CORE=pytrace, which stands in for conda-forge's pure-Python coverage on 3.15t.
  • Hooks: actionlint, zizmor and the workflow schema check pass. Codecov's validator accepts codecov.yml.

Merge Danger

Door: two-way. Revert the commit to undo it.

Blast Radius: CI only.

The package is unaffected. Codecov will post a comment and two informational statuses on PRs.

Every test job ran the tests under coverage, but nothing read the result.
Cython's plugin didn't help either. utils.pyx is compiled before the step
that asked for line tracing, and on Python 3.14+ coverage's default core
can't run the plugin.

Measure the Python code only, without the plugin, with paths relative to
the checkout. Print the report, with missing lines, in a "Coverage report"
step, and upload coverage.xml to Codecov from every job. PRs from forks
upload without a token. Pushes to main need the repository secret
CODECOV_TOKEN, and an upload that fails doesn't fail the job. Codecov's
statuses are informational (.github/codecov.yml).
@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Each upload tried the uploader's gcov, Xcode, Swift and coverage.py plugins
and logged a warning for each one that found nothing, in all 21 jobs. The
"Coverage report" step already writes coverage.xml.
@eriknw

eriknw commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

Alright, let's see if codecov works

@eriknw
eriknw merged commit f404811 into GraphBLAS:main Nov 26, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant