ci: 减少重复构建并加缓存 #5

Merged
layue13 merged 2 commits from ci/faster-builds into main 2026-11-08 08:30:18 +00:00
Owner

Requested by Ethyn

摘要

CI 排队太久,主要原因是同一个改动被重复构建,而不是单次构建慢:

  • 分支有 PR 时,push 和 pull_request 各跑一次 Java CI,现在 push 只在 main 和 tag 上触发
  • 新增 concurrency,同一个 PR 或分支的新运行会取消旧运行
  • “Check Codes” 单独起一个工作流,重复配置和编译一次,现在把 checkstyle、checkTranslations 并进 Java CI 的同一次 Gradle 调用,删除 check-codes.yml 和已停用的 check-codes-comment.yml
  • 缓存仓库自带的 Gradle 下载(~/.gradle/wrapper、.gradle/wrapper-neo),之前每次都重新下载 Gradle
  • PR 只读依赖缓存,只有 main 写缓存
  • runner 上已有 xvfb 时跳过 apt-get update

验证

  • YAML 解析通过;本 PR 本身会触发新的工作流,可以直接看耗时
  • 缓存是否命中取决于 Gitea runner 的缓存服务,第一次运行会冷启动,第二次起才能看到效果

🤖 Generated with Claude Code

<!-- claude-projects-attribution --> _Requested by **Ethyn**_ ## 摘要 CI 排队太久,主要原因是同一个改动被重复构建,而不是单次构建慢: - 分支有 PR 时,`push` 和 `pull_request` 各跑一次 Java CI,现在 push 只在 main 和 tag 上触发 - 新增 `concurrency`,同一个 PR 或分支的新运行会取消旧运行 - “Check Codes” 单独起一个工作流,重复配置和编译一次,现在把 `checkstyle`、`checkTranslations` 并进 Java CI 的同一次 Gradle 调用,删除 `check-codes.yml` 和已停用的 `check-codes-comment.yml` - 缓存仓库自带的 Gradle 下载(`~/.gradle/wrapper`、`.gradle/wrapper-neo`),之前每次都重新下载 Gradle - PR 只读依赖缓存,只有 main 写缓存 - runner 上已有 xvfb 时跳过 `apt-get update` ## 验证 - YAML 解析通过;本 PR 本身会触发新的工作流,可以直接看耗时 - 缓存是否命中取决于 Gitea runner 的缓存服务,第一次运行会冷启动,第二次起才能看到效果 🤖 Generated with [Claude Code](https://claude.com/claude-code)
layue13 added 1 commit 2026-11-08 08:20:02 +00:00
ci: one workflow run per change, cancel superseded runs, cache the Gradle distribution
Mirror Repository / Mirror to CNB (push) Skipped
Mirror Repository / Mirror to Gitee (push) Skipped
Java CI / build (pull_request) Canceled after 0s
d6b4af2d96
Pushes to feature branches built twice (push and pull request) and Check Codes
repeated the compile in a second workflow. Build now runs only on main, tags and
pull requests, cancels older runs of the same ref, folds checkstyle and
checkTranslations into the single Gradle invocation, caches the wrapper download
and skips apt when xvfb is installed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
layue13 added 1 commit 2026-11-08 08:21:41 +00:00
ci: try installing xvfb before refreshing the package index
Mirror Repository / Mirror to CNB (push) Skipped
Mirror Repository / Mirror to Gitee (push) Skipped
Java CI / build (pull_request) Failing after 16s
e792bfc554
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
layue13 merged commit 23811dad7f into main 2026-11-08 08:30:18 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TDLM/HMCL#5