Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions .github/workflows/ci-django-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
uses: pre-commit/action@v3.0.1

tests:
name: Run tests and SonarQube Cloud scan
name: Run tests
runs-on: ubuntu-latest
defaults:
run:
Expand Down Expand Up @@ -144,13 +144,31 @@ jobs:
- name: Run tests
run: |
pytest -ra -vvv --cov=. --cov-report=xml
# Without this workaround, SonarQube Cloud reports a warning about an incorrect source path
- name: Override coverage report source path for SonarQube Cloud
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
- name: SonarQube Cloud Scan
uses: SonarSource/sonarqube-scan-action@v6
- name: Store coverage.xml
uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
projectBaseDir: ${{ inputs.working-directory }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
path: coverage.xml
key: cache-${{ github.run_id }}-${{ github.run_attempt }}

sonarcloud:
name: Run SonarQube Cloud Scan
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v4
- name: Restore coverage.xml
uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
path: coverage.xml
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true
# Without this workaround, SonarQube Cloud reports a warning about an incorrect source path
- name: Override coverage report source path for SonarQube Cloud
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
- name: SonarQube Cloud Scan
uses: SonarSource/sonarqube-scan-action@v6
with:
projectBaseDir: ${{ inputs.working-directory }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}