SIENTIAPDE-1111: refactor sonarqube pipeline.
This commit is contained in:
30
.github/workflows/quality-gate.yml
vendored
30
.github/workflows/quality-gate.yml
vendored
@@ -4,12 +4,9 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- 'feature/**'
|
|
||||||
- 'release/**'
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- 'release/**'
|
|
||||||
types: [ opened, synchronize, reopened ]
|
types: [ opened, synchronize, reopened ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -17,7 +14,6 @@ jobs:
|
|||||||
name: SonarQube Analysis
|
name: SonarQube Analysis
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: ⬇️ Checkout Code
|
- name: ⬇️ Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -53,32 +49,12 @@ jobs:
|
|||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
pip install pytest pytest-cov
|
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
|
- name: 🧪 Run Tests with Pytest
|
||||||
run: |
|
run: |
|
||||||
pytest tests --junitxml=pytest.xml --cov=ingestor --cov-report=xml --cov-report=term
|
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:
|
env:
|
||||||
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
|
|
||||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
run: |
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||||
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
|
|
||||||
|
|||||||
11
sonar-project.properties
Normal file
11
sonar-project.properties
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
sonar.projectKey=Aignosi_sientia-dataops-opc-ingestor_7a3d9693-a2bf-4699-bd82-df68d9a854f3
|
||||||
|
sonar.projectName=sientia-dataops-opc-ingestor
|
||||||
|
sonar.sources=ingestor
|
||||||
|
sonar.tests=tests
|
||||||
|
sonar.qualitygate.wait=true
|
||||||
|
sonar.qualitygate.timeout=300
|
||||||
|
sonar.python.coverage.reportPaths=coverage.xml
|
||||||
|
sonar.python.xunit.reportPath=pytest.xml
|
||||||
|
sonar.python.version=3.11
|
||||||
|
sonar.projectVersion=1.2.0
|
||||||
|
sonar.coverage.exclusions=ingestor/app.py
|
||||||
Reference in New Issue
Block a user