move concatenate-test-output to its own script; switch back to verify, so we get jacoco reports; switch to no-tranffer-progress from batch-mode, so we still get color output

This commit is contained in:
2025-07-03 15:24:54 -05:00
parent 14a3dad3c8
commit 0aaf184962
2 changed files with 59 additions and 46 deletions

View File

@ -0,0 +1,48 @@
#!/bin/bash
############################################################################
## Script to concatenate all .txt files in the surefire-reports directory
## into a single artifact that can be stored in CI.
############################################################################
mkdir -p /home/circleci/test-output-artifacts/
###################################################################
## Find all module directories that have target/surefire-reports ##
###################################################################
for module_dir in */; do
if [ -d "${module_dir}target/surefire-reports" ]; then
module_name=$(basename "${module_dir%/}")
output_file="/home/circleci/test-output-artifacts/${module_name}-test-output.txt"
echo "Processing module: ${module_name}"
echo "Output file: ${output_file}"
##################################################################
## Concatenate all .txt files in the surefire-reports directory ##
##################################################################
if [ -n "$(find "${module_dir}target/surefire-reports" -name "*.txt" -type f)" ]; then
echo "=== Test Output for ${module_name} ===" > "${output_file}"
echo "Generated at: $(date)" >> "${output_file}"
echo "==========================================" >> "${output_file}"
echo "" >> "${output_file}"
##############################################
## Sort files to ensure consistent ordering ##
##############################################
find "${module_dir}target/surefire-reports" -name "*.txt" -type f | sort | while read -r txt_file; do
echo "--- File: $(basename "${txt_file}") ---" >> "${output_file}"
cat "${txt_file}" >> "${output_file}"
echo "" >> "${output_file}"
echo "--- End of $(basename "${txt_file}") ---" >> "${output_file}"
echo "" >> "${output_file}"
echo "" >> "${output_file}"
echo "" >> "${output_file}"
done
echo "Concatenated test output for ${module_name} to ${output_file}"
else
echo "No .txt files found in ${module_dir}target/surefire-reports"
fi
fi
done

View File

@ -20,64 +20,29 @@ commands:
- run: - run:
name: Run Maven Compile name: Run Maven Compile
command: | command: |
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode compile mvn -s .circleci/mvn-settings.xml -T4 --no-transfer-progress compile
- save_cache: - save_cache:
paths: paths:
- ~/.m2 - ~/.m2
key: v1-dependencies-{{ checksum "pom.xml" }} key: v1-dependencies-{{ checksum "pom.xml" }}
mvn_test: mvn_verify:
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- v1-dependencies-{{ checksum "pom.xml" }} - v1-dependencies-{{ checksum "pom.xml" }}
- run: - run:
name: Run Maven Test name: Run Maven Verify
command: | command: |
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode test jacoco:report mvn -s .circleci/mvn-settings.xml -T4 --no-transfer-progress verify
- store_artifacts: - store_artifacts:
name: Store Jacoco reports
path: "*/target/site/jacoco/" path: "*/target/site/jacoco/"
when: always when: always
- run: - run:
name: Concatenate test output files name: Concatenate test output files
command: | command: .circleci/concatenate-test-output.sh
# Create artifacts directory
mkdir -p /home/circleci/test-output-artifacts/
# Find all module directories that have target/surefire-reports
for module_dir in */; do
if [ -d "${module_dir}target/surefire-reports" ]; then
module_name=$(basename "${module_dir%/}")
output_file="/home/circleci/test-output-artifacts/${module_name}-test-output.txt"
echo "Processing module: ${module_name}"
echo "Output file: ${output_file}"
# Concatenate all .txt files in the surefire-reports directory
if [ -n "$(find "${module_dir}target/surefire-reports" -name "*.txt" -type f)" ]; then
echo "=== Test Output for ${module_name} ===" > "${output_file}"
echo "Generated at: $(date)" >> "${output_file}"
echo "==========================================" >> "${output_file}"
echo "" >> "${output_file}"
# Sort files to ensure consistent ordering
find "${module_dir}target/surefire-reports" -name "*.txt" -type f | sort | while read -r txt_file; do
echo "--- File: $(basename "${txt_file}") ---" >> "${output_file}"
cat "${txt_file}" >> "${output_file}"
echo "" >> "${output_file}"
echo "--- End of $(basename "${txt_file}") ---" >> "${output_file}"
echo "" >> "${output_file}"
echo "" >> "${output_file}"
echo "" >> "${output_file}"
done
echo "Concatenated test output for ${module_name} to ${output_file}"
else
echo "No .txt files found in ${module_dir}target/surefire-reports"
fi
fi
done
when: always when: always
- store_artifacts: - store_artifacts:
path: /home/circleci/test-output-artifacts path: /home/circleci/test-output-artifacts
@ -101,8 +66,8 @@ commands:
- run: - run:
name: Build and Run ValidateApiVersions name: Build and Run ValidateApiVersions
command: | command: |
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode install -DskipTests mvn -s .circleci/mvn-settings.xml -T4 --no-transfer-progress install -DskipTests
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode -pl qqq-middleware-javalin package appassembler:assemble -DskipTests mvn -s .circleci/mvn-settings.xml -T4 --no-transfer-progress -pl qqq-middleware-javalin package appassembler:assemble -DskipTests
qqq-middleware-javalin/target/appassembler/bin/ValidateApiVersions -r $(pwd) qqq-middleware-javalin/target/appassembler/bin/ValidateApiVersions -r $(pwd)
mvn_jar_deploy: mvn_jar_deploy:
@ -118,7 +83,7 @@ commands:
- run: - run:
name: Run Maven Jar Deploy name: Run Maven Jar Deploy
command: | command: |
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode flatten:flatten jar:jar deploy:deploy mvn -s .circleci/mvn-settings.xml -T4 --no-transfer-progress flatten:flatten jar:jar deploy:deploy
- save_cache: - save_cache:
paths: paths:
- ~/.m2 - ~/.m2
@ -153,7 +118,7 @@ jobs:
test: test:
executor: localstack/default executor: localstack/default
steps: steps:
- mvn_test - mvn_verify
api_version_check: api_version_check:
executor: localstack/default executor: localstack/default
@ -164,7 +129,7 @@ jobs:
executor: localstack/default executor: localstack/default
steps: steps:
- mvn_build - mvn_build
- mvn_test - mvn_verify
- check_middleware_api_versions - check_middleware_api_versions
- mvn_jar_deploy - mvn_jar_deploy