Skip to content

ci: 优化CI流程并修复clang-tidy兼容性 - #28

Merged
dhjs0000 merged 5 commits into
mainfrom
develop
Apr 8, 2026
Merged

ci: 优化CI流程并修复clang-tidy兼容性#28
dhjs0000 merged 5 commits into
mainfrom
develop

Conversation

@dhjs0000

@dhjs0000 dhjs0000 commented Apr 8, 2026

Copy link
Copy Markdown
Member
  • 添加静态分析检查任务,使用clang-tidy进行代码检查
  • 为Linux构建添加ccache缓存以加速构建
  • 移除clang-tidy配置中的ExcludeHeaderFilterRegex以兼容旧版本
  • 优化构建矩阵配置,减少重复构建
  • 更新版本号至v0.2.1-alpha.2

- 添加静态分析检查任务,使用clang-tidy进行代码检查
- 为Linux构建添加ccache缓存以加速构建
- 移除clang-tidy配置中的ExcludeHeaderFilterRegex以兼容旧版本
- 优化构建矩阵配置,减少重复构建
- 更新版本号至v0.2.1-alpha.2
@arknightsautomachine-ai-reviewer

arknightsautomachine-ai-reviewer Bot commented Apr 8, 2026

Copy link
Copy Markdown

Review Complete!

The code review has been posted. View Review →

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @dhjs0000, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📋 Summary

本次PR对CI/CD流程进行了重要优化,主要改进包括:

  1. 添加静态分析任务:新增 static-analysis job,使用 clang-tidy-18 对 core/ 目录进行代码质量检查
  2. 构建加速:为 Linux 和 macOS 构建添加 ccache 缓存支持,预期可显著减少重复构建时间
  3. 兼容性修复:移除 .clang-tidy 中的 ExcludeHeaderFilterRegex 配置项,兼容 clang-tidy < 17 版本
  4. 构建矩阵优化
    • Linux:精简为3个配置(GCC-12 Release/Debug + Clang-16 Release),避免冗余
    • macOS:仅保留 Release 构建,减少资源消耗
    • Windows:使用 $env:NUMBER_OF_PROCESSORS 动态设置并行度
  5. 版本更新:将版本号从 v0.2.0-alpha.2 更新至 v0.2.1-alpha.2
File Changes Risk Level Status
.clang-tidy +3/-6 🟢 Low Modified
.github/workflows/ci.yml +146/-11 🟡 Medium Modified

⚠️ Warnings (Should Fix)

  1. [File: .github/workflows/ci.yml, Line: 212] 静态分析输出截断风险

    • 使用 head -n 500 截断 clang-tidy 输出可能导致关键警告信息丢失,建议将完整输出保存为 artifact 供后续查看
  2. [File: .github/workflows/ci.yml, Line: 436] macOS Debug 构建缺失

    • macOS 构建矩阵仅保留 Release,可能遗漏 Debug 模式下特有的编译问题(如未初始化变量、断言失败等),建议评估是否接受此权衡
  3. [File: .github/workflows/ci.yml, Line: 369] ccache-action 版本

    • 使用 hendrikmuhs/ccache-action@v1.2,建议确认是否为最新稳定版本(当前最新为 v1.2.14),或考虑使用 v1 浮动标签以自动获取补丁更新

