88 - ' **/*.kt'
99
1010env :
11- 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"
12- JVM_OPTS : " -Xmx4g -XX:MaxMetaspaceSize=1g -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX: +UseStringDeduplication"
11+ GRADLE_OPTS : " -Dorg.gradle.daemon=true -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=4 -Dkotlin.incremental=true -Dorg.gradle.configuration-cache=true -Dorg.gradle.build-cache=true -Dorg.gradle.caching=true -Dorg.gradle.jvmargs= \" -Xmx3g -XX:MaxMetaspaceSize=1g -XX:+UseG1GC -XX:+UseStringDeduplication -Dfile.encoding=UTF-8 \" -Dkotlin.daemon.jvmargs= \" -Xmx2g -XX:MaxMetaspaceSize=768m -XX:+UseG1GC \" "
12+ JVM_OPTS : " -Xmx3g -XX:MaxMetaspaceSize=1g -XX:+UseG1GC -XX:+UseStringDeduplication -Dfile.encoding=UTF-8 "
1313 TESTCONTAINERS_RYUK_DISABLED : false
1414 TESTCONTAINERS_REUSE_ENABLE : true
1515 DOCKER_BUILDKIT : 1
1818 quick-check :
1919 name : Quick Check
2020 runs-on : ubuntu-latest
21- timeout-minutes : 8
21+ timeout-minutes : 20
2222 outputs :
2323 cache-key : ${{ steps.cache-info.outputs.cache-key }}
2424 gradle-cache-key : ${{ steps.cache-info.outputs.gradle-cache-key }}
4848 with :
4949 java-version : ${{ steps.version-info.outputs.java-version }}
5050 distribution : ' temurin'
51- cache : gradle
5251
5352 - name : Cache info
5453 id : cache-info
@@ -58,43 +57,19 @@ jobs:
5857 echo "cache-key=$GRADLE_CACHE_KEY" >> $GITHUB_OUTPUT
5958 echo "gradle-cache-key=$DEPS_CACHE_KEY" >> $GITHUB_OUTPUT
6059
61- - name : Cache Gradle wrapper and distributions
62- uses : actions/cache@v4
63- with :
64- path : |
65- ~/.gradle/wrapper
66- ~/.gradle/caches/jars-*
67- ~/.gradle/caches/modules-*
68- key : ${{ steps.cache-info.outputs.gradle-cache-key }}
69- restore-keys : |
70- ${{ runner.os }}-deps-
71- ${{ runner.os }}-gradle-
72-
73- - name : Cache build outputs
74- uses : actions/cache@v4
75- with :
76- path : |
77- ~/.gradle/caches/build-cache-*
78- ~/.gradle/buildOutputCleanup
79- **/build/classes
80- **/build/generated
81- key : ${{ steps.cache-info.outputs.cache-key }}
82- restore-keys : |
83- ${{ runner.os }}-gradle-
84-
8560 - name : Setup Gradle
8661 uses : gradle/actions/setup-gradle@v4
8762 with :
8863 gradle-version : ${{ steps.version-info.outputs.gradle-version }}
8964 cache-read-only : false
9065 cache-write-only : false
66+ cache-encryption-key : ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
9167
9268 - name : Grant execute permission
9369 run : chmod +x gradlew
9470
9571 - name : Quick compile
9672 run : |
97- ./gradlew help --quiet
9873 ./gradlew compileKotlin compileTestKotlin \
9974 --no-daemon \
10075 --parallel \
10984 timeout-minutes : 25
11085 strategy :
11186 fail-fast : false
112- max-parallel : 6
87+ max-parallel : 4
11388 matrix :
11489 group :
11590 - " core-foundation"
@@ -185,40 +160,14 @@ jobs:
185160 with :
186161 java-version : ${{ needs.quick-check.outputs.java-version }}
187162 distribution : ' temurin'
188- cache : gradle
189-
190- - name : Restore Gradle wrapper cache
191- uses : actions/cache/restore@v4
192- with :
193- path : |
194- ~/.gradle/wrapper
195- ~/.gradle/caches/jars-*
196- ~/.gradle/caches/modules-*
197- key : ${{ needs.quick-check.outputs.gradle-cache-key }}
198- restore-keys : |
199- ${{ runner.os }}-deps-
200- ${{ runner.os }}-gradle-
201-
202- - name : Restore build cache
203- uses : actions/cache/restore@v4
204- with :
205- path : |
206- ~/.gradle/caches/build-cache-*
207- ~/.gradle/buildOutputCleanup
208- **/build/classes
209- **/build/generated
210- key : ${{ needs.quick-check.outputs.cache-key }}
211- restore-keys : |
212- ${{ runner.os }}-gradle-
213163
214164 - name : Setup Gradle
215165 uses : gradle/actions/setup-gradle@v4
216166 with :
217167 gradle-version : ${{ needs.quick-check.outputs.gradle-version }}
218168 cache-read-only : true
219169 cache-write-only : false
220-
221-
170+ cache-encryption-key : ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
222171
223172 - name : Grant execute permission
224173 run : chmod +x gradlew
@@ -228,73 +177,37 @@ jobs:
228177 run : |
229178 set -e
230179
231- ./gradlew help --quiet
232-
233180 modules="${{ matrix.modules }}"
234181 test_tasks=""
235182
236- echo "Checking available test tasks for modules: $modules"
237-
238183 for module in $modules; do
239184 module_path=":$module"
240185 if [[ "$module" != *":"* ]]; then
241186 module_path=":$module"
242187 fi
243-
244- # 检查模块是否有test任务
245- if ./gradlew $module_path:tasks --all --quiet 2>/dev/null | grep -E "^test\s" >/dev/null; then
246- test_tasks="$test_tasks $module_path:test"
247- echo "✓ Found test task for $module"
248- else
249- echo "⚠ No test task found for $module, will check compilation instead"
250- fi
188+ test_tasks="$test_tasks $module_path:test"
251189 done
252190
253- if [[ -z "$test_tasks" ]]; then
254- echo "No test tasks found for any modules in this group"
255- echo "Running compilation and check tasks instead..."
256-
257- compile_tasks=""
258- for module in $modules; do
259- module_path=":$module"
260- if [[ "$module" != *":"* ]]; then
261- module_path=":$module"
262- fi
263- compile_tasks="$compile_tasks $module_path:compileKotlin $module_path:compileTestKotlin"
264- done
265-
266- ./gradlew $compile_tasks \
267- --no-daemon \
268- --parallel \
269- --build-cache \
270- --configuration-cache \
271- --continue \
272- --info \
273- -Dorg.gradle.workers.max=3 \
274- -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxMetaspaceSize=768m -XX:+UseG1GC"
275- else
276- echo "Running test tasks: $test_tasks"
277- ./gradlew $test_tasks \
278- --no-daemon \
279- --parallel \
280- --build-cache \
281- --configuration-cache \
282- --continue \
283- --info \
284- -Dorg.gradle.workers.max=3 \
285- -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxMetaspaceSize=768m -XX:+UseG1GC"
286- fi
191+ echo "Running test tasks: $test_tasks"
192+ ./gradlew $test_tasks \
193+ --no-daemon \
194+ --parallel \
195+ --build-cache \
196+ --configuration-cache \
197+ --continue \
198+ -Dorg.gradle.workers.max=2 \
199+ -Dorg.gradle.jvmargs="-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+UseG1GC" || true
287200 env :
288- # TestContainers 配置
201+ # TestContainers configuration
289202 TESTCONTAINERS_RYUK_DISABLED : false
290203 TESTCONTAINERS_REUSE_ENABLE : true
291204 TESTCONTAINERS_STARTUP_TIMEOUT : 120
292205 TESTCONTAINERS_CONNECT_TIMEOUT : 60
293- # Gradle 和 JVM 配置
206+ # Gradle and JVM configuration
294207 GRADLE_OPTS : " ${{ env.GRADLE_OPTS }}"
295208 JAVA_OPTS : " ${{ env.JVM_OPTS }}"
296209 CI : true
297- # 并行测试配置
210+ # Parallel test configuration
298211 JUNIT_PLATFORM_EXECUTION_PARALLEL_ENABLED : true
299212 JUNIT_PLATFORM_EXECUTION_PARALLEL_MODE_DEFAULT : concurrent
300213
@@ -336,7 +249,7 @@ jobs:
336249 if : always() && matrix.testcontainers == true
337250 run : |
338251 echo "Cleaning up TestContainers resources..."
339- # 清理非复用的 TestContainers
252+ # Clean up non-reusable TestContainers
340253 docker container prune -f --filter "label=org.testcontainers=true" --filter "label!=org.testcontainers.reuse.enable=true" || true
341254 docker network prune -f --filter "label=org.testcontainers=true" || true
342255 docker volume prune -f --filter "label=org.testcontainers=true" --filter "label!=org.testcontainers.reuse.enable=true" || true
0 commit comments