name: SonarCloud on: push: branches: [ master, development ] pull_request: types: [ opened, synchronize, reopened ] jobs: build: name: Build runs-on: ubuntu-latest steps: # Setup Java - uses: actions/setup-java@v2 with: java-version: 17 distribution: adopt # Checkout project files - uses: actions/checkout@v2 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis # Caches - name: 'Cache: Maven' uses: actions/cache@v2 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-maven- - name: 'Cache: SonarCloud' uses: actions/cache@v2 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar - name: Analyze project run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=songoda_SongodaCore env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}