From 43ba14f6f029483fbe785564df1c9dad1eb2d70f Mon Sep 17 00:00:00 2001 From: olofvndrhr Date: Fri, 22 Dec 2023 14:13:49 +0100 Subject: [PATCH] fix coverage --- .gitea/workflows/sonarqube_python.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/sonarqube_python.yml b/.gitea/workflows/sonarqube_python.yml index b176f6a..a3a267c 100644 --- a/.gitea/workflows/sonarqube_python.yml +++ b/.gitea/workflows/sonarqube_python.yml @@ -13,6 +13,11 @@ on: type: string description: "tests directory" default: "tests" + use-hatch: + required: false + type: bool + description: "use hatch for coverage report" + default: false secrets: sonar-host: @@ -31,15 +36,24 @@ jobs: with: fetch-depth: 0 + - name: get coverage (hatch) + if: ${{ inputs.run-coverage == true && inputs.use-hatch == true }} + run: hatch run default:cov + - name: install requirements - if: ${{ inputs.run-coverage == true }} + if: ${{ inputs.run-coverage == true && inputs.use-hatch == false }} run: pip install -U pytest coverage + - name: install package + if: ${{ inputs.run-coverage == true && inputs.use-hatch == false }} + run: pip install -U . + - name: get coverage - if: ${{ inputs.run-coverage == true }} + if: ${{ inputs.run-coverage == true && inputs.use-hatch == false }} run: | coverage erase coverage run -m pytest --exitfirst --verbose ${{ inputs.tests-dir }} + coverage combine coverage report coverage xml