This repository was archived by the owner on Apr 1, 2026. It is now read-only.
SonarCloud Scan #713
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: SonarCloud Scan | |
| on: | |
| workflow_run: | |
| workflows: ["Build and Test"] | |
| types: [completed] | |
| jobs: | |
| Sonar: | |
| runs-on: ubuntu-latest | |
| if: github.event.workflow_run && github.event.workflow_run.conclusion == 'success' | |
| steps: | |
| - name: Set up JDK ${{ github.event.workflow_run.outputs.jdk }} | |
| uses: actions/setup-java@v5.0.0 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5.0.0 | |
| - name: Checkout PR | |
| uses: actions/checkout@v6.0.0 | |
| with: | |
| repository: ${{ github.event.workflow_run.head_repository.full_name }} | |
| ref: ${{ github.event.workflow_run.head_branch }} | |
| fetch-depth: 0 | |
| - name: Cache SonarCloud packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.sonar/cache | |
| key: ${{ runner.os }}-sonar-${{ github.event.workflow_run.outputs.jdk }} | |
| restore-keys: ${{ runner.os }}-sonar-${{ github.event.workflow_run.outputs.jdk }} | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
| restore-keys: ${{ runner.os }}-gradle | |
| - name: Download Coverage | |
| uses: actions/download-artifact@v6.0.0 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ github.event.workflow_run.id }} | |
| path: ./ | |
| merge-multiple: true | |
| - name: Build | |
| run: ./gradlew build | |
| - name: Analyze | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: | | |
| ./gradlew sonar --info -Dorg.gradle.jvmargs=-Xmx4096M \ | |
| -Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} \ | |
| -Dsonar.analysis.jdk=${{ github.event.workflow_run.outputs.jdk }} \ | |
| -Dsonar.pullrequest.key=${{ github.event.workflow_run.pull_requests[0].number }} \ | |
| -Dsonar.pullrequest.branch=${{ github.event.workflow_run.pull_requests[0].head.ref }} \ | |
| -Dsonar.pullrequest.base=${{ github.event.workflow_run.pull_requests[0].base.ref }} |