From 4193d97272ab03612bef1995842d7d2f27b4019f Mon Sep 17 00:00:00 2001 From: BabacarTalibe Date: Mon, 27 Jan 2025 21:44:05 +0100 Subject: [PATCH 1/2] Create .sonarcloud.properties --- DevOps-Project-01/.sonarcloud.properties | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 DevOps-Project-01/.sonarcloud.properties diff --git a/DevOps-Project-01/.sonarcloud.properties b/DevOps-Project-01/.sonarcloud.properties new file mode 100644 index 0000000..d070830 --- /dev/null +++ b/DevOps-Project-01/.sonarcloud.properties @@ -0,0 +1,4 @@ +sonar.organization=https://sonarcloud.io/project/configuration?id=BabacarTalibe_DevOps-Projects +sonar.projectKey=BabacarTalibe_DevOps-Projects +sonar.sources=src +sonar.host.url=https://sonarcloud.io From 331eb71b74f1c15d1436cd8c66b5aba0734dc190 Mon Sep 17 00:00:00 2001 From: BabacarTalibe Date: Mon, 27 Jan 2025 22:03:37 +0100 Subject: [PATCH 2/2] Create sonarcloud.yml --- .github/workflows/sonarcloud.yml | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/sonarcloud.yml diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 0000000..7a0f661 --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,38 @@ +name: SonarCloud + +on: + push: + branches: + - main + +jobs: + sonarcloud: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-m2 + + - name: Build and analyze + run: mvn clean verify sonar:sonar + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}