From caf9f102f65938638f3a30240f3aaee432dae011 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Mon, 24 Apr 2023 12:54:42 -0500 Subject: [PATCH] Moved stuff so jacoco reporting happens before failures, i think. Moved untested class reporting into pom, out of circleci --- .circleci/config.yml | 6 +-- pom.xml | 103 +++++++++++++++++++++++++------------------ 2 files changed, 60 insertions(+), 49 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3e2ff6f9..01b5b8c9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,6 +26,7 @@ commands: sudo rm /etc/alternatives/java sudo ln -s /usr/lib/jvm/java-17-openjdk-amd64/bin/java /etc/alternatives/java - run: + ## used by jacoco uncovered class reporting in pom.xml name: Install html2text command: | sudo apt-get update @@ -65,11 +66,6 @@ commands: when: always - store_test_results: path: ~/test-results - - run: - name: Find Un-tested Classes - command: | - set +o pipefail && for i in */target/site/jacoco/*/index.html; do html2text -width 500 -nobs $i | sed '1,/^Total/d;' | grep -v Created | sed 's/ \+/ /g' | sed 's/ [[:digit:]]$//' | grep -v 0$ | cut -d' ' -f1; done - when: always - save_cache: paths: - ~/.m2 diff --git a/pom.xml b/pom.xml index 2bc0ecf0..4623b96d 100644 --- a/pom.xml +++ b/pom.xml @@ -206,6 +206,63 @@ true + + exec-maven-plugin + org.codehaus.mojo + 3.0.0 + + + test-coverage-summary + verify + + exec + + + sh + + -c + + /dev/null 2>&1 +if [ "$?" == "0" ]; then + echo "Element\nInstructions Missed\nInstruction Coverage\nBranches Missed\nBranch Coverage\nComplexity Missed\nComplexity Hit\nLines Missed\nLines Hit\nMethods Missed\nMethods Hit\nClasses Missed\nClasses Hit\n" > /tmp/$$.headers + xpath -n -q -e '/html/body/table/tfoot/tr[1]/td/text()' target/site/jacoco/index.html > /tmp/$$.values + paste /tmp/$$.headers /tmp/$$.values | tail +2 | awk -v FS='\t' '{printf("%-20s %s\n",$1,$2)}' + rm /tmp/$$.headers /tmp/$$.values +else + echo "xpath is not installed. Jacoco coverage summary will not be produced here..."; +fi + +which xpath > /dev/null 2>&1 +if [ "$?" == "0" ]; then + echo "Untested classes, per Jacoco:" + echo "-----------------------------" + for i in target/site/jacoco/*/index.html; do + html2text -width 500 -nobs $i | sed '1,/^Total/d;' | grep -v Created | sed 's/ \+/ /g' | sed 's/ [[:digit:]]$//' | grep -v 0$ | cut -d' ' -f1; + done; + echo +else + echo "html2text is not installed. Untested classes from Jacoco will not be printed here..."; +fi + + ]]> + + + + + + org.jacoco jacoco-maven-plugin @@ -249,56 +306,14 @@ post-unit-test - verify + + post-integration-test report - - exec-maven-plugin - org.codehaus.mojo - 3.0.0 - - - test-coverage-summary - verify - - exec - - - sh - - -c - - /dev/null 2>&1 -if [ "$?" == "0" ]; then - echo "Element\nInstructions Missed\nInstruction Coverage\nBranches Missed\nBranch Coverage\nComplexity Missed\nComplexity Hit\nLines Missed\nLines Hit\nMethods Missed\nMethods Hit\nClasses Missed\nClasses Hit\n" > /tmp/$$.headers - xpath -n -q -e '/html/body/table/tfoot/tr[1]/td/text()' target/site/jacoco/index.html > /tmp/$$.values - paste /tmp/$$.headers /tmp/$$.values | tail +2 | awk -v FS='\t' '{printf("%-20s %s\n",$1,$2)}' - rm /tmp/$$.headers /tmp/$$.values -else - echo "xpath is not installed. Jacoco coverage summary will not be produced here.."; -fi - ]]> - - - - - -