diff --git a/.gitea/workflows/check_code_in_sonarqube.yaml b/.gitea/workflows/check_code_in_sonarqube.yaml index 93602fe..65fde43 100644 --- a/.gitea/workflows/check_code_in_sonarqube.yaml +++ b/.gitea/workflows/check_code_in_sonarqube.yaml @@ -17,6 +17,20 @@ jobs: with: fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + pip install -r requirements.txt + + - name: Run tests with coverage + run: | + coverage run --source='.' manage.py test + coverage xml + - name: Set up JDK 17 uses: actions/setup-java@v3 with: @@ -49,4 +63,5 @@ jobs: -Dsonar.projectKey=${{ github.event.repository.name }} \ -Dsonar.sources=. \ -Dsonar.host.url=${SONAR_HOST_URL} \ - -Dsonar.token=${SONAR_TOKEN} \ No newline at end of file + -Dsonar.token=${SONAR_TOKEN} \ + -Dsonar.python.coverage.reportPaths=coverage.xml \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 7447a4e..601020a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -33,3 +33,4 @@ sqlparse==0.5.3 urllib3==2.5.0 wcwidth==0.2.13 bleach==6.1.0 +coverage==7.6.1