diff --git a/.github/workflows/python-coverage.yml b/.github/workflows/python-coverage.yml index 016f660..35fe04f 100644 --- a/.github/workflows/python-coverage.yml +++ b/.github/workflows/python-coverage.yml @@ -47,23 +47,62 @@ jobs: run: | python3 -m coverage report - - name: Coverage lcov + - name: Coverage lcov (codecov) run: | python3 -m coverage lcov -o coverage/lcov.info - - name: Upload coverage reports to Codecov with GitHub Action - uses: codecov/codecov-action@v5 + - name: Coverage xml (sonarcloud) + run: | + python3 -m coverage xml -o coverage/coverage.xml + + - name: Upload coverage artifact + uses: actions/upload-artifact@v4 with: - token: ${{ secrets.CODECOV_TOKEN }} # required - verbose: true # optional (default = false) + name: coverage-report + path: coverage - - name: Coverage XML - run: | - python3 -m coverage xml + codecov: + name: Upload to Codecov + runs-on: ubuntu-24.04 + needs: coverage + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + fetch-depth: 0 + - name: Download coverage artifact + uses: actions/download-artifact@v5 + with: + name: coverage-report + path: coverage + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@3cb13a12348ef4ffcf9783ac0f74954f92113e33 + with: + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + + sonarqube: + name: Analyze with SonarQube + runs-on: ubuntu-24.04 + needs: coverage + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Download coverage artifact + uses: actions/download-artifact@v5 + with: + name: coverage-report + path: coverage - - name: Analyze with SonarQube / SonarCloud - uses: SonarSource/sonarqube-scan-action@master + - name: SonarQube Scan + # yamllint disable-line rule:line-length + uses: SonarSource/sonarqube-scan-action@8c71dc039c2dd71d3821e89a2b58ecc7fee6ced9 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - # Needed to get PR information, if any GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 666104b..f897de8 100644 --- a/Makefile +++ b/Makefile @@ -139,6 +139,9 @@ test: env dependencies coverage: test ${RUNTIME_TOOL} -m coverage lcov -o coverage/lcov.info +coverage/xml: test + ${RUNTIME_TOOL} -m coverage xml -o coverage/coverage.xml + coverage/html: test ${RUNTIME_TOOL} -m coverage html open htmlcov/index.html diff --git a/sonar-project.properties b/sonar-project.properties index 10a5ac0..f220da1 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -16,7 +16,7 @@ sonar.exclusions=**/*test.py,**/__init__.py sonar.python.version=3.12 # Coverage -sonar.python.coverage.reportPaths=coverage.xml +sonar.python.coverage.reportPaths=coverage/coverage.xml # Ignore sonar.issue.ignore.multicriteria=e1