Skip to content
Open
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
12 changes: 7 additions & 5 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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|<source>.*</source>|<source>django/api</source>|g" django/coverage.xml
sed -i "s|<source>.*</source>|<source>.</source>|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
Expand All @@ -109,4 +111,4 @@ jobs:
uses: SonarSource/sonarqube-scan-action@v8.2.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Loading