Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c30a30754 | ||
|
|
a9d51ebd47 | ||
|
|
284c69aa3e
|
||
|
|
fb30d9acc5
|
||
|
|
ee8953bd93 | ||
|
|
563f88bdad | ||
|
|
4cb662f076
|
No files matched your search
@@ -72,6 +72,7 @@ jobs:
|
||||
bash tests/test_maven_ci_push.sh
|
||||
bash tests/test_create_github_release.sh
|
||||
bash tests/test_maven_ci_cache.sh
|
||||
bash tests/test_maven_test_results.sh
|
||||
bash tests/test_maven_ci_install.sh
|
||||
bash tests/test_snapshot_refresh.sh
|
||||
bash tests/test_maven_settings_output.sh
|
||||
|
||||
@@ -81,6 +81,7 @@ test-pipelines: pack
|
||||
bash tests/test_maven_ci_push.sh
|
||||
bash tests/test_create_github_release.sh
|
||||
bash tests/test_maven_ci_cache.sh
|
||||
bash tests/test_maven_test_results.sh
|
||||
bash tests/test_maven_ci_install.sh
|
||||
bash tests/test_snapshot_refresh.sh
|
||||
bash tests/test_maven_settings_output.sh
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
description: >
|
||||
Publishes artifacts to Maven Central (Sonatype Central Portal)
|
||||
- Restores Maven dependency cache
|
||||
- Debugs Maven settings to verify configuration
|
||||
- Configures Maven credentials without logging settings
|
||||
- Sets up GPG signing for artifact verification
|
||||
- Deploys signed artifacts to Maven Central using release profile
|
||||
- Deploys signed artifacts and waits for confirmed Central release publication
|
||||
- Saves Maven cache for future builds
|
||||
|
||||
steps:
|
||||
@@ -15,6 +14,9 @@ steps:
|
||||
command: <<include(scripts/mvn_jar_deploy_gpg_setup.sh)>>
|
||||
- run:
|
||||
name: Publish to Sonatype Central (releases and SNAPSHOTs)
|
||||
# Central's native publication wait can be silent for its 30-minute limit.
|
||||
# Let Maven return its real result before CircleCI's inactivity watchdog.
|
||||
no_output_timeout: 35m
|
||||
command: <<include(scripts/mvn_jar_deploy.sh)>>
|
||||
- save_cache:
|
||||
paths:
|
||||
|
||||
@@ -27,7 +27,10 @@ set -e
|
||||
##############################################
|
||||
# Resolve CI-friendly coordinates without stripping parent/BOM configuration.
|
||||
# Flatten must share this Maven process so deploy uses the resolved project POMs.
|
||||
# Central 0.8.x: this completion flag overrides inherited literal waitUntil=uploaded.
|
||||
# Do not report a release as successful until Central confirms publication.
|
||||
mvn -s /tmp/circleci/mvn-settings.xml -P release -B -DskipTests \
|
||||
-Dgpg.keyname="$GPG_KEYNAME" -Dgpg.passphrase="$GPG_PASSPHRASE" \
|
||||
-DwaitForPublishCompletion=true \
|
||||
-Dflatten.mode=resolveCiFriendliesOnly -DupdatePomFile=true \
|
||||
org.codehaus.mojo:flatten-maven-plugin:1.7.3:flatten deploy
|
||||
@@ -1,26 +1,10 @@
|
||||
#!/bin/bash
|
||||
# Collect unit and integration JUnit reports without losing same-named module suites.
|
||||
set -euo pipefail
|
||||
|
||||
############################################################################
|
||||
## mvn_verify_save_test_results.sh
|
||||
## Test Results Collection Script
|
||||
##
|
||||
## This script collects JUnit test results from Maven Surefire reports
|
||||
## and saves them to the CircleCI test results directory for reporting.
|
||||
## It finds all XML test result files and copies them to the standard location.
|
||||
##
|
||||
## Process:
|
||||
## 1. Creates test results directory structure
|
||||
## 2. Finds all Surefire XML report files
|
||||
## 3. Copies test results to CircleCI test results directory
|
||||
##
|
||||
## Usage: Called by CircleCI orb command mvn_verify
|
||||
## Output: Collects and saves JUnit test results for CircleCI reporting
|
||||
############################################################################
|
||||
|
||||
set -e
|
||||
|
||||
#############################################################
|
||||
## Create test results directory and collect JUnit reports ##
|
||||
#############################################################
|
||||
mkdir -p ~/test-results/junit/
|
||||
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \;
|
||||
mkdir -p "$HOME/test-results/junit"
|
||||
while IFS= read -r -d '' report; do
|
||||
destination="$HOME/test-results/junit/${report#./}"
|
||||
mkdir -p "$(dirname "$destination")"
|
||||
cp "$report" "$destination"
|
||||
done < <(find . -type f \( -path '*/target/surefire-reports/TEST-*.xml' -o -path '*/target/failsafe-reports/TEST-*.xml' \) -print0)
|
||||
@@ -63,6 +63,17 @@ class MavenCiContract(unittest.TestCase):
|
||||
self.assertIn("-Dgpg.keyname=", deploy)
|
||||
self.assertIn("-DskipTests", deploy)
|
||||
|
||||
def test_publication_wait_outlives_central_native_timeout(self):
|
||||
steps = read("src/commands/mvn_jar_deploy.yml")["steps"]
|
||||
publish = next(s["run"] for s in steps if "mvn_jar_deploy.sh" in str(s))
|
||||
# Central 0.8.x waits silently up to 1800 seconds; the default Circle
|
||||
# ten-minute inactivity limit killed an already-uploaded RC in production.
|
||||
timeout = publish["no_output_timeout"]
|
||||
self.assertTrue(timeout.endswith("m"))
|
||||
self.assertGreater(int(timeout[:-1]), 30)
|
||||
self.assertLessEqual(int(timeout[:-1]), 40)
|
||||
self.assertNotIn("max_auto_reruns", publish)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -49,10 +49,26 @@ release
|
||||
-DskipTests
|
||||
-Dgpg.keyname=test-key
|
||||
-Dgpg.passphrase=test-passphrase
|
||||
-DwaitForPublishCompletion=true
|
||||
-Dflatten.mode=resolveCiFriendliesOnly
|
||||
-DupdatePomFile=true
|
||||
org.codehaus.mojo:flatten-maven-plugin:1.7.3:flatten
|
||||
deploy
|
||||
EOF
|
||||
diff -u "$test_dir/expected-args" "$test_dir/mvn-args"
|
||||
# A Central validation failure or publication timeout must fail this wrapper.
|
||||
cat > "$test_dir/bin/mvn" <<'EOF'
|
||||
#!/bin/bash
|
||||
exit 42
|
||||
EOF
|
||||
set +e
|
||||
PATH="$test_dir/bin:$PATH" GPG_KEYNAME=test-key GPG_PASSPHRASE=test-passphrase \
|
||||
bash "$test_dir/deploy.sh" > "$test_dir/failure-output" 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
if [ "$status" -ne 42 ]; then
|
||||
echo 'Deploy did not preserve Maven publication failure' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'Maven settings setup and deploy output are safe; deploy arguments preserved'
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
# Exercise the actual collector with colliding suites, spaces and non-JUnit XML.
|
||||
set -euo pipefail
|
||||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")/../src/scripts" && pwd)
|
||||
scratch=$(mktemp -d)
|
||||
trap 'rm -rf "$scratch"' EXIT
|
||||
export HOME="$scratch/home"
|
||||
mkdir -p "$scratch/repo"
|
||||
cd "$scratch/repo"
|
||||
|
||||
# A repository with no tests is valid.
|
||||
bash "$script_dir/mvn_verify_save_test_results.sh"
|
||||
[[ -d "$HOME/test-results/junit" ]]
|
||||
[[ -z "$(find "$HOME/test-results/junit" -type f -print)" ]]
|
||||
|
||||
for module in 'module one' 'module two'; do
|
||||
for runner in surefire failsafe; do
|
||||
report="$module/target/$runner-reports/TEST-shared.xml"
|
||||
mkdir -p "$(dirname "$report")"
|
||||
printf '<testsuite name="%s %s"/>\n' "$module" "$runner" > "$report"
|
||||
done
|
||||
done
|
||||
printf '<failsafe-summary/>\n' > 'module one/target/failsafe-reports/failsafe-summary.xml'
|
||||
printf '<configuration/>\n' > 'module one/target/surefire-reports/configuration.xml'
|
||||
mkdir -p unrelated
|
||||
printf '<testsuite/>\n' > unrelated/TEST-ignore.xml
|
||||
bash "$script_dir/mvn_verify_save_test_results.sh"
|
||||
[[ "$(find "$HOME/test-results/junit" -type f | wc -l)" -eq 4 ]]
|
||||
for module in 'module one' 'module two'; do
|
||||
for runner in surefire failsafe; do
|
||||
report="$module/target/$runner-reports/TEST-shared.xml"
|
||||
cmp "$report" "$HOME/test-results/junit/$report"
|
||||
done
|
||||
done
|
||||
printf 'PASS: unit/integration reports, module collisions, spaces, exclusions and no tests\n'
|
||||
Reference in new issue
Block a user