优化 Github Actions 构建速度#4745
Merged
Merged
Conversation
Glavo
reviewed
Nov 2, 2025
| path: | | ||
| HMCL/build/libs/HMCL-*.sh | ||
| HMCL/build/libs/HMCL-*.sh.sha256 No newline at end of file | ||
| - uses: actions/checkout@v4 |
Glavo
reviewed
Nov 3, 2025
| @@ -0,0 +1,2 @@ | |||
| org.gradle.caching=true | |||
| uses: gradle/actions/setup-gradle@v5 | ||
| with: | ||
| cache-cleanup: never | ||
| cache-read-only: false |
Contributor
Author
There was a problem hiding this comment.
默认只会在主分支上写入缓存,就无法在本分支的 actions 上看到效果了,合并到主分支后就可以删除了(目前已经写入了一些缓存所以删掉也不影响了)
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v5 | ||
| with: | ||
| cache-cleanup: never |
Contributor
Author
There was a problem hiding this comment.
如果不设置为 never 会在 Post Setup Gradle 任务处花费 30 秒左右整理缓存,HMCL 项目的缓存不大,且一周内未访问的缓存会被 Github 自动清理,到达 10GB 限制也会自动清理
A repository can have up to 10GB of caches. Once the 10GB limit is reached, older caches will be evicted based on when the cache was last accessed. Caches that are not accessed within the last week will also be evicted.
Glavo
reviewed
Nov 8, 2025
| cache-cleanup: never | ||
| - name: Build with Gradle | ||
| run: ./gradlew build --no-daemon | ||
| run: ./gradlew build --no-daemon --build-cache --parallel |
Glavo
approved these changes
Nov 8, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Java CI 约 2m -> 30s ~50s
CheckCodes 约 2m -> 30s ~ 1m