mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-17 12:40:44 +00:00
- Split mvn_test job into separate build, test, and api_version_check jobs - Run test and api_version_check in parallel after build completes - Both parallel jobs use compiled outputs from build via Maven cache - Remove unnecessary check_java_version steps - Remove unused test-logs artifact storage - Add jacoco:report to generate coverage reports - Maintain sequential execution in mvn_deploy job
219 lines
6.7 KiB
YAML
219 lines
6.7 KiB
YAML
version: 2.1
|
|
|
|
orbs:
|
|
localstack: localstack/platform@2.1
|
|
browser-tools: circleci/browser-tools@1.4.7
|
|
|
|
commands:
|
|
mvn_build:
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
keys:
|
|
- v1-dependencies-{{ checksum "pom.xml" }}
|
|
- browser-tools/install-chrome
|
|
- browser-tools/install-chromedriver
|
|
- run:
|
|
name: Write .env
|
|
command: |
|
|
echo "RDBMS_PASSWORD=$RDBMS_PASSWORD" >> qqq-sample-project/.env
|
|
- run:
|
|
name: Run Maven Compile
|
|
command: |
|
|
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode compile
|
|
- save_cache:
|
|
paths:
|
|
- ~/.m2
|
|
key: v1-dependencies-{{ checksum "pom.xml" }}
|
|
|
|
mvn_test:
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
keys:
|
|
- v1-dependencies-{{ checksum "pom.xml" }}
|
|
- run:
|
|
name: Run Maven Test
|
|
command: |
|
|
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode test jacoco:report
|
|
- store_artifacts:
|
|
path: "*/target/site/jacoco/"
|
|
when: always
|
|
- run:
|
|
name: Concatenate test output files
|
|
command: |
|
|
# 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
|
|
- store_artifacts:
|
|
path: /home/circleci/test-output-artifacts
|
|
destination: test-output
|
|
when: always
|
|
- run:
|
|
name: Save test results
|
|
command: |
|
|
mkdir -p ~/test-results/junit/
|
|
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \;
|
|
when: always
|
|
- store_test_results:
|
|
path: ~/test-results
|
|
|
|
check_middleware_api_versions:
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
keys:
|
|
- v1-dependencies-{{ checksum "pom.xml" }}
|
|
- run:
|
|
name: Build and Run ValidateApiVersions
|
|
command: |
|
|
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode install -DskipTests
|
|
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode -pl qqq-middleware-javalin package appassembler:assemble -DskipTests
|
|
qqq-middleware-javalin/target/appassembler/bin/ValidateApiVersions -r $(pwd)
|
|
|
|
mvn_jar_deploy:
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Adjust pom version
|
|
command: |
|
|
.circleci/adjust-pom-version.sh
|
|
- restore_cache:
|
|
keys:
|
|
- v1-dependencies-{{ checksum "pom.xml" }}
|
|
- run:
|
|
name: Run Maven Jar Deploy
|
|
command: |
|
|
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode flatten:flatten jar:jar deploy:deploy
|
|
- save_cache:
|
|
paths:
|
|
- ~/.m2
|
|
key: v1-dependencies-{{ checksum "pom.xml" }}
|
|
|
|
install_asciidoctor:
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Install asciidoctor
|
|
command: |
|
|
sudo apt-get update
|
|
sudo apt install -y asciidoctor
|
|
|
|
run_asciidoctor:
|
|
steps:
|
|
- run:
|
|
name: Run asciidoctor
|
|
command: |
|
|
cd docs
|
|
asciidoctor -a docinfo=shared index.adoc
|
|
- store_artifacts:
|
|
path: docs/index.html
|
|
when: always
|
|
|
|
jobs:
|
|
build:
|
|
executor: localstack/default
|
|
steps:
|
|
- mvn_build
|
|
|
|
test:
|
|
executor: localstack/default
|
|
steps:
|
|
- mvn_test
|
|
|
|
api_version_check:
|
|
executor: localstack/default
|
|
steps:
|
|
- check_middleware_api_versions
|
|
|
|
mvn_deploy:
|
|
executor: localstack/default
|
|
steps:
|
|
- mvn_build
|
|
- mvn_test
|
|
- check_middleware_api_versions
|
|
- mvn_jar_deploy
|
|
|
|
publish_asciidoc:
|
|
executor: localstack/default
|
|
steps:
|
|
- install_asciidoctor
|
|
- run_asciidoctor
|
|
|
|
workflows:
|
|
test_only:
|
|
jobs:
|
|
- build:
|
|
context: [ qqq-maven-registry-credentials, build-qqq-sample-app ]
|
|
filters:
|
|
branches:
|
|
ignore: /(dev|integration.*)/
|
|
tags:
|
|
ignore: /(version|snapshot)-.*/
|
|
- test:
|
|
context: [ qqq-maven-registry-credentials, build-qqq-sample-app ]
|
|
requires:
|
|
- build
|
|
filters:
|
|
branches:
|
|
ignore: /(dev|integration.*)/
|
|
tags:
|
|
ignore: /(version|snapshot)-.*/
|
|
- api_version_check:
|
|
context: [ qqq-maven-registry-credentials, build-qqq-sample-app ]
|
|
requires:
|
|
- build
|
|
filters:
|
|
branches:
|
|
ignore: /(dev|integration.*)/
|
|
tags:
|
|
ignore: /(version|snapshot)-.*/
|
|
|
|
deploy:
|
|
jobs:
|
|
- mvn_deploy:
|
|
context: [ qqq-maven-registry-credentials, build-qqq-sample-app ]
|
|
filters:
|
|
branches:
|
|
only: /(dev|integration.*)/
|
|
tags:
|
|
only: /(version|snapshot)-.*/
|
|
- publish_asciidoc:
|
|
filters:
|
|
branches:
|
|
only: /dev/
|