Set up Jenkins Pipeline for coverage reporting.
Jenkinsfile
. It triggers on pushes to the configured branches:
-m module_name
to the upload script. You can upload multiple coverage files using multiple -m
flags.
ACCESS_TOKEN
as the ID.coveragerc
file in the project’s root folder to include all the source files in the test coverage calculation.
Example:
coverage run -m pytest tests/
will count every .py under the workspace as “valid” lines except for those in the omitted directories.coverage xml -o coverage.xml
produces a Cobertura-style report reflecting true coverage over the entire codebase.pip install coverage
ACCESS_TOKEN
credential is correctly configured.coveragerc
configurationecho "Branch: ${env.GIT_BRANCH}"
env.BRANCH_NAME
for multibranch pipelines