From f000ca6fc85b5d2272790b98e0c6fcbda26646c4 Mon Sep 17 00:00:00 2001 From: mouad el azaar Date: Mon, 2 Dec 2024 14:47:11 +0100 Subject: [PATCH] add sonar config --- .github/workflows/sonar.yml | 38 +++++++++++++++++++++++++++++++++++++ pom.xml | 7 +++++++ sonar-project.properties | 10 ++++++++++ 3 files changed, 55 insertions(+) create mode 100644 .github/workflows/sonar.yml create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 0000000..be924ee --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,38 @@ +name: SonarCloud Analysis + +on: + push: + branches: + - tech/ANT-2504_add_sonar_conf + pull_request: + types: [opened, synchronize, reopened] + +jobs: + sonarcloud: + name: SonarCloud Scan + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '21' # Ou la version Java utilisée dans votre projet + + - name: Cache Maven repository + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-m2- + + - name: Build project + run: mvn clean install + + - name: Run SonarCloud Scan + run: mvn sonar:sonar + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/pom.xml b/pom.xml index 1dbaa0a..0212ada 100644 --- a/pom.xml +++ b/pom.xml @@ -158,6 +158,13 @@ + + + org.sonarsource.scanner.maven + sonar-maven-plugin + 5.0.0.4389 + + diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..9e5d9e2 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,10 @@ +sonar.projectKey=AntaresSimulatorTeam_antares-datamanager-back +sonar.organization=antaressimulatorteam +sonar.host.url=https://sonarcloud.io +sonar.login=2bc966dd270c9454aab5f0a892e2334377a14a99 +sonar.sources=src/main/java +sonar.tests=src/test/java +sonar.java.binaries=target/classes +sonar.language=java +sonar.sourceEncoding=UTF-8 +