Skip to content

Commit 602a9e9

Browse files
committed
Add JaCoCo coverage
1 parent f493a21 commit 602a9e9

File tree

5 files changed

+76
-2
lines changed

5 files changed

+76
-2
lines changed

.github/workflows/ci-all.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ jobs:
1717
with:
1818
java-version: '17'
1919
distribution: 'temurin'
20+
21+
2022

21-
- name: Build All Services
22-
run: mvn clean install -DskipTests
23+
# - name: Build All Services
24+
# run: mvn clean install -DskipTests
25+
26+
- name: Run Tests and Generate JaCoCo Coverage
27+
run: mvn clean verify
2328

2429
- name: SonarQube Analysis
2530
env:
@@ -31,6 +36,7 @@ jobs:
3136
-Dsonar.organization=vijayagopalsb \
3237
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL_REMOTE }} \
3338
-Dsonar.login=${{ secrets.SONAR_TOKEN_REMOTE }}
39+
-Dsonar.coverage.jacoco.xmlReportPaths=**/target/site/jacoco/jacoco.xml
3440
3541
- name: Set up Docker Buildx
3642
uses: docker/setup-buildx-action@v3

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,28 @@
2929
<a href="https://github.com/vijayagopalsb/spring-dynamic-microservices/blob/main/LICENSE">
3030
<img src="https://img.shields.io/github/license/vijayagopalsb/spring-dynamic-microservices?color=blue" />
3131
</a>
32+
33+
<a href="https://sonarcloud.io/summary/new_code?id=vijayagopalsb_spring-dynamic-microservices">
34+
<img src="https://sonarcloud.io/api/project_badges/measure?project=vijayagopalsb_spring-dynamic-microservices&metric=alert_status" alt="Quality Gate Status"/>
35+
</a>
36+
37+
38+
<a href="https://sonarcloud.io/summary/new_code?id=vijayagopalsb_spring-dynamic-microservices">
39+
<img src="https://sonarcloud.io/api/project_badges/measure?project=vijayagopalsb_spring-dynamic-microservices&metric=sqale_rating" alt="Maintainability"/>
40+
</a>
41+
42+
43+
<a href="https://sonarcloud.io/summary/new_code?id=vijayagopalsb_spring-dynamic-microservices">
44+
<img src="https://sonarcloud.io/api/project_badges/measure?project=vijayagopalsb_spring-dynamic-microservices&metric=reliability_rating" alt="Reliability"/>
45+
</a>
46+
47+
48+
<a href="https://sonarcloud.io/summary/new_code?id=vijayagopalsb_spring-dynamic-microservices">
49+
<img src="https://sonarcloud.io/api/project_badges/measure?project=vijayagopalsb_spring-dynamic-microservices&metric=security_rating" alt="Security"/>
50+
</a>
51+
52+
53+
3254
</p>
3355

3456

payment-service-paypal/pom.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232
<groupId>org.springframework.boot</groupId>
3333
<artifactId>spring-boot-starter-actuator</artifactId>
3434
</dependency>
35+
36+
<!-- Spring Boot Starter Test -->
37+
<dependency>
38+
<groupId>org.springframework.boot</groupId>
39+
<artifactId>spring-boot-starter-test</artifactId>
40+
<scope>test</scope>
41+
</dependency>
3542
</dependencies>
3643

3744
<build>
@@ -47,6 +54,28 @@
4754
</execution>
4855
</executions>
4956
</plugin>
57+
58+
<!--JaCoCo-->
59+
<plugin>
60+
<groupId>org.jacoco</groupId>
61+
<artifactId>jacoco-maven-plugin</artifactId>
62+
<version>0.8.10</version>
63+
<executions>
64+
<execution>
65+
<goals>
66+
<goal>prepare-agent</goal>
67+
</goals>
68+
</execution>
69+
<execution>
70+
<id>report</id>
71+
<phase>prepare-package</phase>
72+
<goals>
73+
<goal>report</goal>
74+
</goals>
75+
</execution>
76+
</executions>
77+
</plugin>
78+
5079
</plugins>
5180
</build>
5281

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.example.paymentservicepaypal;
2+
3+
import org.junit.jupiter.api.Test;
4+
import org.springframework.boot.test.context.SpringBootTest;
5+
6+
import static org.junit.jupiter.api.Assertions.assertTrue;
7+
8+
@SpringBootTest
9+
class PaymentServicePaypalApplicationTests {
10+
11+
@Test
12+
void contextLoads() {
13+
assertTrue(true); // Dummy assertion to ensure test passes
14+
}
15+
}

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
<version>3.2.12</version>
6161

6262
</plugin>
63+
64+
6365
</plugins>
6466
</pluginManagement>
6567
</build>

0 commit comments

Comments
 (0)