ahongbynder is running the workflow #4
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: SonarQube Scan | |
| run-name: ${{ github.actor }} is running the workflow | |
| on: | |
| push: | |
| branches: [ "release" ] | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: [ "master" ] | |
| workflow_dispatch: # Allows you to run this workflow manually from the Actions tab | |
| jobs: | |
| sonar-scan: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: 8 | |
| - name: Cache SonarQube packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.sonar/cache | |
| key: ${{ runner.os }}-sonar | |
| restore-keys: ${{ runner.os }}-sonar | |
| - name: Cache Maven packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Build and analyze | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
| SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} | |
| run: | | |
| mvn sonar:sonar \ | |
| -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} \ | |
| -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \ | |
| -Dsonar.login=${{ secrets.SONAR_TOKEN }} |