Skip to content

test[CI][littlefs]: 添加 RT-Thread 编译验证#34

Closed
wdfk-prog wants to merge 1 commit into
RT-Thread-packages:masterfrom
wdfk-prog:master
Closed

test[CI][littlefs]: 添加 RT-Thread 编译验证#34
wdfk-prog wants to merge 1 commit into
RT-Thread-packages:masterfrom
wdfk-prog:master

Conversation

@wdfk-prog
Copy link
Copy Markdown
Collaborator

@wdfk-prog wdfk-prog commented May 5, 2026

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

[

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

当前 littlefs package 缺少面向 RT-Thread BSP 的自动化编译验证,无法在 PR 阶段及时发现 package 与 RT-Thread Kconfig、SCons 构建图、DFS/MTD 依赖或链接符号之间的集成问题。

本 PR 添加 RT-Thread 编译 CI,用于在 GitHub Actions 中验证 littlefs package 能够被复制到 RT-Thread BSP 的 packages/littlefs 路径下,并完成配置生成、编译和关键符号链接检查。

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

新增 .github/workflows/rtthread.yml,在 push、pull_request 和 workflow_dispatch 时触发 RT-Thread littlefs 编译验证。

新增 .github/ci/rtthread-littlefs/build.sh,执行以下流程:

  • 克隆指定 RT-Thread 分支或 tag,默认支持 master 和 v5.0.1;
  • 将当前 littlefs package 复制到目标 BSP 的 packages/littlefs
  • 生成 CI 专用 packages Kconfig / SConscript 入口;
  • 生成 littlefs_compile_check.c,引用真实 littlefs API 并导出初始化检查函数;
  • 通过 .config 启用 DFS、DFS v1、MTD NOR、heap、mutex、device 和 PKG_USING_LITTLEFS 等必要配置;
  • 执行 SCons 编译;
  • 使用 nm 检查 dfs_lfs_initlfs_mount 符号是否已链接进目标 ELF;
  • 上传每个 RT-Thread 版本的编译日志作为 workflow artifact。
  • 禁用上游仓库中的test.yml,防止ACTION失败,此内容由上游验证即可

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

  • BSP: bsp/qemu-vexpress-a9

  • .config: CONFIG_RT_USING_COMPONENTS_INIT CONFIG_RT_USING_DEVICE CONFIG_RT_USING_DEVICE_OPS CONFIG_RT_USING_HEAP CONFIG_RT_USING_DFS CONFIG_DFS_USING_POSIX CONFIG_DFS_USING_WORKDIR CONFIG_RT_USING_DFS_V1 CONFIG_RT_USING_DFS_DEVFS CONFIG_RT_USING_DFS_ROMFS CONFIG_RT_USING_DEVICE_IPC CONFIG_RT_USING_MUTEX CONFIG_RT_USING_MTD_NOR CONFIG_PKG_USING_LITTLEFS

  • action: https://github.com/wdfk-prog/littlefs/actions/runs/25356576204

]

当前拉取/合并请求的状态 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自查

Summary by CodeRabbit

  • Chores
    • Established automated compilation and integration testing for littlefs across multiple RT-Thread versions via GitHub Actions.

add a GitHub Actions workflow for RT-Thread littlefs package builds
clone RT-Thread and copy the package into the selected BSP package tree
enable the required DFS, MTD NOR, heap, mutex, and littlefs Kconfig symbols
compile the qemu-vexpress-a9 BSP against master and v5.0.1
verify that dfs_lfs_init and lfs_mount are linked into the generated ELF
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Walkthrough

Adds a new RT-Thread LittleFS CI validation pipeline: a build script that bootstraps an RT-Thread environment, integrates the littlefs package, applies configuration, and verifies a successful compile; and a GitHub Actions workflow that orchestrates this script across RT-Thread versions.

Changes

RT-Thread LittleFS CI Validation

