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
parent 5518837cbc
commit 3f8b5cb146
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
4 changed files with 23 additions and 1 deletions

View file

@ -27,3 +27,5 @@ jobs:
# one for each of the above Python versions,
# before all results are collected together
- run: nox -s test-coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View file

@ -9,6 +9,7 @@ The goal of the `lalib` project is to create
[![Test suite: Status](https://github.com/webartifex/lalib/actions/workflows/tests.yml/badge.svg)](https://github.com/webartifex/lalib/actions/workflows/tests.yml)
[![Test coverage: codecov](https://codecov.io/github/webartifex/lalib/graph/badge.svg?token=J4LWOMVP0R)](https://codecov.io/github/webartifex/lalib)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Type checking: mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
[![Code linting: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

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)

View file

@ -131,6 +131,11 @@ parallel = true
source = ["lalib"]
[tool.coverage.xml]
output = ".cache/coverage/report.xml"
[tool.flake8]