Repository navigation
perf(ci): bring every PR job under 10 minutes - #1331
Merged
Merged
Conversation
vipwzw
force-pushed
the
fix/ci-all-jobs-under-10m
branch
from
October 14, 2026 11:37
78d23f5 to
8abcfd7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1331 +/- ##
===========================================
- Coverage 29.12% 23.86% -5.26%
===========================================
Files 382 1122 +740
Lines 73475 223699 +150224
===========================================
+ Hits 21400 53395 +31995
- Misses 50087 164697 +114610
- Partials 1988 5607 +3619 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
上一轮把 ci_cross2eth(37m->8m50s)、ci_bridgevmxgo(17m->7m16s) 压下来之后, 还剩三个 job 超过 10 分钟(PR #1330 实测): coverage 17m25s、unit-test 13m10s、 Test GOARCH 386 10m01s; ci_evm(9m37s)/ci_paracross(9m33s) 也几乎没有余量。 unit-test 已由 #1328 分 4 片解决, 本 commit 解决剩下的部分。 1) coverage 17m25s -> 实测 4m58s build/tools/coverage.sh 原来用 bash for 循环**逐包串行** go test: 126 个有测试的包, 单包最慢约 2 分钟(oracle/rpc 112s、relayd 91s、lightclient btc 91s、dpos 89s、 ticket/executor 60s), 串行合计 991s。go test 从 1.20 起支持一次对多个包生成合并的 覆盖率文件, 并且自己按 -p 并行跑包, 改成一次调用后墙钟时间降到最慢包的量级。 覆盖率语义不变(仍是 -covermode=count 的合并 profile, 文件名 coverage.cov 不变)。 2) Test GOARCH 386 10m01s -> 用 build_only Build 步骤 147s 里约 72s 是 `make build` 的 depends —— 串行编译几十个 dapp 的 cmd 产物, 而这个 job 只需要验证 386 下能编译、能跑测试。新增 `make build_only` (只编 chain33/chain33-cli/fork-config), 386 job 改用它; `build` 保持原语义 (build: depends build_only), 只是把编译部分抽出来复用。 3) 定点构建: ci_evm / ci_rgbx / ci_mix / ci_relay / ci_parachain_rollup 各约省 40s 这些 workflow 原来要么只跑 `make docker-compose dapp=X`(由 docker-compose.sh 的 `if ! [ -d ci ]` 兜底触发整个 make), 要么直接 `make build_ci`, 都会 depends 编译所有 dapp。统一改成上一轮引入的 `make build_ci_dapp dapp=X`。 **ci_paracross 不能这么改**: 它会走 rpc_test -> dapp_test_rpc, 后者固定执行 ./ticket/test-rpc.sh 以及 build/ci/dapptest 下所有 dapp 的 test-rpc.sh, 仍然需要 depends 的完整产物; 只编 paracross 会因缺少 ticket/test-rpc.sh 而失败(已在 CI 复现, workflow 里已写明原因)。 4) depends 并行化 + 修掉两个一直静默失败的 build.sh 每个 dapp 的 cmd/build.sh 只写自己的 build/ci/<dapp> 与 build/ci/dapptest/<dapp>, 互不重叠, 把 `find -exec ... \;` 换成 `xargs -P4`(DEPENDS_JOBS 可覆盖), 对仍需完整 depends 的 ci_paracross/ci_base/check_fmt/autotest 各约省 30~40s。 注意 find 的 `-exec` 失败只让谓词为假、find 本身仍返回 0, 所以 evmxgo/lightclient 的 build.sh 里 `cp ./build/*`(这两个 dapp 根本没有 build 目录)失败了很多年都没人发现; 换成 xargs 后失败会透出, 已把这两处改成显式判断目录存在, 让 depends 能对真正的错误 fail-fast。 验证方式与上一轮相同: 全部改动由 CI 实跑确认每个 job <10 分钟且测试全绿。
vipwzw
force-pushed
the
fix/ci-all-jobs-under-10m
branch
from
October 14, 2026 11:50
8abcfd7 to
92b6876
Compare
Owner
|
🎉 This PR is included in version 1.75.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
目标
上一轮(#1330,已合并)把
ci_cross2eth37m→8m50s、ci_bridgevmxgo17m→7m16s 之后,检查全部 PR 触发的 CI 作业,发现仍有三个超过 10 分钟,两个几乎没有余量:build/tools/coverage.sh用 bash for 循环逐包串行go testdepends(编译所有 dapp 的 cmd)make docker-compose,被兜底逻辑触发全量make改动
1. coverage:串行 → go test 多包并行(预期 ~6 分钟)
126 个有测试的包,单包最慢约 2 分钟(oracle/rpc 112s、relayd 91s、lightclient btc 91s、dpos 89s、ticket/executor 60s),串行合计 991s,其余是每包一次的进程/编译检查开销。
go test从 1.20 起支持一次对多个包生成合并的覆盖率文件,并自己按-p并行跑包:覆盖率语义不变:仍是
-covermode=count的合并 profile、文件名仍是coverage.cov,codecov 步骤不用改。386 job 早就在用go test ./...(默认-p并行跑包)跑同一批测试,所以"一个机器上多包并行"这条路已经有先例。2. Test GOARCH 386:
make build→make build_only(预期 ~8m50s)新增只编译、不跑
depends的目标;build保持原语义(build: depends build_only),只是把编译部分抽出来复用。386 job 只需要验证能编译 + 能跑测试,不需要build/ci下的集成测试产物。3. ci_evm / ci_paracross / ci_rgbx / ci_mix / ci_relay / ci_parachain_rollup:定点构建(每个省约 40s)
这些 workflow 原来要么直接
make build_ci、要么只跑make docker-compose dapp=X由docker-compose.sh的if ! [ -d ci ]兜底触发整个make(depends串行编译所有 dapp 的 cmd)。统一改用 #1330 引入的make build_ci_dapp dapp=X。相关cmd/build.sh都是自包含的(relay 自己编 relayd、rgbx/rollup 自己拷chain33.test.toml、evm 同时产出 evm2),与ci_dapps/ci_cross2eth已在用的方式一致。验证
bash -n+shellcheck -S warning(与 CI 的 check_fmt 一致)、make -n build/make -n build_only展开正确、全部 workflow YAML 解析通过。