Add script to collect JaCoCo reports and update CircleCI config to use it

This commit is contained in:
2025-07-03 15:41:09 -05:00
parent 0aaf184962
commit 8531feef70
2 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1,26 @@
#!/bin/bash
############################################################################
## Script to collect all JaCoCo reports from different modules into a
## single directory for easier artifact storage in CI.
############################################################################
mkdir -p /home/circleci/jacoco-reports/
##############################################################
## Find all module directories that have target/site/jacoco ##
##############################################################
for module_dir in */; do
if [ -d "${module_dir}target/site/jacoco" ]; then
module_name=$(basename "${module_dir%/}")
target_dir="/home/circleci/jacoco-reports/${module_name}"
echo "Collecting JaCoCo reports for module: ${module_name}"
cp -r "${module_dir}target/site/jacoco" "${target_dir}"
echo "Copied JaCoCo reports for ${module_name} to ${target_dir}"
fi
done
echo "All JaCoCo reports collected to /home/circleci/jacoco-reports/"

View File

@ -36,9 +36,13 @@ commands:
name: Run Maven Verify
command: |
mvn -s .circleci/mvn-settings.xml -T4 --no-transfer-progress verify
- run:
name: Collect JaCoCo reports
command: .circleci/collect-jacoco-reports.sh
when: always
- store_artifacts:
name: Store Jacoco reports
path: "*/target/site/jacoco/"
path: /home/circleci/jacoco-reports
destination: jacoco-reports
when: always
- run:
name: Concatenate test output files