Skip to content
Closed
Show file tree
Hide file tree
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
50 changes: 50 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Monorepo Test & SonarCloud

on:
push:
branches: [ main , Development ]
pull_request:
types: [opened, synchronize, reopened]

jobs:
sonarcloud:
name: Unified Coverage + SonarCloud
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.13'

- name: Install global test deps
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov

- name: Install service dependencies
if: ${{ github.event_name == 'null' }}
run: |
pip install -r auth-service/requirements.txt
pip install -r project-service/requirements.txt
pip install -r notification-service/requirements.txt

- name: Run all tests with per-service coverage
if: ${{ github.event_name == 'null' }}
run: |
pytest \
--cov=auth-service \
--cov=project-service \
--cov=notification-service \
--cov-report=xml \
auth-service/tests project-service/tests notification-service/tests

- name: SonarCloud Analysis
uses: SonarSource/sonarcloud-github-action@v2
with:
projectBaseDir: .
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
18 changes: 18 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
sonar.projectKey=ISCODEVUTB_TaskHub
sonar.organization=deviscoutb
sonar.host.url=https://sonarcloud.io
sonar.token=${SONAR_TOKEN}

# Incluye todos los microservicios
sonar.sources=auth-service,project-service,notification-service
sonar.tests=auth-service/tests,project-service/tests,notification-service/tests

# Incluir solo archivos de test dentro de tests/
sonar.test.inclusions=**/tests/**/*.py

# Excluir posibles archivos compilados o cachés
sonar.exclusions=**/__pycache__/**,**/*.pyc

# Coverage report
# Lo ideal es un coverage.xml generado de forma combinada
sonar.python.coverage.reportPaths=coverage.xml
Loading