version: 2.1 orbs: localstack: localstack/platform@2.1 browser-tools: circleci/browser-tools@1.4.7 commands: check_java_version: steps: - run: name: Check Java Version command: | java -version echo "Java version check completed" mvn_verify: 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 Verify command: | mvn -s .circleci/mvn-settings.xml -T4 --batch-mode verify - store_artifacts: path: "*/target/site/jacoco/" when: always - store_artifacts: path: "*/target/test-logs/" 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}" 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 - save_cache: paths: - ~/.m2 key: v1-dependencies-{{ checksum "pom.xml" }} 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: mvn_test: executor: localstack/default steps: ## - localstack/startup - check_java_version - mvn_verify - check_middleware_api_versions mvn_deploy: executor: localstack/default steps: ## - localstack/startup - check_java_version - mvn_verify - check_middleware_api_versions - mvn_jar_deploy publish_asciidoc: executor: localstack/default steps: - install_asciidoctor - run_asciidoctor workflows: test_only: jobs: - mvn_test: context: [ qqq-maven-registry-credentials, build-qqq-sample-app ] 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/