diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 362cb438..a31d1182 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -10,6 +10,9 @@ jobs: build: runs-on: ubuntu-latest + env: + USING_COVERAGE: '3.6' + strategy: max-parallel: 4 matrix: @@ -34,11 +37,22 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt + pip install pytest \ + pytest-cov \ + tensorflow \ + libsvm \ + pybrisque \ + scikit-image - name: Test with pytest run: | - pip install pytest - pip install tensorflow - pip install libsvm - pip install pybrisque - pip install scikit-image - pytest + pytest -x --cov=./piq --cov-report=xml + - name: Upload coverage to Codecov + # Upload codecov reports only from a pipeline for a single version defined in the env variable + if: "contains(env.USING_COVERAGE, matrix.python-version)" + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + flags: unittests + name: codecov-umbrella + fail_ci_if_error: true diff --git a/README.md b/README.md index 54df6a50..26ad33dc 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ [![License][license-shield]][license-url] [![PyPI version][pypi-version-shield]][pypi-version-url] ![CI flake-8 style check][ci-flake-8-style-check-shield] -![CI testing][ci-testing] +![CI testing][ci-testing] +[![codecov][codecov-shield]][codecov-url] [![Quality Gate Status][quality-gate-status-shield]][quality-gate-status-url] [![Maintainability Rating][maintainability-raiting-shield]][maintainability-raiting-url] [![Reliability Rating][reliability-rating-badge]][reliability-rating-url] @@ -479,3 +480,5 @@ Other projects by PhotoSynthesis Team: [maintainability-raiting-url]: https://sonarcloud.io/dashboard?id=photosynthesis-team_photosynthesis.metrics [reliability-rating-badge]: https://sonarcloud.io/api/project_badges/measure?project=photosynthesis-team_photosynthesis.metrics&metric=reliability_rating [reliability-rating-url]:https://sonarcloud.io/dashboard?id=photosynthesis-team_photosynthesis.metrics +[codecov-shield]:https://codecov.io/gh/photosynthesis-team/piq/branch/master/graph/badge.svg +[codecov-url]:https://codecov.io/gh/photosynthesis-team/piq \ No newline at end of file diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..2b3ed867 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,36 @@ +codecov: + require_ci_to_pass: yes + +coverage: + status: + project: + default: + # basic + target: auto + threshold: 5% + base: auto + flags: + - unit + # advanced + branches: master + if_not_found: success + if_ci_failed: error + informational: false + only_pulls: false + + +parsers: + gcov: + branch_detection: + conditional: yes + loop: yes + method: no + macro: no + +comment: + layout: "reach, diff, flags, files" + behavior: default + branches: * + require_changes: false # if true: only post the comment if coverage changes + require_base: no # [yes :: must have a base report to post] + require_head: no # [yes :: must have a head report to post]