From 584611300d9ad9fbb0896e930bedcd0d302da896 Mon Sep 17 00:00:00 2001
From: gabrielvascf <93106982+gabrielvascf@users.noreply.github.com>
Date: Fri, 25 Sep 2026 11:34:18 -0300
Subject: [PATCH] fix: add report file preprocessing for Sonar Integration
Tests
---
.github/workflows/sonar.yml | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml
index b2652df..25f6291 100644
--- a/.github/workflows/sonar.yml
+++ b/.github/workflows/sonar.yml
@@ -26,8 +26,6 @@ jobs:
sonarcloud:
name: Integration Tests and SonarCloud
runs-on: ubuntu-latest
-
- # 1. Cria um banco de dados temporário no GitHub para os testes rodarem
services:
postgres:
image: pgvector/pgvector:pg15
@@ -70,7 +68,6 @@ jobs:
run: |
psql -h localhost -U api_user -d api_db -c "CREATE EXTENSION IF NOT EXISTS vector;"
- # --- 3. RUN TESTS & GENERATE XML ---
- name: Run backend integration tests
env:
DB_HOST: localhost
@@ -85,13 +82,18 @@ jobs:
--rm \
backend-test
- - name: Verify generated reports
+ - name: Verify and adjust generated reports
run: |
test -f django/coverage.xml
test -f django/test-results.xml
echo "Integration test reports generated successfully."
+ # maldita desgraça de preprocessamento de arquivo pro sonar achar a porra dos reports
+ sed -i "s|.*|django/api|g" django/coverage.xml
+ sed -i "s|.*|.|g" django/test-results.xml
+ sed -i 's|classname="api\.|classname="django.api.|g' django/test-results.xml
+
ls -lh \
django/coverage.xml \
django/test-results.xml
@@ -109,4 +111,4 @@ jobs:
uses: SonarSource/sonarqube-scan-action@v8.2.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
\ No newline at end of file
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}