mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-24 00:35:49 +00:00
Add Codacy implementation
This commit is contained in:
parent
7214e15505
commit
d3821df9f4
4 changed files with 84 additions and 38 deletions
32
.github/workflows/codacy-build.yml
vendored
Normal file
32
.github/workflows/codacy-build.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
name: SonarCloud
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
build:
|
||||
name: Build and analyze
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: 'zulu' # Alternative distribution options are available.
|
||||
- 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 run tests
|
||||
run: mvn -B verify
|
||||
- name: Generate JaCoCo XML report
|
||||
run: mvn jacoco:report -Djacoco.report.failureOnViolation=false
|
||||
- name: Upload JaCoCo XML report to Codacy
|
||||
run: |
|
||||
bash <(curl -Ls https://coverage.codacy.com/get.sh)
|
||||
env:
|
||||
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
12
.github/workflows/sonar-build.yml
vendored
12
.github/workflows/sonar-build.yml
vendored
|
@ -1,10 +1,10 @@
|
|||
name: SonarCloud
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
#on:
|
||||
# push:
|
||||
# branches:
|
||||
# - main
|
||||
# pull_request:
|
||||
# types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
build:
|
||||
name: Build and analyze
|
||||
|
|
65
pom.xml
65
pom.xml
|
@ -37,6 +37,14 @@
|
|||
<sonar.projectKey>andrii-hryniv_spring-petclinic</sonar.projectKey>
|
||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||
<sonar.java.binaries>target/classes</sonar.java.binaries>
|
||||
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
|
||||
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
|
||||
<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
|
||||
<sonar.language>java</sonar.language>
|
||||
<sonar.coverage.jacoco.xmlReportPaths>
|
||||
target/site/jacoco/jacoco.xml,
|
||||
build/reports/jacoco/test/jacocoTestReport.xml
|
||||
</sonar.coverage.jacoco.xmlReportPaths>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -141,7 +149,11 @@
|
|||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.7</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
|
@ -279,6 +291,26 @@
|
|||
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>${jacoco.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>jacoco-initialize</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>jacoco-site</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@ -328,37 +360,6 @@
|
|||
</pluginRepositories>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>coverage</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>prepare-agent</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>report</id>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<formats>
|
||||
<format>XML</format>
|
||||
</formats>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>css</id>
|
||||
<build>
|
||||
|
|
13
sonar-project.properties
Normal file
13
sonar-project.properties
Normal file
|
@ -0,0 +1,13 @@
|
|||
sonar.projectKey=andrii-hryniv_${rootProject.name}
|
||||
sonar.projectName=${rootProject.name}
|
||||
sonar.organization=andrii-hryniv
|
||||
sonar.java.binaries=target/classes
|
||||
sonar.host.url=https://sonarcloud.io
|
||||
sonar.java.coveragePlugin=jacoco
|
||||
sonar.dynamicAnalysis=reuseReports
|
||||
sonar.jacoco.reportPaths=${project.basedir}/../target/jacoco.exec
|
||||
sonar.sources=src/main
|
||||
sonar.exclusions=**/resources/**/*
|
||||
sonar.tests=src/test
|
||||
sonar.test.exclusions=**/resources/**/*
|
||||
sonar.java.libraries=/home/vsts/.gradle/**/lombok/**/*.jar
|
Loading…
Reference in a new issue