diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 0000000..bfb1027 --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,30 @@ +name: SonarCloud Scan + +on: + push: + branches: [ main ] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + + - name: Cache Sonar + uses: actions/cache@v4 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B clean verify sonar:sonar -Dsonar.projectKey=ED1DAM2526_InazumaGo -Dsonar.organization=ed1dam2526 -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN \ No newline at end of file diff --git a/pom.xml b/pom.xml index 12bfc78..887453c 100644 --- a/pom.xml +++ b/pom.xml @@ -81,6 +81,12 @@ + + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.9.1.2184 +