Skip to content

Commit 2b5c227

Browse files
authored
Merge pull request #32 from TrueNine/dev
0.0.28
2 parents 66e6ae2 + 7c47ce1 commit 2b5c227

177 files changed

Lines changed: 2030 additions & 946 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*
22
!.gitignore
3+
!/settings.json

.claude/settings.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(./gradlew:*)",
5+
"Bash(find:*)",
6+
"Bash(mkdir:*)",
7+
"Bash(grep:*)",
8+
9+
"Bash(timeout:*)",
10+
"Bash(.gradlew :shared:test:*)",
11+
"Bash(kotlin debug_test.kt)",
12+
"Bash(java:*)",
13+
"Bash(rm:*)",
14+
"Bash(.gradlew :oss:oss-shared:test --tests \"*OssPropertiesTest*toString*\")"
15+
]
16+
},
17+
"enableAllProjectMcpServers": true,
18+
"enabledMcpjsonServers": [
19+
"context7",
20+
"Sequential-thinking",
21+
"broswertools",
22+
"Playwright"
23+
]
24+
}

.github/workflows/ci.yaml

Lines changed: 124 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,43 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, dev ]
66
paths:
77
- '.github/workflows/ci.yaml'
88
- '**/*.kt'
9+
- '**/*.kts'
10+
- 'gradle/libs.versions.toml'
11+
- '**/build.gradle.kts'
12+
- 'gradle.properties'
13+
- 'settings.gradle.kts'
914
pull_request:
10-
branches: [ main ]
15+
branches: [ main, dev ]
1116
paths:
1217
- '.github/workflows/ci.yaml'
1318
- '**/*.kt'
19+
- '**/*.kts'
20+
- 'gradle/libs.versions.toml'
21+
- '**/build.gradle.kts'
22+
- 'gradle.properties'
23+
- 'settings.gradle.kts'
24+
25+
# 防止同一分支的多次并发执行
26+
concurrency:
27+
group: ci-${{ github.workflow }}-${{ github.ref }}
28+
cancel-in-progress: true
1429

1530
env:
1631
# 🚀 优化后的 Gradle 配置 - 提升构建性能
17-
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"
18-
# 🎯 JVM 性能优化配置 - 针对 GitHub Actions 7GB 内存环境调优
19-
JVM_OPTS: "-Xmx5g -XX:MaxMetaspaceSize=1g -XX:+UseG1GC -XX:G1HeapRegionSize=32m -XX:+UseStringDeduplication -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:+UseLargePages"
32+
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"
33+
# 🎯 JVM 性能优化配置 - 针对 GitHub Actions 环境调优
34+
JVM_OPTS: "-Xmx4g -XX:MaxMetaspaceSize=1g -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:+UseStringDeduplication"
2035
# 🐳 Docker 和 TestContainers 优化
2136
TESTCONTAINERS_RYUK_DISABLED: false
2237
TESTCONTAINERS_REUSE_ENABLE: true
2338
DOCKER_BUILDKIT: 1
39+
COMPOSE_DOCKER_CLI_BUILD: 1
40+
# 🔧 CI 环境标识
41+
CI: true
2442

