🚀 [release] 0.0.34 #73
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - '.github/workflows/ci.yaml' | |
| - '**/*.kt' | |
| env: | |
| GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=6 -Dkotlin.incremental=true -Dorg.gradle.configuration-cache=true -Dorg.gradle.build-cache=true -Dorg.gradle.caching=true" | |
| JVM_OPTS: "-Xmx4g -XX:MaxMetaspaceSize=1g -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:+UseStringDeduplication" | |
| TESTCONTAINERS_RYUK_DISABLED: false | |
| TESTCONTAINERS_REUSE_ENABLE: true | |
| DOCKER_BUILDKIT: 1 | |
| jobs: | |
| quick-check: | |
| name: Quick Check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 8 | |
| outputs: | |
| cache-key: ${{ steps.cache-info.outputs.cache-key }} | |
| gradle-cache-key: ${{ steps.cache-info.outputs.gradle-cache-key }} | |
| java-version: ${{ steps.version-info.outputs.java-version }} | |
| gradle-version: ${{ steps.version-info.outputs.gradle-version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5.0.0 | |
| with: | |
| fetch-depth: 1 | |
| - name: Extract versions from libs.versions.toml | |
| id: version-info | |
| run: | | |
| JAVA_VERSION=$(sed -n 's/^java\s*=\s*"\(.*\)"/\1/p' gradle/libs.versions.toml | head -n1) | |
| GRADLE_VERSION=$(sed -n 's/^org-gradle\s*=\s*"\(.*\)"/\1/p' gradle/libs.versions.toml | head -n1) | |
| echo "java-version=$JAVA_VERSION" >> $GITHUB_OUTPUT | |
| echo "gradle-version=$GRADLE_VERSION" >> $GITHUB_OUTPUT | |
| echo "Extracted Java version: $JAVA_VERSION" | |
| echo "Extracted Gradle version: $GRADLE_VERSION" | |
| - name: Set up JDK ${{ steps.version-info.outputs.java-version }} | |
| uses: actions/setup-java@v5.0.0 | |
| with: | |
| java-version: ${{ steps.version-info.outputs.java-version }} | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Cache info | |
| id: cache-info | |
| run: | | |
| GRADLE_CACHE_KEY="${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle/libs.versions.toml', 'build-logic/**/*') }}" | |
| DEPS_CACHE_KEY="${{ runner.os }}-deps-${{ hashFiles('gradle/libs.versions.toml', '**/build.gradle.kts') }}" | |
| echo "cache-key=$GRADLE_CACHE_KEY" >> $GITHUB_OUTPUT | |
| echo "gradle-cache-key=$DEPS_CACHE_KEY" >> $GITHUB_OUTPUT | |
| - name: Cache Gradle wrapper and distributions | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/wrapper | |
| ~/.gradle/caches/jars-* | |
| ~/.gradle/caches/modules-* | |
| key: ${{ steps.cache-info.outputs.gradle-cache-key }} | |
| restore-keys: | | |
| ${{ runner.os }}-deps- | |
| ${{ runner.os }}-gradle- | |
| - name: Cache build outputs | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches/build-cache-* | |
| ~/.gradle/buildOutputCleanup | |
| **/build/classes | |
| **/build/generated | |
| key: ${{ steps.cache-info.outputs.cache-key }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| gradle-version: ${{ steps.version-info.outputs.gradle-version }} | |
| cache-read-only: false | |
| cache-write-only: false | |
| - name: Grant execute permission | |
| run: chmod +x gradlew | |
| - name: Quick compile | |
| run: | | |
| ./gradlew help --quiet | |
| ./gradlew compileKotlin compileTestKotlin \ | |
| --no-daemon \ | |
| --parallel \ | |
| --build-cache \ | |
| --configuration-cache \ | |
| --quiet | |
| test-matrix: | |
| name: Test | |
| needs: quick-check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 6 | |
| matrix: | |
| group: | |
| - "core-foundation" | |
| - "core-build-tools" | |
| - "rds-light" | |
| - "rds-heavy" | |
| - "business-ai-pay" | |
| - "business-oss" | |
| - "business-communication" | |
| - "security" | |
| - "data-processing" | |
| - "platform-integrations" | |
| - "testing-tools" | |
| - "integration-tests" | |
| include: | |
| - group: "core-foundation" | |
| modules: "shared cacheable docsite" | |
| testcontainers: false | |
| timeout: 8 | |
| - group: "core-build-tools" | |
| modules: "gradle-plugin version-catalog bom" | |
| testcontainers: false | |
| timeout: 10 | |
| - group: "rds-light" | |
| modules: "rds:rds-shared rds:rds-flyway-migration-shared" | |
| testcontainers: false | |
| timeout: 8 | |
| - group: "rds-heavy" | |
| modules: "rds:rds-crud rds:rds-jimmer-ext-postgres rds:rds-flyway-migration-postgresql rds:rds-flyway-migration-mysql8" | |
| testcontainers: true | |
| timeout: 25 | |
| - group: "business-ai-pay" | |
| modules: "ai:ai-shared ai:ai-langchain4j pay:pay-shared pay:pay-wechat" | |
| testcontainers: true | |
| timeout: 18 | |
| - group: "business-oss" | |
| modules: "oss:oss-shared oss:oss-minio oss:oss-aliyun-oss oss:oss-huawei-obs oss:oss-volcengine-tos" | |
| testcontainers: true | |
| timeout: 20 | |
| - group: "business-communication" | |
| modules: "sms:sms-shared sms:sms-tencent surveillance:surveillance-shared surveillance:surveillance-hikvision" | |
| testcontainers: true | |
| timeout: 15 | |
| - group: "security" | |
| modules: "security:security-crypto security:security-oauth2 security:security-spring" | |
| testcontainers: false | |
| timeout: 12 | |
| - group: "data-processing" | |
| modules: "data:data-crawler data:data-extract" | |
| testcontainers: true | |
| timeout: 15 | |
| - group: "platform-integrations" | |
| modules: "depend:depend-http-exchange depend:depend-jackson depend:depend-paho depend:depend-servlet depend:depend-springdoc-openapi depend:depend-xxl-job ksp:ksp-meta ksp:ksp-plugin ksp:ksp-shared psdk:psdk-wxpa ide:ide-idea-mcp" | |
| testcontainers: false | |
| timeout: 18 | |
| - group: "testing-tools" | |
| modules: "testtoolkit:testtoolkit-shared testtoolkit:testtoolkit-testcontainers testtoolkit:testtoolkit-springmvc" | |
| testcontainers: true | |
| timeout: 15 | |
| - group: "integration-tests" | |
| modules: "integrate-test:depend:jackson integrate-test:oss:minio integrate-test:cacheable" | |
| testcontainers: true | |
| timeout: 30 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5.0.0 | |
| with: | |
| fetch-depth: 1 | |
| - name: Set up JDK ${{ needs.quick-check.outputs.java-version }} | |
| uses: actions/setup-java@v5.0.0 | |
| with: | |
| java-version: ${{ needs.quick-check.outputs.java-version }} | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Restore Gradle wrapper cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ~/.gradle/wrapper | |
| ~/.gradle/caches/jars-* | |
| ~/.gradle/caches/modules-* | |
| key: ${{ needs.quick-check.outputs.gradle-cache-key }} | |
| restore-keys: | | |
| ${{ runner.os }}-deps- | |
| ${{ runner.os }}-gradle- | |
| - name: Restore build cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches/build-cache-* | |
| ~/.gradle/buildOutputCleanup | |
| **/build/classes | |
| **/build/generated | |
| key: ${{ needs.quick-check.outputs.cache-key }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| gradle-version: ${{ needs.quick-check.outputs.gradle-version }} | |
| cache-read-only: true | |
| cache-write-only: false | |
| - name: Grant execute permission | |
| run: chmod +x gradlew | |
| - name: Run tests | |
| timeout-minutes: ${{ matrix.timeout }} | |
| run: | | |
| set -e | |
| ./gradlew help --quiet | |
| modules="${{ matrix.modules }}" | |
| test_tasks="" | |
| for module in $modules; do | |
| if [[ "$module" == *":"* ]]; then | |
| test_tasks="$test_tasks :$module:test" | |
| else | |
| test_tasks="$test_tasks :$module:test" | |
| fi | |
| done | |
| ./gradlew $test_tasks \ | |
| --no-daemon \ | |
| --parallel \ | |
| --build-cache \ | |
| --configuration-cache \ | |
| --continue \ | |
| --quiet \ | |
| -Dorg.gradle.workers.max=3 \ | |
| -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxMetaspaceSize=768m -XX:+UseG1GC" | |
| env: | |
| # TestContainers 配置 | |
| TESTCONTAINERS_RYUK_DISABLED: false | |
| TESTCONTAINERS_REUSE_ENABLE: true | |
| TESTCONTAINERS_STARTUP_TIMEOUT: 120 | |
| TESTCONTAINERS_CONNECT_TIMEOUT: 60 | |
| # Gradle 和 JVM 配置 | |
| GRADLE_OPTS: "${{ env.GRADLE_OPTS }}" | |
| JAVA_OPTS: "${{ env.JVM_OPTS }}" | |
| CI: true | |
| # 并行测试配置 | |
| JUNIT_PLATFORM_EXECUTION_PARALLEL_ENABLED: true | |
| JUNIT_PLATFORM_EXECUTION_PARALLEL_MODE_DEFAULT: concurrent | |
| - name: Collect test diagnostics | |
| if: failure() | |
| run: | | |
| find . -name "*.log" -type f -exec echo "=== {} ===" \; -exec cat {} \; || true | |
| if [[ "${{ matrix.testcontainers }}" == "true" ]]; then | |
| echo "=== TestContainers Status ===" | |
| docker ps -a --filter "label=org.testcontainers=true" || true | |
| echo "=== TestContainers Logs ===" | |
| for container in $(docker ps -aq --filter "label=org.testcontainers=true" 2>/dev/null || true); do | |
| echo "--- Container $container ---" | |
| docker logs "$container" --tail 50 2>/dev/null || echo "No logs available" | |
| done | |
| fi | |
| if pgrep -f "org.gradle.launcher.daemon.bootstrap.GradleDaemon" > /dev/null; then | |
| jps -v || true | |
| fi | |
| free -h || true | |
| df -h || true | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.group }} | |
| path: | | |
| **/build/reports/tests/ | |
| **/build/test-results/ | |
| **/build/tmp/test/ | |
| **/*.log | |
| retention-days: 5 | |
| - name: Cleanup TestContainers | |
| if: always() && matrix.testcontainers == true | |
| run: | | |
| echo "Cleaning up TestContainers resources..." | |
| # 清理非复用的 TestContainers | |
| docker container prune -f --filter "label=org.testcontainers=true" --filter "label!=org.testcontainers.reuse.enable=true" || true | |
| docker network prune -f --filter "label=org.testcontainers=true" || true | |
| docker volume prune -f --filter "label=org.testcontainers=true" --filter "label!=org.testcontainers.reuse.enable=true" || true | |
| echo "TestContainers cleanup completed" | |
| test-results: | |
| name: Test Results Summary | |
| needs: [ quick-check, test-matrix ] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Download all test results | |
| uses: actions/download-artifact@v5.0.0 | |
| with: | |
| path: test-results | |
| pattern: test-results-* | |
| - name: Generate test summary | |
| run: | | |
| echo "# Test Results Report" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Execution time:** $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY | |
| echo "**Test environment:** GitHub Actions (ubuntu-latest)" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "## Module Group Test Status" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Module Group | Status | Container Dependencies | Duration |" >> $GITHUB_STEP_SUMMARY | |
| echo "|--------------|--------|------------------------|----------|" >> $GITHUB_STEP_SUMMARY | |
| declare -A group_testcontainers=( | |
| ["core-foundation"]="None" | |
| ["core-build-tools"]="None" | |
| ["rds-light"]="None" | |
| ["rds-heavy"]="TestContainers (PostgreSQL, MySQL, Redis)" | |
| ["business-ai-pay"]="TestContainers (Redis)" | |
| ["business-oss"]="TestContainers (Redis, MinIO)" | |
| ["business-communication"]="TestContainers (Redis)" | |
| ["security"]="None" | |
| ["data-processing"]="TestContainers (Redis)" | |
| ["platform-integrations"]="None" | |
| ["testing-tools"]="TestContainers (Database)" | |
| ["integration-tests"]="TestContainers (Full Stack)" | |
| ) | |
| for group in core-foundation core-build-tools rds-light rds-heavy business-ai-pay business-oss business-communication security data-processing platform-integrations testing-tools integration-tests; do | |
| testcontainers="${group_testcontainers[$group]}" | |
| if [[ "${{ needs.test-matrix.result }}" == "success" ]]; then | |
| echo "| $group | ✅ Pass | $testcontainers | - |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| $group | ❌ Failed | $testcontainers | - |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| done | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [[ "${{ needs.test-matrix.result }}" != "success" ]]; then | |
| echo "## Failure Analysis" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Common troubleshooting:**" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "1. **TestContainers startup failed**" >> $GITHUB_STEP_SUMMARY | |
| echo " - Check Docker service status" >> $GITHUB_STEP_SUMMARY | |
| echo " - Check network connectivity and image pulling" >> $GITHUB_STEP_SUMMARY | |
| echo " - Timeout configuration may need adjustment" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "2. **Out of memory (OOM)**" >> $GITHUB_STEP_SUMMARY | |
| echo " - JVM heap memory setting: 4GB" >> $GITHUB_STEP_SUMMARY | |
| echo " - Metaspace setting: 1.5GB" >> $GITHUB_STEP_SUMMARY | |
| echo " - Parallel worker limit: 6" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "3. **Test dependency conflicts**" >> $GITHUB_STEP_SUMMARY | |
| echo " - Check port conflicts in parallel tests" >> $GITHUB_STEP_SUMMARY | |
| echo " - Verify database connection pool configuration" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| - name: Check overall status | |
| run: | | |
| if [[ "${{ needs.quick-check.result }}" != "success" ]]; then | |
| echo "Quick check failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.test-matrix.result }}" != "success" ]]; then | |
| echo "Test matrix failed" | |
| exit 1 | |
| fi | |
| echo "All checks passed" |