💡 Suggestions

  • 性能优化:考虑为 Windows 构建也添加 ccache 支持(通过 hendrikmuhs/ccache-actionchoco install ccache
  • 可观测性:建议将 clang-tidy 的完整输出上传为 GitHub Actions artifact,便于开发者下载详细报告
  • 文档同步:如 CI 配置有重大变更,建议同步更新 docs/BUILD.md 中的构建说明

📍 Inline Comments


🤖 AI Agent Prompt Generation

🤖 Copy this prompt for AI Agent
Please address the comments from this code review:

## Overall Comments

### Warnings to Fix:
1. **Static Analysis Output Truncation (Line 212)**: The current implementation uses `head -n 500` which may hide critical clang-tidy warnings. Implement artifact upload for full logs instead of truncating.
2. **macOS Debug Build Missing (Line 436)**: Confirm if removing macOS Debug build is intentional for CI resource optimization, or restore it if Debug-specific issues need to be caught.
3. **ccache-action Version (Line 369)**: Update `hendrikmuhs/ccache-action@v1.2` to `v1` or latest version to receive automatic patch updates.

### Suggestions to Consider:
- Add ccache support for Windows builds
- Upload clang-tidy full output as GitHub Actions artifact
- Update documentation if CI process changes significantly

## File-specific Changes

### .github/workflows/ci.yml
- Line 212: Modify clang-tidy output handling to preserve full logs via artifact upload instead of `head -n 500`
- Line 369: Update ccache-action version from `v1.2` to `v1` (or latest stable)
- Line 436: Add comment explaining why macOS Debug build is omitted, or restore the Debug configuration

### .clang-tidy
- No changes required, the removal of ExcludeHeaderFilterRegex for compatibility is correct

## Context
This is a CI optimization PR for the Arknights Auto Machine (AAM) project. The changes add static analysis, ccache support, and optimize build matrices. Ensure all modifications maintain compatibility with the existing CMake configuration and the project's AGPL-3.0 licensing requirements.

Thank you!

Open Questions

  • Q1: 确认 head -n 500 截断 clang-tidy 输出是否可接受,或者是否需要实现 artifact 上传以保留完整日志?
  • Q2: 确认 macOS 仅构建 Release 是资源优化权衡,还是暂时性配置?

统计: 0 🚨 | 3 ⚠️ | 2 💡

This review was generated by ArknightsAutoMachine AI Reviewer

Comment thread .github/workflows/ci.yml
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}-${{ matrix.compiler }}-${{ matrix.build_type }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 [Suggestion] hendrikmuhs/ccache-action@v1.2 是固定版本,建议改为 v1 以自动获取 v1.x 系列的补丁更新,或明确升级到最新版本(当前最新为 v1.2.14),以获取最新的 bug 修复和性能改进。

Comment thread .github/workflows/ci.yml Outdated
- name: Run clang-tidy (limited scope)
run: |
# 仅检查 core/ 目录,避免检查 third_party
cmake --build build --target aam_core 2>&1 | head -n 500 || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ [Warning] 使用 head -n 500 截断 clang-tidy 输出可能导致关键警告被隐藏。建议修改为保存完整输出到文件并作为 artifact 上传,或至少使用 tee 命令保留完整日志。例如:

- name: Run clang-tidy (limited scope)
  run: |
    cmake --build build --target aam_core 2>&1 | tee clang-tidy.log || true
- name: Upload clang-tidy logs
  if: always()
  uses: actions/upload-artifact@v4
  with:
    name: clang-tidy-logs
    path: clang-tidy.log

Comment thread .github/workflows/ci.yml Outdated
fail-fast: false
matrix:
build_type: [Release, Debug]
build_type: [Release]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ [Warning] macOS 构建矩阵仅保留 Release,这可能遗漏 Debug 模式下特有的问题(如断言失败、未定义行为等)。请确认这是有意为之的权衡(为节省 CI 资源),还是遗漏?如果是故意为之,建议添加注释说明原因。

Comment thread .github/workflows/ci.yml
- name: Run Tests
working-directory: build
run: ctest -C ${{ matrix.build_type }} --output-on-failure --parallel 4
run: ctest -C ${{ matrix.build_type }} --output-on-failure --parallel $env:NUMBER_OF_PROCESSORS

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ [Good] 使用 $env:NUMBER_OF_PROCESSORS 替代固定值 4 可更好地利用 Windows runner 的多核能力,提升构建效率。

- 将clang-tidy日志保存并上传为artifact便于调试
- 在所有平台添加ccache支持以加速构建
- 更新ccache-action到v1版本
- 在macOS上添加Debug构建配置
- 增加构建日志保留时间为7天
@arknightsautomachine-ai-reviewer

arknightsautomachine-ai-reviewer Bot commented Apr 8, 2026

Copy link
Copy Markdown

Review Complete!

The code review has been posted. View Review →

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📋 Summary

本次PR优化了CI工作流并修复了clang-tidy兼容性问题,主要改进包括:

  1. 新增静态分析任务: 使用clang-tidy-18在Ubuntu 24.04上进行代码静态检查
  2. 构建缓存优化: 为Windows、Linux、macOS三平台添加ccache缓存支持,加速重复构建
  3. 兼容性修复: 移除.clang-tidy中的ExcludeHeaderFilterRegex以兼容clang-tidy < 17版本
  4. 构建矩阵优化: 精简Linux构建配置(4个→3个组合),避免冗余构建
  5. 构建性能优化: 使用所有可用CPU核心进行并行构建(替代固定的4线程)

文件变更概览:

文件 变更 风险等级 状态
.clang-tidy +3/-6 🟢 Low Modified
.github/workflows/ci.yml +162/-10 🟡 Medium Modified

版本更新: v0.2.0-alpha.2 → v0.2.1-alpha.2(符合持续集成迭代规范)


⚠️ Warnings (需要注意)

  • [ci.yml:212] || true会忽略clang-tidy检查失败,导致静态分析问题不会阻塞CI。如希望静态分析作为质量门禁,需移除该容错处理或添加明确的失败条件判断。

💡 Suggestions (优化建议)

  • [ci.yml:427] Linux构建中显式导出CCACHE_DIR,但macOS构建缺少相同处理。建议保持跨平台一致性,或确认ccache-action已自动处理该变量。
  • [ROADMAP更新] 本次PR完成了v0.2.0-alpha中CI相关的优化项,建议在ROADMAP.md的v0.2.0-alpha.3(持续集成)部分勾选对应完成项。

📍 Inline Comments


🤖 Copy this prompt for AI Agent

🤖 Copy this prompt for AI Agent
Please address the comments from this code review:

## Overall Comments

### Warning
1. The `|| true` at the end of the clang-tidy command (line 212) will suppress failures and prevent the CI from blocking on static analysis issues. Consider removing it or adding proper error handling if you want clang-tidy to act as a quality gate.

### Suggestion
2. Consider adding explicit `CCACHE_DIR` export for macOS build (line 517) to match Linux configuration, or verify the ccache-action handles this automatically.
3. The Linux matrix only tests Clang in Release mode. Consider if Debug mode with Clang is needed for sanitizer compatibility testing.
4. Update ROADMAP.md to mark CI optimization items as completed in v0.2.0-alpha.3 section.

## File-specific Changes

### .github/workflows/ci.yml
- Line 212: Remove `|| true` or add conditional failure logic for clang-tidy
- Line 329: (Optional) Consider adding Clang Debug build to matrix
- Line 517: (Optional) Add CCACHE_DIR export for consistency

### ROADMAP.md
- Check off completed CI items in v0.2.0-alpha.3 section

Thank you!

统计: 0 🚨 | 2 ⚠️ | 3 💡

This review was generated by ArknightsAutoMachine AI Reviewer

Comment thread .github/workflows/ci.yml Outdated
- name: Run clang-tidy (limited scope)
run: |
# 仅检查 core/ 目录,避免检查 third_party
cmake --build build --target aam_core 2>&1 | tee clang-tidy.log || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ [Warning] || true 会强制使命令返回成功状态,即使clang-tidy检测到代码问题。这会导致静态分析任务无法起到质量门禁作用。建议:1) 如处于过渡阶段可保留但需添加注释说明;2) 正式启用时应移除此容错,或使用--warnings-as-errors将警告转为错误后配合条件判断处理。

Comment thread .github/workflows/ci.yml
# Clang-16 Release - 用于兼容性测试
- compiler: clang-16
build_type: Release
enable_static_analysis: OFF

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 [Suggestion] Linux构建矩阵中Clang-16仅测试Release模式,建议确认是否需要在Debug模式下也测试Clang编译器以确保Sanitizers在Clang下的兼容性(如AddressSanitizer、UBSan等)。

Comment thread .github/workflows/ci.yml
-DAAM_ENABLE_STATIC_ANALYSIS=OFF

- name: Build
run: cmake --build build --parallel $(sysctl -n hw.ncpu)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 [Suggestion] macOS构建步骤中未显式导出CCACHE_DIR环境变量(与Linux第427行对比),请确认hendrikmuhs/ccache-action@v1是否自动处理该变量,或建议添加显式导出以保持跨平台配置一致性。

Comment thread .clang-tidy Outdated
# @brief AAM Clang-Tidy Configuration
# =============================================================================
# 版本: v0.1.0-alpha.2
# 版本: v0.1.1-alpha.2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ [Good] 版本号更新和兼容性说明清晰。移除ExcludeHeaderFilterRegex确实能解决旧版本clang-tidy的兼容性问题,通过HeaderFilterRegex的负向前瞻已经实现了类似的过滤效果。

调整代码格式,统一对齐方式,优化代码可读性
@arknightsautomachine-ai-reviewer

arknightsautomachine-ai-reviewer Bot commented Apr 8, 2026

Copy link
Copy Markdown

Review Complete!

The code review has been posted. View Review →

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📋 Summary

本次PR主要优化CI流程并统一代码格式,包含以下变更:

  • 新增 static-analysis 任务,集成 clang-tidy-18 进行静态分析
  • 为全平台构建添加 ccache 缓存加速
  • 修复 .clang-tidy 配置,移除 ExcludeHeaderFilterRegex 以兼容旧版本 (< 17)
  • 优化 Linux 构建矩阵,减少重复构建(GCC-12 Debug/Release + Clang-16 Release)
  • 统一 shm_transport 相关文件的代码格式(变量对齐、行长度控制)
File Changes Risk Level Status
.clang-tidy +3/-6 🟢 Low Modified
.github/workflows/ci.yml +162/-10 🟡 Medium Modified
core/include/aam/l0/shm_transport.hpp +162/-145 🟢 Low Modified (formatting)
core/src/l0_sensing/shm_transport.cpp +193/-185 🟢 Low Modified (formatting)
core/tests/test_shm_transport.cpp +238/-209 🟢 Low Modified (formatting)

⚠️ Warnings (Should Fix)

  1. 静态分析任务失败被掩盖
    static-analysis 任务中使用了 || true,导致即使 clang-tidy 发现问题或构建失败,CI 也会标记为成功。这降低了静态分析的门禁作用。

  2. 版本号不一致
    CI 工作流版本更新为 v0.2.1-alpha.2,但 .clang-tidy 中更新为 v0.1.1-alpha.2。建议统一版本命名或明确说明配置文件的独立版本策略。

  3. clang-tidy 检查范围
    当前仅构建 aam_core 目标,可能遗漏其他核心模块的静态分析。建议后续逐步扩展至 aam_bridgeaam_l0 等模块。


💡 Suggestions

  1. 考虑将静态分析设为阻塞性检查
    当前 || true 是过渡方案,建议在稳定后移除,确保代码质量门禁生效。

  2. ccache 缓存键优化
    当前使用 ${{ github.job }}-${{ matrix.compiler }}-${{ matrix.build_type }},可考虑添加 hashFiles('**/CMakeLists.txt', '**/vcpkg.json') 以在依赖变更时自动失效缓存。

  3. ROADMAP 更新提醒
    本次CI优化对应 v0.1.0-alpha.3(持续集成)和 v0.2.0-alpha(感知硬化版)的部分验收标准。建议在 ROADMAP-S.md 中更新对应检查项状态。


📍 Inline Comments


Open Questions

  • 静态分析失败策略: 确认 || true 是临时措施还是长期策略?如果是临时措施,建议创建追踪Issue。
  • 版本号策略: .clang-tidy 和 CI 工作流使用不同版本号是否有特殊考虑?

