Skip to content

Commit

Permalink
#239: Add test coverage (#272)
Browse files Browse the repository at this point in the history
* Fixed #239: add jacoco for test coverage
- remove no more needed clover configuration
* #239: add codecov action
  • Loading branch information
sparsick authored Jun 1, 2021
1 parent 079f87a commit 6f681be
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 42 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,11 @@ jobs:

- name: Spotbugs check
run: mvn --batch-mode --errors verify --file pom.xml '-Pspotbugs'

- name: JaCoCo report
run: mvn --batch-mode --errors jacoco:report --file pom.xml

- name: Codecov
uses: codecov/codecov-action@v1
with:
files: target/site/jacoco/jacoco.xml
66 changes: 24 additions & 42 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
<wagon.version>2.2</wagon.version>
<gmaven.provider.selection>2.0</gmaven.provider.selection>
<groovy.version>3.0.7</groovy.version>

<clover.version>3.3.0</clover.version>
<clover.license>/private/reficio/clover.license</clover.license>
<jacoco.version>0.8.7</jacoco.version>
</properties>

<licenses>
Expand Down Expand Up @@ -362,6 +360,9 @@
<executions>
<execution>
<goals>
<goal>addSources</goal> <!-- important for jacoco that it recognizes to measure the coverage of classes in src/main/groovy-->
<goal>addTestSources</goal> <!-- important for jacoco that it recognizes to use tests in src/test/groovy for coverage measuring-->
<goal>compile</goal>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
Expand Down Expand Up @@ -401,6 +402,18 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal> <!-- add javaagent to surefire's test run -->
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
Expand All @@ -419,7 +432,6 @@
<excludes>
<exclude>target/**</exclude>
<exclude>**/resources/**</exclude>
<exclude>.clover/**</exclude>
<exclude>.dependabot/**</exclude>
</excludes>
<useDefaultExcludes>true</useDefaultExcludes>
Expand Down Expand Up @@ -602,32 +614,6 @@
</build>
</profile>

<profile>
<id>clover</id>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<version>${clover.version}</version>
<executions>
<execution>
<id>clover</id>
</execution>
</executions>
<configuration>
<generateHtml>true</generateHtml>
<generateXml>true</generateXml>
<excludes>
<exclude>**/Logger.java</exclude>
</excludes>
<licenseLocation>${clover.license}</licenseLocation>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>release</id>
<build>
Expand Down Expand Up @@ -683,6 +669,11 @@

<profile>
<id>it</id>
<properties>
<!-- Enable recording of coverage during execution of maven-invoker-plugin -->
<jacoco.propertyName>invoker.mavenOpts</jacoco.propertyName>
<jacoco.includes>org.reficio.p2.*</jacoco.includes>
</properties>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -711,6 +702,9 @@
<localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
<preBuildHookScript>setup.groovy</preBuildHookScript>
<postBuildHookScript>validate.groovy</postBuildHookScript>
<extraArtifacts>
<extraArtifact>org.jacoco:org.jacoco.agent:${jacoco.version}:jar:runtime</extraArtifact>
</extraArtifacts>
<scriptVariables>
<originalLocalRepository>${settings.localRepository}</originalLocalRepository>
</scriptVariables>
Expand Down Expand Up @@ -807,18 +801,6 @@
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<configuration>
<generateHtml>true</generateHtml>
<generateXml>true</generateXml>
<excludes>
<exclude>**/Logger.java</exclude>
</excludes>
<licenseLocation>${clover.license}</licenseLocation>
</configuration>
</plugin>
</plugins>
</reporting>

Expand Down

0 comments on commit 6f681be

Please sign in to comment.