Integrate codecov.io

We publish the test coverage reporting to codecov.io
This commit is contained in:
Alexander Hess 2024-09-10 03:10:26 +02:00
commit 3f8b5cb146
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
4 changed files with 23 additions and 1 deletions

View file

@ -1,6 +1,7 @@
"""Maintenance tasks run in isolated environments."""
import collections
import os
import pathlib
import random
import re
@ -311,7 +312,20 @@ def test_coverage_report(session: nox.Session) -> None:
install_pinned(session, "coverage")
session.run("python", "-m", "coverage", "combine")
session.run("python", "-m", "coverage", "report", "--fail-under=100")
if codecov_token := os.environ.get("CODECOV_TOKEN"):
install_unpinned(session, "codecov-cli")
session.run("python", "-m", "coverage", "xml", "--fail-under=0")
session.run(
"codecovcli",
"upload-process",
"--fail-on-error",
"--file=.cache/coverage/report.xml",
f"--token={codecov_token}",
)
else:
session.run("python", "-m", "coverage", "report", "--fail-under=100")
@nox_session(name="test-docstrings", python=MAIN_PYTHON)