From 7dc68607225858599bf17365d11eaf79612018bc Mon Sep 17 00:00:00 2001 From: Florian Zumpe Date: Thu, 4 Jun 2026 23:26:50 +0200 Subject: [PATCH] =?UTF-8?q?Workflow=20f=C3=BCr=20Sonarscan=20eingef=C3=BCg?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/run_scanner.yaml | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .gitea/workflows/run_scanner.yaml diff --git a/.gitea/workflows/run_scanner.yaml b/.gitea/workflows/run_scanner.yaml new file mode 100644 index 0000000..9160391 --- /dev/null +++ b/.gitea/workflows/run_scanner.yaml @@ -0,0 +1,59 @@ +name: Sonarqube Scanner + +on: + push: + branches: + - main + + +jobs: + build: + name: Build and analyze + runs-on: docker + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + - name: Download SonarQube Scanner + env: + 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: |- + 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 + # timeout-minutes: 5 + # env: + # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file