diff --git a/.github/workflows/quality-gate.yml b/.github/workflows/quality-gate.yml index cb52e6d..73504bf 100644 --- a/.github/workflows/quality-gate.yml +++ b/.github/workflows/quality-gate.yml @@ -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 }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..e65fac4 --- /dev/null +++ b/sonar-project.properties @@ -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