2543
jobs:
2644
# 🔍 快速检查 - 编译和基础验证
@@ -99,63 +117,73 @@ jobs:
99117
--configuration-cache \
100118
--quiet
101119
102-
# 🧪 优化后的并行测试矩阵 - 重新分组以提升并行效率
120+
# 🧪 优化后的并行测试矩阵 - 基于实际模块结构重新分组
103121
test-matrix:
104122
name: "🧪 Test"
105123
needs: quick-check
106124
runs-on: ubuntu-latest
107-
timeout-minutes: 25
125+
timeout-minutes: 30
108126
strategy:
109127
fail-fast: false
110-
max-parallel: 6 # 增加并行度
128+
max-parallel: 8 # 提高并行度以充分利用资源
111129
matrix:
112130
group:
113-
- "core-fast" # 快速核心模块
114-
- "core-build" # 构建相关模块
115-
- "rds-light" # 轻量数据库模块
116-
- "rds-heavy" # 重量数据库模块
117-
- "business-ai" # AI 和支付模块
118-
- "business-oss" # 对象存储模块
119-
- "business-misc" # 其他业务模块
120-
- "security" # 安全模块
121-
- "data-depend" # 数据和依赖模块
131+
- "core-foundation" # 核心基础模块
132+
- "build-tooling" # 构建工具链模块
133+
- "rds-core" # 数据库核心模块
134+
- "rds-integrations" # 数据库集成模块
135+
- "oss-services" # 对象存储服务
136+
- "ai-pay-services" # AI 和支付服务
137+
- "messaging-sms" # 消息和短信服务
138+
- "security-crypto" # 安全和加密模块
139+
- "data-processing" # 数据处理模块
140+
- "platform-sdk" # 平台 SDK 和工具
141+
- "integration-tests" # 集成测试模块
122142
include:
123-
- group: "core-fast"
124-
modules: "shared testtoolkit"
143+
- group: "core-foundation"
144+
modules: "shared testtoolkit:testtoolkit-shared testtoolkit:testtoolkit-springmvc cacheable"
145+
containers: "redis"
146+
timeout: 12
147+
- group: "build-tooling"
148+
modules: "gradle-plugin version-catalog bom docsite"
125149
containers: "none"
126150
timeout: 8
127-
- group: "core-build"
128-
modules: "gradle-plugin version-catalog bom"
129-
containers: "none"
130-
timeout: 10
131-
- group: "rds-light"
151+
- group: "rds-core"
132152
modules: "rds:rds-shared rds:rds-flyway-migration-shared"
133153
containers: "none"
134-
timeout: 8
135-
- group: "rds-heavy"
136-
modules: "rds:rds-crud rds:rds-jimmer-ext-postgres rds:rds-flyway-migration-postgresql rds:rds-flyway-migration-mysql8"
154+
timeout: 6
155+
- group: "rds-integrations"
156+
modules: "rds:rds-crud rds:rds-jimmer-ext-postgres rds:rds-flyway-migration-postgresql rds:rds-flyway-migration-mysql8 testtoolkit:testtoolkit-testcontainers"
137157
containers: "database"
138-
timeout: 20
139-
- group: "business-ai"
140-
modules: "ai:ai-shared ai:ai-langchain4j pay:pay-shared pay:pay-wechat"
141-
containers: "cache"
142-
timeout: 15
143-
- group: "business-oss"
158+
timeout: 25
159+
- group: "oss-services"
144160
modules: "oss:oss-shared oss:oss-minio oss:oss-aliyun-oss oss:oss-huawei-obs oss:oss-volcengine-tos"
145-
containers: "cache"
161+
containers: "oss"
146162
timeout: 18
147-
- group: "business-misc"
148-
modules: "sms:sms-shared sms:sms-tencent surveillance:surveillance-shared surveillance:surveillance-hikvision cacheable"
149-
containers: "cache"
163+
- group: "ai-pay-services"
164+
modules: "ai:ai-shared ai:ai-langchain4j pay:pay-shared pay:pay-wechat"
165+
containers: "redis"
166+
timeout: 15
167+
- group: "messaging-sms"
168+
modules: "sms:sms-shared sms:sms-tencent surveillance:surveillance-shared surveillance:surveillance-hikvision"
169+
containers: "redis"
150170
timeout: 12
151-
- group: "security"
171+
- group: "security-crypto"
152172
modules: "security:security-crypto security:security-oauth2 security:security-spring"
153173
containers: "none"
154174
timeout: 10
155-
- group: "data-depend"
156-
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"
175+
- group: "data-processing"
176+
modules: "data:data-crawler data:data-extract ksp:ksp-meta ksp:ksp-plugin ksp:ksp-shared"
177+
containers: "none"
178+
timeout: 12
179+
- group: "platform-sdk"
180+
modules: "psdk:psdk-wxpa depend:depend-http-exchange depend:depend-jackson depend:depend-paho depend:depend-servlet depend:depend-springdoc-openapi depend:depend-xxl-job ide:ide-idea-mcp"
157181
containers: "none"
158182
timeout: 15
183+
- group: "integration-tests"
184+
modules: "integrate-test:depend:jackson integrate-test:oss:minio"
185+
containers: "full"
186+
timeout: 20
159187

160188
steps:
161189
- name: Checkout code
@@ -220,7 +248,15 @@ jobs:
220248
${{ runner.os }}-docker-${{ matrix.group }}-
221249
${{ runner.os }}-docker-
222250
223-
# 🚀 并行预拉取数据库镜像 - 使用更轻量的镜像
251+
# 🐳 预拉取容器镜像 - 根据测试需求优化
252+
- name: Pre-pull Redis images
253+
if: matrix.containers == 'redis'
254+
run: |
255+
echo "📦 拉取 Redis 镜像..."
256+
docker pull redis:7-alpine
257+
echo "✅ Redis 镜像拉取完成"
258+
continue-on-error: true
259+
224260
- name: Pre-pull database images
225261
if: matrix.containers == 'database'
226262
run: |
@@ -232,15 +268,26 @@ jobs:
232268
echo "✅ 数据库镜像拉取完成"
233269
continue-on-error: true
234270

