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 }} 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