Skip to content

🚀 [release] 0.0.34 #70

🚀 [release] 0.0.34

🚀 [release] 0.0.34 #70

Workflow file for this run

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=8 -Dkotlin.incremental=true -Dorg.gradle.configuration-cache=true -Dorg.gradle.build-cache=true -Dorg.gradle.caching=true"
JVM_OPTS: "-Xmx5g -XX:MaxMetaspaceSize=1g -XX:+UseG1GC -XX:G1HeapRegionSize=32m -XX:+UseStringDeduplication -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:+UseLargePages"
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 }}
steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
with:
fetch-depth: 1
- name: Set up JDK 17
uses: actions/setup-java@v5.0.0
with:
java-version: '17'
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: '9.1.0-rc-3'
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-fast"
- "core-build"
- "rds-light"
- "rds-heavy"
- "business-ai"
- "business-oss"
- "business-misc"
- "security"
- "data-depend"
include:
- group: "core-fast"
modules: "shared testtoolkit"
containers: "none"
timeout: 8
- group: "core-build"
modules: "gradle-plugin version-catalog bom"
containers: "none"
timeout: 10
- group: "rds-light"
modules: "rds:rds-shared rds:rds-flyway-migration-shared"
containers: "none"
timeout: 8
- group: "rds-heavy"
modules: "rds:rds-crud rds:rds-jimmer-ext-postgres rds:rds-flyway-migration-postgresql rds:rds-flyway-migration-mysql8"
containers: "database"
timeout: 20
- group: "business-ai"
modules: "ai:ai-shared ai:ai-langchain4j pay:pay-shared pay:pay-wechat"
containers: "cache"
timeout: 15
- group: "business-oss"
modules: "oss:oss-shared oss:oss-minio oss:oss-aliyun-oss oss:oss-huawei-obs oss:oss-volcengine-tos"
containers: "cache"
timeout: 18
- group: "business-misc"
modules: "sms:sms-shared sms:sms-tencent surveillance:surveillance-shared surveillance:surveillance-hikvision cacheable"
containers: "cache"
timeout: 12
- group: "security"
modules: "security:security-crypto security:security-oauth2 security:security-spring"
containers: "none"
timeout: 10
- group: "data-depend"
modules: "data:data-crawler data:data-extract 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"
containers: "none"
timeout: 15
steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
with:
fetch-depth: 1
- name: Set up JDK 17
uses: actions/setup-java@v5.0.0
with:
java-version: '17'
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: '9.1.0-rc-3'
cache-read-only: true
cache-write-only: false
- name: Set up Docker Buildx
if: matrix.containers != 'none'
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
image=moby/buildkit:v0.12.0
- name: Cache Docker layers
if: matrix.containers != 'none'
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ matrix.group }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-docker-${{ matrix.group }}-
${{ runner.os }}-docker-
- 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=4 \
-Dorg.gradle.jvmargs="-Xmx3g -XX:MaxMetaspaceSize=768m"
env:
TESTCONTAINERS_RYUK_DISABLED: false
TESTCONTAINERS_CHECKS_DISABLE: false
TESTCONTAINERS_REUSE_ENABLE: true
TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX: ""
TESTCONTAINERS_REUSE_HASH_LABELS: true
TESTCONTAINERS_PULL_PAUSE_TIMEOUT: 20
TESTCONTAINERS_STARTUP_TIMEOUT: 90
TESTCONTAINERS_CONNECT_TIMEOUT: 30
DOCKER_HOST: unix:///var/run/docker.sock
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: /var/run/docker.sock
TESTCONTAINERS_HOST_OVERRIDE: localhost
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
GRADLE_OPTS: "${{ env.GRADLE_OPTS }}"
JAVA_OPTS: "${{ env.JVM_OPTS }}"
CI: true
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: false
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.containers }}" != "none" ]]; then
docker ps -a || true
docker logs $(docker ps -aq --filter "label=org.testcontainers=true") || true
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 containers
if: always() && matrix.containers != 'none'
run: |
docker system df || true
docker container prune -f --filter "until=30m" --filter "label!=org.testcontainers.reuse.enable=true" || true
docker image prune -f --filter "dangling=true" || true
docker network prune -f --filter "until=30m" || true
docker volume prune -f --filter "label!=keep" --filter "label!=org.testcontainers.reuse.enable=true" || true
docker system df || true
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_containers=(
["core-fast"]="None"
["core-build"]="None"
["rds-light"]="None"
["rds-heavy"]="Database (PostgreSQL, MySQL, Redis)"
["business-ai"]="Cache (Redis)"
["business-oss"]="Cache (Redis, MinIO)"
["business-misc"]="Cache (Redis)"
["security"]="None"
["data-depend"]="None"
)
for group in core-fast core-build rds-light rds-heavy business-ai business-oss business-misc security data-depend; do
containers="${group_containers[$group]}"
if [[ "${{ needs.test-matrix.result }}" == "success" ]]; then
echo "| $group | Pass | $containers | - |" >> $GITHUB_STEP_SUMMARY
else
echo "| $group | Failed | $containers | - |" >> $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"