diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 03e3551..749a393 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -261,6 +261,36 @@ jobs: docker push ghcr.io/$image_name + - name: Upload unit-test coverage to Codecov + uses: codecov/codecov-action@v5 # https://github.com/codecov/codecov-action + if: ${{ github.ref_name == 'main' || github.event_name == 'pull_request' }} + with: + files: .temp/coverage-unit.xml + flags: unit-tests + env_vars: OS,PYTHON + name: gha-u-${{ matrix.PYTHON_VERSION }}-${{ matrix.os }} + env: + OS: ${{ matrix.os }} + PYTHON: ${{ matrix.PYTHON_VERSION }} + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + slug: ${{ github.repository }} + + + - name: Upload integration-test coverage to Codecov + uses: codecov/codecov-action@v5 # https://github.com/codecov/codecov-action + if: ${{ github.ref_name == 'main' || github.event_name == 'pull_request' }} + with: + files: .temp/coverage-integration.xml + flags: integration-tests + env_vars: OS,PYTHON + name: gha-i-${{ matrix.PYTHON_VERSION }}-${{ matrix.os }} + env: + OS: ${{ matrix.os }} + PYTHON: ${{ matrix.PYTHON_VERSION }} + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + slug: ${{ github.repository }} + + ########################################################### publish-release: ########################################################### diff --git a/README.md b/README.md index 20496e2..d10a496 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ [![Build Status](https://github.com/Second-Hand-Friends/kleinanzeigen-bot/actions/workflows/build.yml/badge.svg)](https://github.com/Second-Hand-Friends/kleinanzeigen-bot/actions/workflows/build.yml) [![License](https://img.shields.io/github/license/Second-Hand-Friends/kleinanzeigen-bot.svg?color=blue)](LICENSE.txt) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.1%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) -[![Maintainability](https://api.codeclimate.com/v1/badges/77b4ed9cc0dd8cfe373c/maintainability)](https://codeclimate.com/github/Second-Hand-Friends/kleinanzeigen-bot/maintainability) +[![codecov](https://codecov.io/github/Second-Hand-Friends/kleinanzeigen-bot/graph/badge.svg?token=SKLDTVWHVK)](https://codecov.io/github/Second-Hand-Friends/kleinanzeigen-bot) + **Feedback and high-quality pull requests are highly welcome!** diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..9f58c70 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,12 @@ +# https://docs.codecov.com/docs/codecovyml-reference +# https://json.schemastore.org/codecov.json +codecov: + branch: main + require_ci_to_pass: true + notify: + wait_for_ci: true + +coverage: + precision: 2 + round: down + range: "65...100" diff --git a/pyproject.toml b/pyproject.toml index fd8cb30..5bd05ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -336,7 +336,10 @@ filterwarnings = [ ] [tool.coverage.run] +# https://coverage.readthedocs.io/en/latest/config.html#run data_file = ".temp/coverage.sqlite" +branch = true # track branch coverage +relative_files = true #####################