235-
# 🗄️ 预拉取缓存相关镜像
236-
- name: Pre-pull cache images
237-
if: matrix.containers == 'cache'
271+
- name: Pre-pull OSS images
272+
if: matrix.containers == 'oss'
273+
run: |
274+
echo "📦 拉取对象存储镜像..."
275+
docker pull redis:7-alpine &
276+
docker pull minio/minio:RELEASE.2024-01-16T16-07-38Z &
277+
wait
278+
echo "✅ 对象存储镜像拉取完成"
279+
continue-on-error: true
280+
281+
- name: Pre-pull all required images
282+
if: matrix.containers == 'full'
238283
run: |
239-
echo "📦 拉取缓存镜像..."
284+
echo "🚀 拉取全量测试镜像..."
285+
docker pull postgres:16-alpine &
286+
docker pull mysql:8.0 &
240287
docker pull redis:7-alpine &
241288
docker pull minio/minio:RELEASE.2024-01-16T16-07-38Z &
242289
wait
243-
echo "✅ 缓存镜像拉取完成"
290+
echo "✅ 全量测试镜像拉取完成"
244291
continue-on-error: true
245292

246293
- name: Grant execute permission
@@ -349,34 +396,39 @@ jobs:
349396
**/*.log
350397
retention-days: 5
351398

352-
- name: 🧼 Smart cleanup containers
399+
- name: 🧼 智能清理容器资源
353400
if: always() && matrix.containers != 'none'
354401
run: |
355402
echo "🧼 开始智能清理 Docker 资源..."
356403
357404
# 显示当前资源使用情况
358-
echo "📈 当前 Docker 资源使用情况:"
405+
echo "📈 清理前 Docker 资源使用情况:"
359406
docker system df || true
360-
361-
# 智能清理:保留重用容器,清理测试容器
362-
echo "🗑️ 清理测试容器(保留重用容器)..."
363-
docker container prune -f --filter "until=30m" --filter "label!=org.testcontainers.reuse.enable=true" || true
364-
365-
# 清理悬空镜像(但保留基础镜像)
407+
408+
# 停止并删除测试容器(但保留重用容器)
409+
echo "🛑 停止测试容器..."
410+
docker ps -q --filter "label=org.testcontainers=true" --filter "label!=org.testcontainers.reuse.enable=true" | xargs -r docker stop || true
411+
412+
echo "🗑️ 删除测试容器(保留重用容器)..."
413+
docker container prune -f --filter "label=org.testcontainers=true" --filter "label!=org.testcontainers.reuse.enable=true" || true
414+
415+
# 清理悬空和未使用的镜像,但保留基础镜像
366416
echo "🖼️ 清理悬空镜像..."
367417
docker image prune -f --filter "dangling=true" || true
368-
369-
# 清理测试网络
418+
419+
# 清理未使用的网络(但保留 default 网络)
370420
echo "🌐 清理测试网络..."
371-
docker network prune -f --filter "until=30m" || true
372-
373-
# 清理临时卷
421+
docker network prune -f --filter "until=1h" || true
422+
423+
# 清理未使用的卷(但保留重用卷)
374424
echo "💾 清理临时卷..."
375-
docker volume prune -f --filter "label!=keep" --filter "label!=org.testcontainers.reuse.enable=true" || true
425+
docker volume prune -f --filter "label!=org.testcontainers.reuse.enable=true" || true
376426
377427
# 显示清理后的资源情况
378428
echo "✨ 清理后 Docker 资源使用情况:"
379429
docker system df || true
430+
431+
echo "🏁 Docker 资源清理完成"
380432
381433
# 📊 测试结果汇总
382434
test-results:
@@ -407,18 +459,20 @@ jobs:
407459
408460
# 模块组信息 - 更新为新的分组
409461
declare -A group_containers=(
410-
["core-fast"]="无"
411-
["core-build"]="无"
412-
["rds-light"]="无"
413-
["rds-heavy"]="Database (PostgreSQL, MySQL, Redis)"
414-
["business-ai"]="Cache (Redis)"
415-
["business-oss"]="Cache (Redis, MinIO)"
416-
["business-misc"]="Cache (Redis)"
417-
["security"]="无"
418-
["data-depend"]="无"
462+
["core-foundation"]="Redis"
463+
["build-tooling"]="无"
464+
["rds-core"]="无"
465+
["rds-integrations"]="PostgreSQL, MySQL, Redis"
466+
["oss-services"]="Redis, MinIO"
467+
["ai-pay-services"]="Redis"
468+
["messaging-sms"]="Redis"
469+
["security-crypto"]="无"
470+
["data-processing"]="无"
471+
["platform-sdk"]="无"
472+
["integration-tests"]="全量容器"
419473
)
420474
421-
for group in core-fast core-build rds-light rds-heavy business-ai business-oss business-misc security data-depend; do
475+
for group in core-foundation build-tooling rds-core rds-integrations oss-services ai-pay-services messaging-sms security-crypto data-processing platform-sdk integration-tests; do
422476
containers="${group_containers[$group]}"
423477
if [[ "${{ needs.test-matrix.result }}" == "success" ]]; then
424478
echo "| $group | ✅ 通过 | $containers | - |" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)