Skip to content

Commit f07bc20

Browse files
committed
chore(init_sonarqube): add jacoco to add coverage requirement on a pull request
1 parent 48b8377 commit f07bc20

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

.github/workflows/sonar.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ jobs:
3939
run: |
4040
mkdir -p src/test/resources
4141
echo ${{ secrets.APPLICATION_TEST_PROPERTIES }} | base64 -d > src/test/resources/application-test.properties
42-
mvn clean verify sonar:sonar
42+
mvn clean verify sonar:sonar -Dsonar.qualitygate.wait=true

pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<properties>
3030
<java.version>25</java.version>
3131
<sonar.coverage.exclusions>**/*Application.java</sonar.coverage.exclusions>
32+
<sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
3233
</properties>
3334
<dependencies>
3435
<dependency>
@@ -93,6 +94,25 @@
9394
<groupId>org.springframework.boot</groupId>
9495
<artifactId>spring-boot-maven-plugin</artifactId>
9596
</plugin>
97+
<plugin>
98+
<groupId>org.jacoco</groupId>
99+
<artifactId>jacoco-maven-plugin</artifactId>
100+
<version>0.8.12</version>
101+
<executions>
102+
<execution>
103+
<goals>
104+
<goal>prepare-agent</goal>
105+
</goals>
106+
</execution>
107+
<execution>
108+
<id>report</id>
109+
<phase>verify</phase>
110+
<goals>
111+
<goal>report</goal>
112+
</goals>
113+
</execution>
114+
</executions>
115+
</plugin>
96116
</plugins>
97117
</build>
98118

0 commit comments

Comments
 (0)