From 6e0ffc186008af26602a55b774ce212b6248cf99 Mon Sep 17 00:00:00 2001 From: Shihan Zhang <55231475+yoyazhang@users.noreply.github.com> Date: Fri, 5 Apr 2024 12:56:11 -0400 Subject: [PATCH 1/2] Update maven-build.yml --- .github/workflows/maven-build.yml | 56 ++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 4718a6ce5..f2ddc146d 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -9,21 +9,51 @@ on: pull_request: branches: [ main ] +# jobs: +# build: + +# runs-on: ubuntu-latest +# strategy: +# matrix: +# java: [ '17' ] + +# steps: +# - uses: actions/checkout@v4 +# - name: Set up JDK ${{matrix.java}} +# uses: actions/setup-java@v4 +# with: +# java-version: ${{matrix.java}} +# distribution: 'adopt' +# cache: maven +# - name: Build with Maven Wrapper +# run: ./mvnw -B package jobs: build: - + name: Build runs-on: ubuntu-latest - strategy: - matrix: - java: [ '17' ] - + permissions: read-all steps: - - uses: actions/checkout@v4 - - name: Set up JDK ${{matrix.java}} - uses: actions/setup-java@v4 + - uses: actions/checkout@v2 with: - java-version: ${{matrix.java}} - distribution: 'adopt' - cache: maven - - name: Build with Maven Wrapper - run: ./mvnw -B package + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + - name: Cache SonarQube packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v1 + 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 }} + run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=petclinic -Dsonar.projectName='petclinic' From d2bd8476b61cb5029ca7ff6fad92cb66f7bdb343 Mon Sep 17 00:00:00 2001 From: Shihan Zhang <55231475+yoyazhang@users.noreply.github.com> Date: Fri, 5 Apr 2024 13:08:14 -0400 Subject: [PATCH 2/2] Update build.gradle --- build.gradle | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.gradle b/build.gradle index e2f5769e8..b7c8cf0b1 100644 --- a/build.gradle +++ b/build.gradle @@ -80,3 +80,13 @@ checkFormatAotTest.enabled = false formatAot.enabled = false formatAotTest.enabled = false +plugins { + id "org.sonarqube" version "4.4.1.3373" +} + +sonar { + properties { + property "sonar.projectKey", "petclinic" + property "sonar.projectName", "petclinic" + } +}