working repo #1
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
| # Runs SonarCloud analysis of the main branch after a PR is merged. | |
| name: SonarCloud analysis | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'LICENSE*' | |
| - 'CODEOWNERS' | |
| - '.gitignore' | |
| - '.gitattributes' | |
| - '**.md' | |
| - '**.adoc' | |
| - '**.txt' | |
| - 'runOnOpenShift.sh' | |
| - 'runLocally.sh' | |
| - '.ci/**' | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| sonarcloud-analysis: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v1 | |
| with: | |
| java-version: 11 | |
| # See https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven#caching-dependencies | |
| - name: Cache Maven packages | |
| uses: actions/cache@v2 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Build with Maven to measure code coverage | |
| run: mvn -B --fail-at-end clean install -Prun-code-coverage | |
| - name: Run SonarCloud analysis | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} | |
| run: mvn -B --fail-at-end validate -Psonarcloud-analysis -Dsonar.login=${{ env.SONARCLOUD_TOKEN }} |