feat: Integrate SonarQube analysis into CI workflows
Some checks failed
Docker Build and Push / build-and-push (push) Failing after 43s
LabFusion CI/CD Pipeline / service-adapters (push) Failing after 25s
API Gateway (Java Spring Boot) / test (17) (push) Failing after 1m50s
LabFusion CI/CD Pipeline / api-docs (push) Failing after 50s
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 1m34s
API Gateway (Java Spring Boot) / test (21) (push) Failing after 1m44s
API Gateway (Java Spring Boot) / build (push) Has been skipped
API Gateway (Java Spring Boot) / security (push) Has been skipped
LabFusion CI/CD Pipeline / frontend (push) Failing after 1m57s
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped
Frontend (React) / test (16) (push) Failing after 1m44s
Frontend (React) / test (20) (push) Failing after 1m31s
Frontend (React) / test (18) (push) Failing after 1m47s
Frontend (React) / build (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.1) (push) Failing after 19s
Service Adapters (Python FastAPI) / test (3.11) (push) Failing after 26s
Service Adapters (Python FastAPI) / test (3.9) (push) Failing after 23s
Service Adapters (Python FastAPI) / build (push) Has been skipped
Frontend (React) / lighthouse (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.12) (push) Failing after 22s
Integration Tests / performance-tests (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 2m23s
API Docs (Node.js Express) / test (16) (push) Failing after 54s
API Docs (Node.js Express) / test (18) (push) Failing after 55s
API Docs (Node.js Express) / test (20) (push) Failing after 58s
API Docs (Node.js Express) / build (push) Has been skipped

### Summary of Changes
- Added SonarQube analysis steps to all CI workflows (API Docs, API Gateway, Frontend, Service Adapters).
- Configured SonarQube properties for each service to ensure proper reporting and analysis.
- Enhanced test coverage reporting by specifying multiple coverage reporters in test commands.
- Updated Maven and Python dependencies to include SonarQube integration tools.

### Expected Results
- CI pipelines will now send test and coverage results to SonarQube for better quality tracking.
- Improved visibility into code quality and test coverage across all services.
This commit is contained in:
GSRN
2025-09-15 19:55:13 +02:00
parent 7cf0819b58
commit 6f8d7f6ca9
8 changed files with 460 additions and 43 deletions

View File

@@ -85,15 +85,28 @@ jobs:
- name: Run tests
run: |
pytest --cov=. --cov-report=xml --cov-report=html --cov-report=term-missing
pytest --cov=. --cov-report=xml --cov-report=html --cov-report=term-missing --junitxml=tests/reports/junit.xml
pytest --cov=. --cov-report=xml --cov-report=html --cov-report=term-missing --cov-fail-under=80
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./services/service-adapters/coverage.xml
flags: service-adapters
name: service-adapters-coverage
- name: Send results to SonarQube
run: |
echo "Sending Service Adapters results to SonarQube..."
# Install SonarQube Scanner for Python
pip install sonar-scanner
# Run SonarQube analysis
sonar-scanner \
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
-Dsonar.login=${{ secrets.SONAR_TOKEN }} \
-Dsonar.projectKey=labFusion \
-Dsonar.projectName="LabFusion" \
-Dsonar.projectVersion=1.0.0 \
-Dsonar.modules=service-adapters \
-Dsonar.sources=. \
-Dsonar.tests=tests \
-Dsonar.python.coverage.reportPaths=coverage.xml \
-Dsonar.python.xunit.reportPath=tests/reports/junit.xml
- name: Test results summary
if: always()