SIENTIAPDE-1111: refactor sonarqube pipeline.

This commit is contained in:
Bruno Domingues
2025-06-23 12:49:52 -03:00
parent 3f289e8ddd
commit 762b9072dc
2 changed files with 14 additions and 27 deletions

View File

@@ -4,12 +4,9 @@ on:
push:
branches:
- main
- 'feature/**'
- 'release/**'
pull_request:
branches:
- main
- 'release/**'
types: [ opened, synchronize, reopened ]
jobs:
@@ -17,7 +14,6 @@ jobs:
name: SonarQube Analysis
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: ⬇️ Checkout Code
uses: actions/checkout@v4
@@ -52,33 +48,13 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov
- name: ⬇️ Setup Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
- name: 📥 Setup SonarScanner
uses: warchant/setup-sonar-scanner@v7
- name: 🧪 Run Tests with Pytest
run: |
pytest tests --junitxml=pytest.xml --cov=ingestor --cov-report=xml --cov-report=term
- name: 📊 Run SonarQube Analysis
- name: Run SonarQube Analysis
uses: SonarSource/sonarqube-scan-action@v5
env:
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner \
-Dsonar.projectKey=$SONAR_PROJECT_KEY \
-Dsonar.sources=ingestor \
-Dsonar.tests=tests \
-Dsonar.python.coverage.reportPaths=coverage.xml \
-Dsonar.python.xunit.reportPath=pytest.xml \
-Dsonar.host.url=$SONAR_HOST_URL \
-Dsonar.token=$SONAR_TOKEN \
-Dsonar.python.version=3.11 \
-Dsonar.projectVersion=1.2.0 \
-Dsonar.coverage.exclusions=ingestor/app.py
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}