diff --git a/.circleci/collect-jacoco-reports.sh b/.circleci/collect-jacoco-reports.sh new file mode 100755 index 00000000..dca6bbad --- /dev/null +++ b/.circleci/collect-jacoco-reports.sh @@ -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/" \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml index a50edc3a..748c1a64 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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