🤖 AI Agent Prompt Generation

🤖 Copy this prompt for AI Agent
Please address the comments from this code review:

## Overall Comments
1. Remove the `|| true` fallback in the static-analysis job (line 212) or add a TODO comment explaining when it will be removed. This currently masks build failures.
2. Verify version number consistency between `.clang-tidy` (v0.1.1-alpha.2) and `.github/workflows/ci.yml` (v0.2.1-alpha.2). Unify them or add explanatory comments.
3. Consider adding `--parallel` flag to clang-tidy build for faster execution.

## File-specific Changes

### .github/workflows/ci.yml (Line 212)
- **Current**: `cmake --build build --target aam_core 2>&1 | tee clang-tidy.log || true`
- **Action**: Remove `|| true` if static analysis should block PRs, or add comment: `# TODO: Remove || true after fixing existing warnings (Issue #XXX)`

### .clang-tidy (Line 22)
- **Current**: `# 版本: v0.1.1-alpha.2`
- **Action**: Update to `v0.2.1-alpha.2` to match CI workflow, or add comment explaining this is the config file version (not project version).

### .github/workflows/ci.yml (Line 209)
- **Current**: `cmake --build build --target aam_core 2>&1 | tee clang-tidy.log || true`
- **Action**: Consider adding `--parallel $(nproc)` to speed up the build.

Thank you!

统计: 0 🚨 | 3 ⚠️ | 2 💡

This review was generated by ArknightsAutoMachine AI Reviewer

Comment thread .github/workflows/ci.yml Outdated
- name: Run clang-tidy (limited scope)
run: |
# 仅检查 core/ 目录,避免检查 third_party
cmake --build build --target aam_core 2>&1 | tee clang-tidy.log || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ [Warning] 使用 || true 会掩盖构建失败。建议添加注释说明这是过渡方案,并创建后续Issue移除该容错,确保静态分析失败时CI能够正确报错。

Comment thread .github/workflows/ci.yml Outdated
-DAAM_ENABLE_STATIC_ANALYSIS=ON \
-DCMAKE_CXX_FLAGS="-stdlib=libc++"

- name: Run clang-tidy (limited scope)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 [Suggestion] 建议添加 --verbose-j$(nproc) 参数以加速构建,或设置 CMAKE_CXX_CLANG_TIDY 变量使 CMake 在编译时并行运行 clang-tidy,而非构建后检查。

Comment thread .clang-tidy Outdated
# @brief AAM Clang-Tidy Configuration
# =============================================================================
# 版本: v0.1.0-alpha.2
# 版本: v0.1.1-alpha.2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ [Warning] 此处版本号 (v0.1.1-alpha.2) 与 CI 工作流 (v0.2.1-alpha.2) 不一致。如果是配置文件独立版本,建议添加注释说明;否则应统一版本号。

Comment thread .github/workflows/ci.yml
name: Build Summary
runs-on: ubuntu-latest
needs: [build-windows, build-linux, build-macos]
needs: [build-windows, build-linux, build-macos, static-analysis]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🏗️ [Architecture] 建议将 static-analysis 加入 needs 的构建总结依赖中,确保静态分析失败时阻止合并(当前已添加,符合预期)。

- 将.clang-tidy版本号更新至v0.2.1-alpha.2以保持与项目版本一致
- 修改CI工作流,仅生成编译命令而不进行完整静态分析
- 优化clang-tidy检查范围,仅针对core/目录的源文件
- 仅在检查失败时上传日志以节省资源
@arknightsautomachine-ai-reviewer

arknightsautomachine-ai-reviewer Bot commented Apr 8, 2026

Copy link
Copy Markdown

Review Complete!

The code review has been posted. View Review →

修改 clang-tidy 检查配置,启用 --warnings-as-errors 将警告视为错误,并添加 --use-color 输出彩色日志。同时更新注释说明 Ubuntu 24.04 对 C++23 的完整支持。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📋 Summary

