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