Merge pull request #96 from SmartGecko44/dependabot/maven/de.tr7zw-it… #200
This file contains 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 analysis | |
on: | |
push: | |
branches: | |
- 'short-term/*' | |
- 'long-term/*' | |
- 'release/*' | |
- 'master' | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: | |
permissions: | |
pull-requests: read # allows SonarCloud to decorate PRs with analysis results | |
jobs: | |
Analysis: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@main | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Cache Sonar dependencies | |
uses: actions/cache@main | |
with: | |
path: | | |
~/.m2/repository | |
key: maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
sonar- | |
- name: Set up JDK | |
uses: actions/setup-java@main | |
with: | |
distribution: 'adopt' | |
java-version: '21' | |
- name: Build and Analyze with SonarCloud | |
run: mvn clean install sonar:sonar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) |