本次 PR 主要优化 CI 流程并修复兼容性问题,同时统一了代码格式。变更包括:

  1. 新增 static-analysis Job(clang-tidy 静态分析)
  2. 为 Windows/Linux/macOS 构建添加 ccache 缓存加速
  3. 移除 .clang-tidy 中的 ExcludeHeaderFilterRegex 以兼容旧版本 clang-tidy (< 17)
  4. 统一版本号至 v0.2.1-alpha.2
  5. 对 SHM 传输层代码进行格式化(对齐、换行规范)
File Changes Risk Level Status
.clang-tidy +4/-6 🟢 Low Modified
.github/workflows/ci.yml +167/-10 🟡 Medium Modified
core/include/aam/l0/shm_transport.hpp +162/-145 🟢 Low Modified
core/src/l0_sensing/shm_transport.cpp +193/-185 🟢 Low Modified
core/tests/test_shm_transport.cpp +238/-209 🟢 Low Modified

🚨 Critical Issues

⚠️ Warnings (Should Fix)

  1. [代码审查体验] SHM 传输层文件包含大量格式化变更(缩进、对齐、换行),与 CI 优化逻辑混合在同一次提交中,增加了审查难度。建议未来将纯格式化变更单独提交。

💡 Suggestions

  1. 头文件作者标记:由于 diff 截断,未能验证 shm_transport.hpp/cpptest_shm_transport.cpp 的文件头是否包含 @author dhjs0000。请确保这些文件头部信息正确。
  2. 缓存键值:ccache 缓存键使用了矩阵参数,可以有效区分不同编译器/架构的缓存,设计合理。
  3. clang-tidy 范围:当前仅检查 core/ 目录,符合 L0 层开发重点,建议后续逐步扩展到其他核心模块。

📍 Inline Comments

Open Questions

  • 请确认 shm_transport.hppshm_transport.cpptest_shm_transport.cpp 的文件头部是否包含正确的 @author dhjs0000 标记(由于 diff 截断未能验证)。
  • 本次格式化变更是否完全由 .clang-format 自动生成?如果是,建议在提交信息中注明 style: clang-format 以便区分功能变更。

🤖 Copy this prompt for AI Agent
Please address the comments from this code review:

## Overall Comments
1. The PR mixes CI improvements with massive code formatting changes (SHM transport files). While the formatting is welcome, it makes reviewing harder. In the future, please separate pure formatting changes into a separate commit.
2. Please verify that all modified C++ files (shm_transport.hpp, shm_transport.cpp, test_shm_transport.cpp) have correct file headers with @author dhjs0000, as the diff was truncated and I couldn't verify this.

## File-specific Changes
- `.github/workflows/ci.yml`:
  - Line 126: The ubuntu-24.04 runner is quite new. Ensure it's stable for the project needs (it appears to be working fine based on the dependency list).
  - Line 206: Good practice to disable AAM_ENABLE_STATIC_ANALYSIS in the static-analysis job to avoid duplication.
  
- `.clang-tidy`:
  - Line 24: Good documentation of the compatibility fix.

- `core/src/l0_sensing/shm_transport.cpp`:
  - Line 1296: Good fix for missing newline at EOF.

## No Critical Issues Found
The CI improvements (ccache, clang-tidy job, version bump) are well-implemented and follow the project's architecture. The formatting aligns with the COLLABORATION.md style guidelines.

Thank you!

统计: 1 🚨 | 2 ⚠️ | 2 💡

This review was generated by ArknightsAutoMachine AI Reviewer

Comment thread .github/workflows/ci.yml
# ============================================================================
static-analysis:
name: Static Analysis (clang-tidy)
runs-on: ubuntu-24.04

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ [Warning] ubuntu-24.04 是较新的 runner 版本,虽然提供了完整的 C++23 支持,但建议监控其可用性和稳定性。目前依赖安装列表完整,配置正确。

