mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
Try not manually installing java 17, and parse jacoco outputs more directly (per Cursor)
This commit is contained in:
@ -17,21 +17,13 @@ commands:
|
|||||||
path: << parameters.module >>/target/site/jacoco/jacoco-resources
|
path: << parameters.module >>/target/site/jacoco/jacoco-resources
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
install_java17:
|
check_java_version:
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
name: Install Java 17
|
name: Check Java Version
|
||||||
command: |
|
command: |
|
||||||
sudo apt-get update
|
java -version
|
||||||
sudo apt install -y openjdk-17-jdk
|
echo "Java version check completed"
|
||||||
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
|
|
||||||
sudo apt-get install -y html2text
|
|
||||||
|
|
||||||
mvn_verify:
|
mvn_verify:
|
||||||
steps:
|
steps:
|
||||||
@ -139,7 +131,7 @@ jobs:
|
|||||||
executor: localstack/default
|
executor: localstack/default
|
||||||
steps:
|
steps:
|
||||||
## - localstack/startup
|
## - localstack/startup
|
||||||
- install_java17
|
- check_java_version
|
||||||
- mvn_verify
|
- mvn_verify
|
||||||
- check_middleware_api_versions
|
- check_middleware_api_versions
|
||||||
|
|
||||||
@ -147,7 +139,7 @@ jobs:
|
|||||||
executor: localstack/default
|
executor: localstack/default
|
||||||
steps:
|
steps:
|
||||||
## - localstack/startup
|
## - localstack/startup
|
||||||
- install_java17
|
- check_java_version
|
||||||
- mvn_verify
|
- mvn_verify
|
||||||
- check_middleware_api_versions
|
- check_middleware_api_versions
|
||||||
- mvn_jar_deploy
|
- mvn_jar_deploy
|
||||||
|
26
pom.xml
26
pom.xml
@ -249,25 +249,25 @@ echo " See also target/site/jacoco/index.html"
|
|||||||
echo " and https://www.jacoco.org/jacoco/trunk/doc/counters.html"
|
echo " and https://www.jacoco.org/jacoco/trunk/doc/counters.html"
|
||||||
echo "------------------------------------------------------------"
|
echo "------------------------------------------------------------"
|
||||||
|
|
||||||
if which xpath > /dev/null 2>&1; then
|
# Parse Jacoco HTML coverage summary using grep and sed
|
||||||
|
if [ -f target/site/jacoco/index.html ]; 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
|
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
|
# Extract values from the footer row of the coverage table
|
||||||
|
grep -A 12 '<tfoot>' target/site/jacoco/index.html | grep '<td>' | sed 's/<td>\([^<]*\)<\/td>/\1/' | tr '\n' '\t' | sed 's/\t$/\n/' > /tmp/$$.values
|
||||||
paste /tmp/$$.headers /tmp/$$.values | tail +2 | awk -v FS='\t' '{printf("%-20s %s\n",$1,$2)}'
|
paste /tmp/$$.headers /tmp/$$.values | tail +2 | awk -v FS='\t' '{printf("%-20s %s\n",$1,$2)}'
|
||||||
rm /tmp/$$.headers /tmp/$$.values
|
rm /tmp/$$.headers /tmp/$$.values
|
||||||
else
|
else
|
||||||
echo "xpath is not installed. Jacoco coverage summary will not be produced here...";
|
echo "Jacoco coverage summary could not be parsed...";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if which html2text > /dev/null 2>&1; then
|
echo "Untested classes, per Jacoco:"
|
||||||
echo "Untested classes, per Jacoco:"
|
echo "-----------------------------"
|
||||||
echo "-----------------------------"
|
# Parse Jacoco XML reports directly to find classes with 0% coverage
|
||||||
for i in target/site/jacoco/*/index.html; do
|
find target/site/jacoco -name "jacoco.xml" -exec grep -l '<counter type="LINE" missed="[1-9]' {} \; | while read xmlfile; 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;
|
# Extract class names from XML files that have missed lines
|
||||||
done;
|
grep -A 1 '<class name=' "$xmlfile" | grep -B 1 '<counter type="LINE" missed="[1-9]' | grep '<class name=' | sed 's/.*name="\([^"]*\)".*/\1/' | sort -u
|
||||||
echo
|
done | sort -u
|
||||||
else
|
echo
|
||||||
echo "html2text is not installed. Untested classes from Jacoco will not be printed here...";
|
|
||||||
fi
|
|
||||||
|
|
||||||
]]>
|
]]>
|
||||||
</argument>
|
</argument>
|
||||||
|
Reference in New Issue
Block a user