From 5f12626c0cd75d0b3b84a5ddb5df7afc07b1bfe5 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Thu, 21 Jul 2022 09:29:52 -0500 Subject: [PATCH] Add jacoco coverage reporting --- .circleci/config.yml | 4 +- pom.xml | 88 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0f486b7b..a35d7951 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,6 +26,8 @@ commands: name: Run Maven command: | mvn -s .circleci/mvn-settings.xml << parameters.maven_subcommand >> + - store_artifacts: + path: target/site/jacoco - run: name: Save test results command: | @@ -44,7 +46,7 @@ jobs: executor: java17 steps: - run_maven: - maven_subcommand: test + maven_subcommand: verify - slack/notify: event: fail diff --git a/pom.xml b/pom.xml index bcf0dd8f..84b43049 100644 --- a/pom.xml +++ b/pom.xml @@ -40,6 +40,8 @@ 17 true true + true + 0.75 @@ -117,6 +119,11 @@ + + org.apache.maven.plugins + maven-resources-plugin + 3.2.0 + @@ -131,6 +138,9 @@ org.apache.maven.plugins maven-surefire-plugin 3.0.0-M5 + + @{jaCoCoArgLine} + org.apache.maven.plugins @@ -164,6 +174,84 @@ + + org.jacoco + jacoco-maven-plugin + 0.8.8 + + + pre-unit-test + + prepare-agent + + + jaCoCoArgLine + + + + unit-test-check + + check + + + + ${coverage.haltOnFailure} + + + BUNDLE + + + INSTRUCTION + COVEREDRATIO + ${coverage.instructionCoveredRatioMinimum} + + + + + + + + post-unit-test + verify + + report + + + + + + exec-maven-plugin + org.codehaus.mojo + 3.0.0 + + + test-coverage-summary + verify + + exec + + + sh + + -c + + /tmp/$$.headers +xpath -q -e '/html/body/table/tfoot/tr[1]/td/text()' target/site/jacoco/index.html > /tmp/$$.values +echo +echo "Jacoco coverage summary report:" +echo " See also target/site/jacoco/index.html" +echo " and https://www.jacoco.org/jacoco/trunk/doc/counters.html" +echo "------------------------------------------------------------" +paste /tmp/$$.headers /tmp/$$.values | tail +2 | awk -v FS='\t' '{printf("%-20s %s\n",$1,$2)}' +rm /tmp/$$.headers /tmp/$$.values + ]]> + + + + + +