Skip to content
Snippets Groups Projects
Commit 044146b4 authored by Klaas Kliffen's avatar Klaas Kliffen :satellite:
Browse files

Merge branch 'add_coverage_in_pipeline' into 'main'

CWG-57: Add coverage in pipeline and badges to readmes

See merge request python-package!16
parents edd53340 81d18e31
Branches
No related tags found
1 merge request!16CWG-57: Add coverage in pipeline and badges to readmes
Pipeline #49673 passed
Pipeline: Python Package

#49674

    ...@@ -8,6 +8,19 @@ trigger_prepare: ...@@ -8,6 +8,19 @@ trigger_prepare:
    include: "{{cookiecutter.project_slug}}/.prepare.gitlab-ci.yml" include: "{{cookiecutter.project_slug}}/.prepare.gitlab-ci.yml"
    default: default:
    # Bootstrap Cookiecutter template to test provided ci pipeline template
    before_script: before_script:
    - python --version # For debugging - python --version # For debugging
    - cookiecutter --no-input --overwrite-if-exists -output-dir . - cookiecutter --no-input --overwrite-if-exists --output-dir . .
    - cd my_awesome_app
    - git init
    # Override artifact directories
    run_unit_tests_coverage:
    artifacts:
    reports:
    coverage_report:
    coverage_format: cobertura
    path: my_awesome_app/coverage.xml
    paths:
    - my_awesome_app/htmlcov/*
    # Example Python Package # Example Python Package
    ![Build status](https://git.astron.nl/templates/python-package/badges/main/pipeline.svg)
    ![Test coverage](https://git.astron.nl/templates/python-package/badges/main/coverage.svg)
    An example repository of an CI/CD pipeline for building, testing and publishing a python package. An example repository of an CI/CD pipeline for building, testing and publishing a python package.
    If you find some missing functionality with regards to CI/CD, testing, linting or something else, feel free to make a merge request with the proposed changes. If you find some missing functionality with regards to CI/CD, testing, linting or something else, feel free to make a merge request with the proposed changes.
    ......
    ...@@ -75,6 +75,7 @@ run_unit_tests_coverage: ...@@ -75,6 +75,7 @@ run_unit_tests_coverage:
    stage: test stage: test
    script: script:
    - tox -e coverage - tox -e coverage
    coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
    artifacts: artifacts:
    reports: reports:
    coverage_report: coverage_report:
    ......
    # {{cookiecutter.project_name}} # {{cookiecutter.project_name}}
    <!-- TODO: replace -->
    ![Build status](https://git.astron.nl/templates/python-package/badges/main/pipeline.svg)
    ![Test coverage](https://git.astron.nl/templates/python-package/badges/main/coverage.svg)
    <!-- ![Latest release](https://git.astron.nl/templates/python-package/badges/main/release.svg) -->
    An example repository of an CI/CD pipeline for building, testing and publishing a python package. An example repository of an CI/CD pipeline for building, testing and publishing a python package.
    ## Installation ## Installation
    ......
    ...@@ -22,7 +22,7 @@ commands = ...@@ -22,7 +22,7 @@ commands =
    [testenv:coverage] [testenv:coverage]
    commands = commands =
    {envpython} --version {envpython} --version
    {envpython} -m pytest --cov-report xml --cov-report html --cov={{cookiecutter.project_slug}} {envpython} -m pytest --cov-report term --cov-report xml --cov-report html --cov={{cookiecutter.project_slug}}
    # Use generative name and command prefixes to reuse the same virtualenv # Use generative name and command prefixes to reuse the same virtualenv
    # for all linting jobs. # for all linting jobs.
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment