Skip to content

Commit

Permalink
test openclover
Browse files Browse the repository at this point in the history
  • Loading branch information
kernelsam committed May 13, 2024
1 parent 62a9e60 commit 57e095f
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 66 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/maven-openclover.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: maven jacoco

on:
push:
branches-ignore: [main]
pull_request:
branches: [main]

permissions:
contents: read
pull-requests: write

jobs:
maven:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- java-version: "17"
java-distribution: "temurin"
senzingapi-runtime-version: "staging-v4"

steps:
- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: ${{ matrix.java-distribution }}

- name: install Senzing API
uses: senzing-factory/github-action-install-senzing-api@v3
with:
senzingapi-runtime-version: ${{ matrix.senzingapi-runtime-version }}

- name: Build with Maven
run: |
# temp skip checkstyle and spotbugs to verify coverage
# -Dmaven.test.failure.ignore=true
mvn clean install -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Popenclover -Dsenzing.support.dir="/opt/senzing/data"
ls ${{ github.workspace }}/target
ls ${{ github.workspace }}/target/site/clover
grep -Ril *.xml target
- uses: danhunsaker/clover-reporter-action@v0.2.17-clover
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
clover-file: ./coverage/clover.xml

- name: Fail PR if overall coverage is less than 80%
if: ${{ steps.jacoco.outputs.coverage-overall < 80.0 }}
uses: actions/github-script@v6
with:
script: |
core.setFailed('Overall coverage is less than 80%!')
161 changes: 95 additions & 66 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -240,82 +240,111 @@
<profile>
<id>jacoco</id>
<build>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<!--configuration>
<formats>XML</formats>
</configuration-->
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<!--configuration>
<formats>XML</formats>
</configuration-->
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>openclover</id>
<build>
<plugins>
<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId> <!-- maven-clover2-plugin for version <= 4.0.6 -->
<version>4.5.2</version>
<executions>
<execution>
<id>clover</id>
<phase>verify</phase>
<goals>
<goal>instrument</goal>
<goal>check</goal>
<goal>clover</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>checkstyle</id>
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>spotbugs</id>
<build>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.5.0</version>
<configuration>
<plugins>
<plugin>
<groupId>com.h3xstream.findsecbugs</groupId>
<artifactId>findsecbugs-plugin</artifactId>
<version>1.13.0</version>
</plugin>
</plugins>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugins>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.5.0</version>
<configuration>
<plugins>
<plugin>
<groupId>com.h3xstream.findsecbugs</groupId>
<artifactId>findsecbugs-plugin</artifactId>
<version>1.13.0</version>
</plugin>
</plugins>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Expand Down

0 comments on commit 57e095f

Please sign in to comment.