diff --git a/.gitea/workflows/sonar-scanner.yaml b/.gitea/workflows/sonar-scanner.yaml index 5f3a5c6..88647e0 100644 --- a/.gitea/workflows/sonar-scanner.yaml +++ b/.gitea/workflows/sonar-scanner.yaml @@ -16,13 +16,47 @@ jobs: with: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '25' + - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - uses: SonarSource/sonarqube-scan-action@v8 + + - name: Download SonarQube Scanner env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_SCANNER_VERSION: ${{ vars.SONAR_SCANNER_VERSION }} + run: |- + apk --no-cache add curl unzip; + curl --create-dirs -sSLo /tmp/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION.zip; + unzip -o /tmp/sonar-scanner.zip -d /tmp/; + + - name: Check if SonarQube Scanner is available + env: + SONAR_SCANNER_HOME: ${{ vars.SONAR_SCANNER_HOME }} + run: |- + test -f $SONAR_SCANNER_HOME/bin/sonar-scanner; + + - name: Verify SonarQube Scanner installation + env: + SONAR_SCANNER_HOME: ${{ vars.SONAR_SCANNER_HOME }} + run: |- + apk --no-cache add openjdk21-jre openjdk21-jre-headless; + java -version; + $SONAR_SCANNER_HOME/bin/sonar-scanner --version + + - name: Run sonar-scanner + env: + SONAR_SCANNER_HOME: ${{ vars.SONAR_SCANNER_HOME }} SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} + SONAR_PROJECT_KEY: ${{ vars.SONAR_PROJECT_KEY }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: |- + $SONAR_SCANNER_HOME/bin/sonar-scanner \ + -Dsonar.projectKey=$SONAR_PROJECT_KEY \ + -Dsonar.sources=. \ + -Dsonar.host.url=$SONAR_HOST_URL \ + -Dsonar.javascript.lcov.reportPaths=coverage/js/lcov.info \ + -Dsonar.php.coverage.reportPaths=coverage/php-clover.xml + # If you wish to fail your job when the Quality Gate is red, uncomment the # following lines. This would typically be used to fail a deployment. # - uses: SonarSource/sonarqube-quality-gate-action@v1