Layer / File(s) Summary
Build Script Foundation & Safety
.github/ci/rtthread-littlefs/build.sh (lines 1–110)
Establishes script structure with usage, fail, and command/path utilities; enforces safety constraints on workdir (dedicated rt-thread-work, non-repo-root), BSP path (no ./..), and ELF name (filename only, BSP-contained).
Workdir & Config Management
.github/ci/rtthread-littlefs/build.sh (lines 151–270)
Implements workdir lifecycle via marker files, Kconfig symbol editing (set/unset via AWK), SCons wrapper (run_scons_pyconfig), and package archival/extraction logic.
Package Integration & Configuration
.github/ci/rtthread-littlefs/build.sh (lines 272–407)
Generates/updates Kconfig menu entry and SConscript for littlefs; writes compile/link integration test source (littlefs_compile_check); applies fixed Kconfig profile (DFS/RT/MTD/LittleFS symbols).
Build Verification & Execution
.github/ci/rtthread-littlefs/build.sh (lines 409–579)
Adds symbol verification (rtconfig.h defines, ELF symbols via nm), toolchain selection, RT-Thread cloning with retries, and end-to-end main orchestration: clone → copy package → generate configs → build → verify symbols.
Workflow Integration
.github/workflows/rtthread.yml
GitHub Actions workflow triggers on push/PR/dispatch, sets up Ubuntu 22.04 with matrix (RT-Thread master and v5.0.1), installs dependencies, invokes build script with logging, and uploads artifacts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title is in Chinese and uses unclear abbreviations/tags. While it references CI and littlefs, the core content (adding RT-Thread compile verification) is not clearly conveyed to someone scanning English-language PR history. Consider using a clearer English title like 'Add RT-Thread compile verification CI workflow for littlefs' to improve discoverability and clarity in project history.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@wdfk-prog
Copy link
Copy Markdown
Collaborator Author

@Rbb666

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
.github/workflows/rtthread.yml (2)

59-59: ⚡ Quick win

Pin kconfiglib to a specific version for reproducible CI.

The upstream kconfiglib project has not been maintained for more than 4 years, meaning the PyPI version is essentially frozen at 14.1.0, but an unpinned install is still vulnerable to any future republication or accidental version bump changing behavior without notice.

⚙️ Proposed fix
-          python3 -m pip install --user kconfiglib
+          python3 -m pip install --user 'kconfiglib==14.1.0'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/rtthread.yml at line 59, Pin the kconfiglib dependency in
the GitHub Actions workflow by replacing the unpinned pip install step (the line
containing "python3 -m pip install --user kconfiglib") with an explicit version
specification (e.g., kconfiglib==14.1.0) to ensure reproducible CI installs and
avoid accidental future changes.

3-6: ⚡ Quick win

Consider adding a paths filter to avoid running the 45-minute ARM build on unrelated changes.

Without any paths: filter, every push to every branch (e.g., documentation-only, CI-script-only, README) triggers the full RT-Thread compile. A focused filter limits wasteful CI minutes while keeping coverage on code that matters.

⚙️ Example paths filter
 on:
   push:
+    paths:
+      - '**.c'
+      - '**.h'
+      - '**.py'
+      - '.github/workflows/rtthread.yml'
+      - '.github/ci/**'
   pull_request:
+    paths:
+      - '**.c'
+      - '**.h'
+      - '**.py'
+      - '.github/workflows/rtthread.yml'
+      - '.github/ci/**'
   workflow_dispatch:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/rtthread.yml around lines 3 - 6, The workflow currently
triggers the full RT-Thread build for all pushes and PRs because the top-level
on: block (events push, pull_request, workflow_dispatch) has no paths filter;
add a paths: filter under push and pull_request in the same on: block to
restrict runs to relevant files (e.g., source, board, build scripts) and exclude
docs/ci-only changes so the long ARM build only runs for changes affecting
RT-Thread code; modify the on: configuration (the push and pull_request entries)
to include appropriate glob patterns for your codebase.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/rtthread.yml:
- Line 59: Pin the kconfiglib dependency in the GitHub Actions workflow by
replacing the unpinned pip install step (the line containing "python3 -m pip
install --user kconfiglib") with an explicit version specification (e.g.,
kconfiglib==14.1.0) to ensure reproducible CI installs and avoid accidental
future changes.
- Around line 3-6: The workflow currently triggers the full RT-Thread build for
all pushes and PRs because the top-level on: block (events push, pull_request,
workflow_dispatch) has no paths filter; add a paths: filter under push and
pull_request in the same on: block to restrict runs to relevant files (e.g.,
source, board, build scripts) and exclude docs/ci-only changes so the long ARM
build only runs for changes affecting RT-Thread code; modify the on:
configuration (the push and pull_request entries) to include appropriate glob
patterns for your codebase.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6f007fab-cb40-481c-8f30-41558853f536

📥 Commits

Reviewing files that changed from the base of the PR and between 9a3848e and 748448b.

📒 Files selected for processing (2)
  • .github/ci/rtthread-littlefs/build.sh
  • .github/workflows/rtthread.yml

@wdfk-prog wdfk-prog closed this May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant