Skip to content

Commit

Permalink
Show test coverage report (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
minhtranq-nashtechglobal committed Aug 8, 2024
1 parent 8c6f3e0 commit 861248a
Show file tree
Hide file tree
Showing 32 changed files with 441 additions and 4 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/cart-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
path: '**/checkstyle-result.xml'
- name: Run Maven Test
run: mvn test -pl cart -am
- name: Run Jacoco Test
run: mvn jacoco:report -pl cart -am
- name: Unit Test Results
uses: dorny/test-reporter@v1
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }}
Expand All @@ -61,6 +63,15 @@ jobs:
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -pl cart -am
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/cart/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Cart Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/customer-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/customer/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Customer Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/inventory-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ jobs:
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f inventory
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/inventory/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Inventory Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/location-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/location/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Location Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/media-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/media/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Media Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/order-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/order/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Order Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/payment-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/payment/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Payment Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/payment-paypal-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/payment-paypal/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Payment Paypal Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/product-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/product/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Product Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/promotion-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/promotion/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Promotion Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/rating-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/rating/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Rating Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/search-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/search/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Search Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/storefront-bff-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/search/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Storefront BFF Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/tax-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/tax/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Tax Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/webhook-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ jobs:
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{github.workspace}}/webhook/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 80
min-coverage-changed-files: 60
title: 'Webhook Coverage Report'
update-comment: true
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
Expand Down
20 changes: 20 additions & 0 deletions cart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,26 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
20 changes: 20 additions & 0 deletions customer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,26 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
20 changes: 20 additions & 0 deletions inventory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,26 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ void test_existsByNameWithDifferentId_shouldReturnTrue_IfWarehouseWithSameNameEx

@Test
void test_existsByNameWithDifferentId_shouldReturnFalse_IfWarehouseWithSameNameNotExistsWithDifferentId() {
assertThat(warehouseRepository.existsByNameWithDifferentId(anyString(), anyLong())).isFalse();
assertThat(warehouseRepository.existsByNameWithDifferentId("test_warehouses", 34L)).isFalse();
}
}
20 changes: 20 additions & 0 deletions location/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
20 changes: 20 additions & 0 deletions media/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit 861248a

Please sign in to comment.