Comment thread .github/workflows/ci.yml
-DAAM_BUILD_TESTS=OFF \
-DAAM_BUILD_EXAMPLES=OFF \
-DAAM_ENABLE_CUDA=OFF \
-DAAM_ENABLE_STATIC_ANALYSIS=OFF \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 [Suggestion] 静态分析任务中显式禁用了 AAM_ENABLE_STATIC_ANALYSIS CMake 选项(通过 -DAAM_ENABLE_STATIC_ANALYSIS=OFF),这是正确的,避免双重运行静态分析。

Comment thread .clang-tidy
# 版本: v0.1.0-alpha.2
# 版本: v0.2.1-alpha.2
# 功能: 静态代码分析与质量门禁
# 修复: 移除 ExcludeHeaderFilterRegex 以兼容 clang-tidy < 17

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ [Good] 清晰记录了移除 ExcludeHeaderFilterRegex 的原因(兼容 clang-tidy < 17),并保留了 HeaderFilterRegex 作为替代方案。

@@ -1288,4 +1296,4 @@ ShmTransport::Result ShmTransport::ReleaseReadBuffer(std::uint32_t buffer_index)
return {};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ [Good] 修复了文件末尾缺少换行符的问题(从 \ No newline at end of file 变为正常换行),符合 POSIX 标准。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📋 Summary

本次 PR 对 CI 流程进行了显著优化,并对 L0 层共享内存传输模块的代码格式进行了规范化。变更内容符合 v0.2.0-alpha 阶段的基础设施建设目标。

文件 变更类型 风险等级 状态
.clang-tidy 配置兼容性修复 🟢 Low Modified
.github/workflows/ci.yml CI 流程优化 🟢 Low Modified
shm_transport.hpp 代码格式化 🟢 Low Modified
shm_transport.cpp 代码格式化 🟢 Low Modified
test_shm_transport.cpp 代码格式化 🟢 Low Modified

变更亮点

CI 优化 (.github/workflows/ci.yml):

  • ✅ 新增 static-analysis 任务,使用 clang-tidy-18 进行严格静态分析 (--warnings-as-errors='*')
  • ✅ 集成 ccache 缓存(2GB)加速 Windows/Linux/macOS 构建
  • ✅ 优化构建矩阵:Linux 从 4 个任务精简为 3 个(保留 GCC-12 Release/Debug 和 Clang-16 Release)
  • ✅ 使用 $env:NUMBER_OF_PROCESSORS$(nproc) 实现并行编译最大化
  • ✅ 示例程序仅在 Release 模式下构建,减少 Debug 构建时间

代码质量:

  • ✅ 移除 ExcludeHeaderFilterRegex 以兼容 clang-tidy < 17 版本
  • ✅ 统一代码格式:变量垂直对齐、函数参数换行规范、注释对齐
  • ✅ 符合项目 .clang-format 规范(LLVM 风格变体)

架构合规性:

  • ✅ 所有变更位于 core/l0_sensing/ 目录,符合 L0 感知层架构定位
  • ✅ 共享内存传输属于 v0.2.0-alpha.3 传输层目标范围

版本更新提醒

📝 ROADMAP Update Reminder: 本次 PR 将版本号更新至 v0.2.1-alpha.2,属于 v0.2.0-alpha 阶段的维护性更新。请确保在合并后更新 develop_plan/ROADMAP.md 中 v0.2.0-alpha.4 基础设施的相关状态(如适用)。

文件头作者检查

所有修改的文件头均正确标注 @author dhjs0000,与 PR 作者一致。AGPL-3.0 许可证头在 C++ 源文件中保持完整。


No issues found. Code looks good!

本次 PR 是高质量的工程维护变更,CI 优化将显著提升后续开发效率,代码格式化提高了可读性和一致性。建议合并。


统计: 0 🚨 | 0 ⚠️ | 0 💡

This review was generated by ArknightsAutoMachine AI Reviewer

@dhjs0000
dhjs0000 merged commit ada64f6 into main Apr 8, 2026
6 of 7 checks passed
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