sonarcloud-branch.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. name: SonarCloud Scan (master branch)
  2. on:
  3. push:
  4. branches:
  5. - master
  6. # Allows you to run this workflow manually from the Actions tab
  7. workflow_dispatch:
  8. jobs:
  9. sonar:
  10. name: SonarCloud Scan
  11. runs-on: ubuntu-latest
  12. if: ${{ github.actor != 'dependabot[bot]' }}
  13. steps:
  14. - uses: actions/checkout@v3
  15. with:
  16. fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
  17. - name: Set up JDK
  18. uses: actions/setup-java@v3
  19. with:
  20. distribution: 'temurin'
  21. java-version: 17
  22. - name: Cache SonarCloud packages
  23. uses: actions/cache@v3
  24. with:
  25. path: ~/.sonar/cache
  26. key: ${{ runner.os }}-sonar
  27. restore-keys: ${{ runner.os }}-sonar
  28. - name: Cache Maven packages
  29. uses: actions/cache@v3
  30. with:
  31. path: ~/.m2
  32. key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
  33. restore-keys: ${{ runner.os }}-m2
  34. - name: Build and analyze
  35. env:
  36. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  37. SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
  38. run: mvn -U -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar