Skip to content

Commit

Permalink
Merge pull request #14 from teixeira-fernando/IntegrationProductAndOrder
Browse files Browse the repository at this point in the history
Configured code coverage and mutation coverage reports
  • Loading branch information
teixeira-fernando authored Oct 16, 2020
2 parents bd4af24 + de833ac commit 4e6d177
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 7 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: MutationAndCodeCoverage

on:
release:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Download repository
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Clean install
run: mvn clean install
- name: Archive code coverage - Inventory
uses: actions/upload-artifact@v2
with:
name: codeCoverage-inventory
path: inventory/target/site/jacoco
- name: Archive mutation coverage - Inventory
uses: actions/upload-artifact@v2
with:
name: mutationCoverage-inventory
path: inventory/target/pit-reports
- name: Archive code coverage - Shop
uses: actions/upload-artifact@v2
with:
name: codeCoverage-shop
path: shop/target/site/jacoco
- name: Archive mutation coverage - Shop
uses: actions/upload-artifact@v2
with:
name: mutationCoverage-shop
path: shop/target/pit-reports



65 changes: 61 additions & 4 deletions inventory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,36 @@
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>qa</classifier>
<excludes>
<exclude>**/Application*</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>


<!-- Jacoco -->
<plugin>
<groupId>org.jacoco</groupId>
Expand All @@ -31,24 +61,48 @@
</executions>
<configuration>
<excludes>
<exclude>com.ecommerceapp.inventory.service.*</exclude>
<exclude>com.ecommerceapp.inventory.model.*</exclude>
<exclude>com.ecommerceapp.inventory.InventoryApplication</exclude>
</excludes>
</configuration>
</plugin>

<!-- PITest-->

<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<id>put-it-together</id>
<goals>
<goal>mutationCoverage</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-junit5-plugin</artifactId>
<version>0.12</version>
</dependency>
</dependencies>
<configuration>
<excludedTestClasses>com.ecommerceapp.inventory.integration.*</excludedTestClasses>
<excludedClasses>com.ecommerceapp.inventory.model.*</excludedClasses>
<outputFormats>
<param>HTML</param>
<param>XML</param>
</outputFormats>
<!-- omitting mutators, testPlugin and verbose for brevity -->
<exportLineCoverage>true</exportLineCoverage>
<!--
it's currently not possible to aggregate timestamped
reports, so it must be disabled.
-->
<timestampedReports>false</timestampedReports>
</configuration>
</plugin>
</plugins>
</build>
Expand Down Expand Up @@ -99,6 +153,7 @@
<groupId>com.ecommerceapp</groupId>
<modelVersion>4.0.0</modelVersion>
<name>inventory</name>
<packaging>jar</packaging>
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
Expand All @@ -112,17 +167,19 @@
<sonar.coverage.jacoco.xmlReportPaths>
${project.basedir}/../inventory/target/site/jacoco/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
<maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
<maven.surefire.plugin.version>2.22.2</maven.surefire.plugin.version>
</properties>

<reporting>
<!-- <reporting>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>2.22.2</version>
<version>${maven.surefire.plugin.version}</version>
</plugin>
</plugins>
</reporting>
</reporting> -->

<version>0.0.1-SNAPSHOT</version>

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>ecomerceapp</artifactId>

<groupId>org.myecommerce</groupId>
<artifactId>ecomerceappParent</artifactId>
<groupId>com.ecommerceapp</groupId>
<modelVersion>4.0.0</modelVersion>
<modules>
<module>shop</module>
Expand All @@ -28,4 +27,5 @@
</plugin>
</plugins>
</build>

</project>
85 changes: 85 additions & 0 deletions shop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,96 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<groupId>org.springframework.boot</groupId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
<phase>test-compile</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>com.ecommerceapp.shop.model.*</exclude>
<exclude>com.ecommerceapp.shop.ShopApplication</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<id>put-it-together</id>
<goals>
<goal>mutationCoverage</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-junit5-plugin</artifactId>
<version>0.12</version>
</dependency>
</dependencies>
<configuration>
<excludedTestClasses>com.ecommerceapp.shop.integration.*</excludedTestClasses>
<excludedClasses>com.ecommerceapp.inventory.model.*</excludedClasses>
<outputFormats>
<param>HTML</param>
<param>XML</param>
</outputFormats>
<!-- omitting mutators, testPlugin and verbose for brevity -->
<exportLineCoverage>true</exportLineCoverage>
<!--
it's currently not possible to aggregate timestamped
reports, so it must be disabled.
-->
<timestampedReports>false</timestampedReports>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<artifactId>inventory</artifactId>
<groupId>com.ecommerceapp</groupId>
<version>0.0.1-SNAPSHOT</version>
<classifier>qa</classifier>
</dependency>
<dependency>
<artifactId>spring-boot-starter-actuator</artifactId>
Expand Down Expand Up @@ -53,6 +136,7 @@
<groupId>com.ecommerceapp</groupId>
<modelVersion>4.0.0</modelVersion>
<name>shop</name>
<packaging>jar</packaging>

<parent>
<artifactId>spring-boot-starter-parent</artifactId>
Expand All @@ -63,6 +147,7 @@

<properties>
<java.version>11</java.version>
<maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
</properties>

<version>0.0.1-SNAPSHOT</version>
Expand Down

0 comments on commit 4e6d177

Please sign in to comment.