diff --git a/.gitea/workflows/sonar.yml b/.gitea/workflows/sonar.yml new file mode 100644 index 0000000..f9733b5 --- /dev/null +++ b/.gitea/workflows/sonar.yml @@ -0,0 +1,38 @@ +name: SonarQube Analysis + +on: + push: + branches: + - master + - dev + pull_request: + branches: + - master + - dev + types: [opened, synchronize, reopened] + +jobs: + sonarqube: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Run SonarScanner (Pinned v12) + run: | + PROJECT_KEY=${{ gitea.repository.name }} + + docker run --rm \ + -v "$PWD:/usr/src" \ + -w /usr/src \ + -e SONAR_HOST_URL=${{ secrets.SONARQUBE_HOST }} \ + -e SONAR_TOKEN=${{ secrets.SONARQUBE_TOKEN }} \ + sonarsource/sonar-scanner-cli:12 \ + -Dsonar.projectKey=$PROJECT_KEY \ + -Dsonar.projectName=$PROJECT_KEY \ + -Dsonar.sources=. \ + -Dsonar.exclusions=node_modules/**,dist/**,coverage/** \ + -Dsonar.qualitygate.wait=true