Skip to content

Commit

Permalink
Gather code coverage data for integration tests in maven-invoker-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ascopes committed Dec 3, 2023
1 parent 2f0b54d commit 79fffd1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 68 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ target/

# JVM agent descriptors
.attach*

# Stuff that I generate when I have lost all hope in the world
/build.log

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Java 11+](https://img.shields.io/badge/Java-11+-blue?logo=openjdk&logoColor=white)
[![Build Status](https://github.com/ascopes/protobuf-maven-plugin/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/ascopes/protobuf-maven-plugin/actions/workflows/build.yml)
<!--[![codecov](https://codecov.io/gh/ascopes/protobuf-maven-plugin/graph/badge.svg?token=bW37uc04cL)](https://codecov.io/gh/ascopes/protobuf-maven-plugin)-->
[![codecov](https://codecov.io/gh/ascopes/protobuf-maven-plugin/graph/badge.svg?token=bW37uc04cL)](https://codecov.io/gh/ascopes/protobuf-maven-plugin)

# protobuf-maven-plugin

Expand Down
29 changes: 17 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,8 @@

<configuration>
<addTestClassPath>true</addTestClassPath>
<cloneClean>true</cloneClean>
<cloneProjectsTo>${project.build.directory}/it/tests</cloneProjectsTo>
<failIfNoProjects>true</failIfNoProjects>
<localRepositoryPath>${project.build.directory}/it/m2</localRepositoryPath>
<postBuildHookScript>test</postBuildHookScript>
<settingsFile>src/it/settings.xml</settingsFile>
<showErrors>true</showErrors>
<showVersion>true</showVersion>
<streamLogsOnFailures>true</streamLogsOnFailures>
Expand Down Expand Up @@ -519,27 +515,36 @@

<executions>
<execution>
<id>generate-coverage-argline</id>
<id>prepare-coverage-agent-surefire</id>
<phase>initialize</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>

<execution>
<id>prepare-coverage-agent-invoker</id>
<phase>initialize</phase>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco.bin</destFile>
<!-- Append to ensure multiple invoker test calls are included -->
<append>true</append>
<!-- Ensure `${invoker.mavenOpts}` is set in the invoker.properties as well
if maven.argLine is overridden. -->
<includes>io.github.ascopes.protobufmavenplugin.*</includes>
<propertyName>invoker.mavenOpts</propertyName>
</configuration>
</execution>

<execution>
<id>generate-coverage-report</id>
<phase>test</phase>
<id>generate-coverage-reports</id>
<goals>
<goal>report</goal>
<goal>report-integration</goal>
<goal>report-aggregate</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco.bin</dataFile>
<outputDirectory>${project.build.directory}/site/jacoco</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
3 changes: 2 additions & 1 deletion src/it/invoker.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
invoker.mavenOpts = \
-Dplugin-group-id=${project.groupId} \
-Dplugin-artifact-id=${project.artifactId} \
-Dplugin-version=${project.version}
-Dplugin-version=${project.version} \
${invoker.mavenOpts}
54 changes: 0 additions & 54 deletions src/it/settings.xml

This file was deleted.

0 comments on commit 79fffd1

Please sign in to comment.