diff --git a/.github/workflows/sonar-scan.yml b/.github/workflows/sonar-scan.yml new file mode 100644 index 0000000..56d10e7 --- /dev/null +++ b/.github/workflows/sonar-scan.yml @@ -0,0 +1,48 @@ +name: SonarQube Scan +on: + push: + branches: [ "release" ] + pull_request: + types: [opened, synchronize, reopened] + branches: [ "master" ] + workflow_dispatch: # Allows you to run this workflow manually from the Actions tab + +jobs: + sonar-scan: + runs-on: bynder-arc + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run SonarQube Scan + uses: bynder/github-actions/actions/sonarqube@master +# steps: +# - uses: actions/checkout@v4 +# with: +# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis +# - name: Set up JDK 17 +# uses: actions/setup-java@v4 +# with: +# distribution: 'zulu' +# java-version: 17 +# - name: Cache SonarQube packages +# uses: actions/cache@v4 +# with: +# path: ~/.sonar/cache +# key: ${{ runner.os }}-sonar +# restore-keys: ${{ runner.os }}-sonar +# - name: Cache Maven packages +# uses: actions/cache@v4 +# with: +# path: ~/.m2 +# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} +# restore-keys: ${{ runner.os }}-m2 +# - name: Build and analyze +# env: +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +# SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} +# SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} +# run: | +# mvn sonar:sonar \ +# -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} \ +# -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \ +# -Dsonar.login=${{ secrets.SONAR_TOKEN }} diff --git a/pom.xml b/pom.xml index 54d34eb..2da7a81 100644 --- a/pom.xml +++ b/pom.xml @@ -179,6 +179,11 @@ true + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.9.1.2184 +