Skip to content

[feat][ci]: reduce duplicate HC32 attachconfig builds#11474

Merged
Rbb666 merged 2 commits into
RT-Thread:masterfrom
CYFS3:feat_ci_building
Jun 22, 2026
Merged

[feat][ci]: reduce duplicate HC32 attachconfig builds#11474
Rbb666 merged 2 commits into
RT-Thread:masterfrom
CYFS3:feat_ci_building

Conversation

@CYFS3

@CYFS3 CYFS3 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

RT-Thread BSP Static Build Check 中 at32_hc32_ht32 matrix leg 耗时明显偏长。参考 https://github.com/RT-Thread/rt-thread/actions/runs/27336610440/job/80762661792?pr=11469 ,该 job 总耗时约 33 分 30 秒,会拖长整个 CI workflow 的完成时间。

重新分析后,耗时主要不是 matrix 分组本身,而是 tools/ci/bsp_buildings.py 的构建流程:每个 BSP 默认编译完成后,还会继续执行该 BSP .ci/attachconfig/ci.attachconfig.yml 中的每个附加配置。HC32 这里有多个 BSP 都配置了 attachconfig,且大量 driver/kconfig 组合重复,因此同类 driver 被重复构建多次,导致该 job 拖尾。

同时,当前 bsp_buildings.ymlpaths-ignore 直接忽略了 .github/**。这会导致修改 .github/ALL_BSP_COMPILE.json.github/workflows/bsp_buildings.yml 时,BSP Static Build Check 本身不会被 pull request 自动触发,CI matrix 和 workflow 配置变更缺少自动验证。

你的解决方案是什么 (what is your solution)

保留 at32_hc32_ht32 统一 matrix 分组,避免拆成多个小 job 后重复下载环境、初始化工具链,并继续利用同一个 job 内已经准备好的构建环境。

新增可选的 ATTACHCONFIG_RTT_BSP matrix 字段,并传入 tools/ci/bsp_buildings.py

  • 未配置 ATTACHCONFIG_RTT_BSP 的 matrix leg 保持原行为,继续对所有 BSP 执行 attachconfig。
  • 配置 ATTACHCONFIG_RTT_BSP 的 matrix leg 中,所有 BSP 仍执行默认编译,只有指定的代表 BSP 执行 attachconfig。
  • at32_hc32_ht32 中保留 HC32 代表 BSP hc32/ev_hc32f4a8_lqfp176hc32/ev_hc32f334_lqfp64hc32/ev_hc32f472_lqfp100 执行 attachconfig,减少其它 HC32 BSP 重复跑同类 driver 组合。
  • ht32/ht32f53252 仍保留 attachconfig 构建,避免影响 HT32 原有覆盖。

本 PR 不修改各 BSP 原有的 .ci/attachconfig/ci.attachconfig.yml 内容,只在 CI 构建流程中选择代表 BSP 执行附加配置构建。其它 HC32 BSP 仍执行默认 build,但跳过重复 attachconfig。

另外,将 bsp_buildings.yml 中对 .github/** 的粗粒度忽略改为更细的文档/模板/标签/utest 配置忽略项。这样修改 .github/ALL_BSP_COMPILE.json.github/workflows/bsp_buildings.yml 时,可以自动触发 BSP Static Build Check 来验证 CI 相关变更;.github/utest/** 仍保持忽略,避免 utest 专用配置变更误触发 BSP 编译。

请提供验证的bsp和config (provide the config and bsp)

  • BSP:

    • at32/at32m416-start
    • hc32/ev_hc32f4a8_lqfp176
    • hc32/ev_hc32f334_lqfp64
    • hc32/ev_hc32f472_lqfp100
    • ht32/ht32f53252
  • .config:

    • N/A, this PR only updates CI BSP matrix, attachconfig selection, and workflow trigger paths.
  • action:

    • Local validation: rebased onto latest rtt/master after upstream .github changes.
    • Local validation: comment-stripped .github/ALL_BSP_COMPILE.json passed python -m json.tool.
    • Local validation: .github/workflows/bsp_buildings.yml passed YAML parsing.
    • Local validation: tools/ci/bsp_buildings.py passed py_compile.
    • Local validation: verified the final PR diff only changes .github/ALL_BSP_COMPILE.json, .github/workflows/bsp_buildings.yml, and tools/ci/bsp_buildings.py; BSP attachconfig files are unchanged.
    • Local validation: verified .github/ALL_BSP_COMPILE.json and .github/workflows/bsp_buildings.yml are no longer in this workflow's .github ignore list, while .github/utest/** remains ignored.
    • Reference slow CI job: https://github.com/RT-Thread/rt-thread/actions/runs/27336610440/job/80762661792?pr=11469

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

@github-actions

Copy link
Copy Markdown

👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!

为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).


🛠 操作步骤 | Steps

  1. 前往 Actions 页面 | Go to the Actions page
    点击进入工作流 → | Click to open workflow →

  2. 点击 Run workflow | Click Run workflow

  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  • 将目标分支设置为 \ Set the target branch to:feat_ci_building
  • 设置PR number为 \ Set the PR number to:11474
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将自动推送至你的分支。
    The formatted code will be automatically pushed to your branch.

完成后,提交将自动更新至 feat_ci_building 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the feat_ci_building branch automatically, and the related Pull Request will be updated.

如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!

@github-actions github-actions Bot added the action github action yml imporve label Jun 12, 2026
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

📌 Code Review Assignment

🏷️ Tag: workflow

Reviewers: Rbb666 kurisaW supperthomas

Changed Files (Click to expand)
  • .github/ALL_BSP_COMPILE.json
  • .github/workflows/bsp_buildings.yml

📊 Current Review Status (Last Updated: 2026-06-22 10:33 CST)

  • Rbb666 Pending Review
  • kurisaW Pending Review
  • supperthomas Pending Review

📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

@CYFS3
CYFS3 force-pushed the feat_ci_building branch 2 times, most recently from ac953cd to 99df3e0 Compare June 12, 2026 07:20
@supperthomas

Copy link
Copy Markdown
Member

有看过为啥那么长时间吗?解决时间长的问题,比较靠谱一些,还有分组只放一两个bsp会很浪费下好的环境,建议放一起。

@supperthomas

Copy link
Copy Markdown
Member

https://github.com/RT-Thread/rt-thread/blob/master/bsp/hc32/ev_hc32f334_lqfp64/.ci/attachconfig/ci.attachconfig.yml 这个配置不应该每个bsp都测,只要一个bsp测过相关的driver即可。

Comment thread .github/ALL_BSP_COMPILE.json Outdated
]
},
{
"RTT_BSP": "hc32_f4a0_f448",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个统一放到一个分组里面,继续优化yml,会更快一些。

@CYFS3

CYFS3 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

有看过为啥那么长时间吗?解决时间长的问题,比较靠谱一些,还有分组只放一两个bsp会很浪费下好的环境,建议放一起。

https://github.com/RT-Thread/rt-thread/blob/master/bsp/hc32/ev_hc32f334_lqfp64/.ci/attachconfig/ci.attachconfig.yml 这个配置不应该每个bsp都测,只要一个bsp测过相关的driver即可。

这一块跑的配置太多了,正如你下面所说的。我精简一下这一块的driver的编译吧

@CYFS3
CYFS3 force-pushed the feat_ci_building branch from 99df3e0 to 04f7f00 Compare June 22, 2026 02:17
@github-actions github-actions Bot added BSP BSP: HC32 BSP related with HC32 tools labels Jun 22, 2026
@CYFS3 CYFS3 changed the title [feat][ci]: split long HC32 BSP build matrix [feat][ci]: reduce duplicate HC32 attachconfig builds Jun 22, 2026
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

@CYFS3
CYFS3 force-pushed the feat_ci_building branch from 04f7f00 to dc543f4 Compare June 22, 2026 02:30
@CYFS3 CYFS3 closed this Jun 22, 2026
@CYFS3 CYFS3 reopened this Jun 22, 2026
@CYFS3

CYFS3 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

@supperthomas 现在采用的策略是加了一个可选的 ATTACHCONFIG_RTT_BSP 字段。默认情况下,不配置该字段的 matrix 分组仍保持原有行为;配置后,该分组内所有 BSP 仍会执行默认 build,但只有 ATTACHCONFIG_RTT_BSP 指定的代表 BSP 会继续执行 attachconfig。
at32_hc32_ht32 分组中,当前保留 hc32/ev_hc32f4a8_lqfp176hc32/ev_hc32f334_lqfp64hc32/ev_hc32f472_lqfp100ht32/ht32f53252 执行 attachconfig,其它 BSP 只执行默认 build。这样既不影响各 BSP 自身 attachconfig 文件的使用,也能减少 HC32 重复附加配置构建,从而降低 CI 耗时。
从33 分降到了 24分。
涛哥有什么更好的想法吗,主要这一块不想影响到scons --attach的使用

@CYFS3
CYFS3 requested a review from supperthomas June 22, 2026 03:07
@Rbb666
Rbb666 merged commit 5c230d5 into RT-Thread:master Jun 22, 2026
104 of 106 checks passed
@CYFS3
CYFS3 deleted the feat_ci_building branch June 29, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action github action yml imporve BSP: HC32 BSP related with HC32 BSP tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants