This commit is contained in:
Shihan Zhang 2024-04-05 13:59:57 -04:00 committed by GitHub
commit 54061692fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 53 additions and 13 deletions

View file

@ -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'

View file

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