已合并
action上线适配 #375
cui_jiahao创建于 16 天前
action上线适配 #375
已合并
cui_jiahao创建于 16 天前
cui_jiahao成员
16 天前

描述

关联的Issue

测试

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 cui_jiahao 的贡献)
Ccui_jiahao成员
16 天前 创建了 pull request,commit 1359bf5f
atomgit-bot
atomgit-bot
16 天前 评论:

变更摘要

此 PR 为 cann-samples 仓库新增了一套完整的 CI/CD 流水线配置,主要用于适配自动化编译与代码检查的上线流程。核心改动包括:新增构建脚本 compile.sh 以支持不同芯片平台(910c/950)和架构(x86/ARM)的编译;新增主流水线 cann-samples_action.yml,通过 PR 评论中的 /compile 指令触发,编排编译、代码检查及静态检查等阶段;同时新增三个可复用子流水线(compile_action.ymlcodecheck_action.ymlstaticcheck_action.yml),分别负责编译加速与制品上传、代码预检与 SCA/反投毒扫描、以及静态文档检查。

主要改动

  • 新增 .gitcode/scripts/compile.sh 构建脚本:根据 task_name 中的平台标识(如 910c950)选择对应的构建参数(dav-2201dav-3510),并设置 GCC 工具链、Python 路径及 CANN 环境;在 Compile_Ascend_X86_ubuntu24 任务中还会注入 CMAKE_EXPORT_COMPILE_COMMANDS 并输出 api-check=compile 指令。

  • 新增 .gitcode/workflows/cann-samples_action.yml 主流水线:定义了两阶段流水线——PreBuild(镜像版本解析)和 Compile(编译与检查),支持 x86/ARM 架构 × 标准/910c/950 芯片的六种编译组合,以及 CodeCheckstaticcheck_md_check 检查任务;通过 pull_request_commentpr_comment 事件以 /compile 关键字触发。

  • 新增 .gitcode/workflows/compile_action.yml 可复用编译流水线:封装了代码检出、OBS 文件下载、build-accelerate 编译加速执行、制品重命名、api-check 接口检查及 OBS 上传的完整编译流程,通过 workflow_call 接受任务名、镜像版本、架构等参数。

  • 新增 .gitcode/workflows/codecheck_action.yml 可复用代码检查流水线:包含 precommit 预提交检查、check-pr PR 文件检查、SCA 软件成分分析、Antipoison 反病毒扫描以及 CodeCheck 通用代码检查五个作业,其中后三项仅在 online 标签启用时执行。

  • 新增 .gitcode/workflows/staticcheck_action.yml 可复用静态检查流水线:支持 md_check 类型的静态文档检查,通过 cann/.gitcode/actions/staticcheck@master 动作执行,并将检查结果(CSV/JSON)上传至 OBS。

likedislike
atomgit-bot
atomgit-bot
16 天前 评论:

代码审查

审查总结

已完成对全部 5 个变更文件的审查:

文件 审查结果
.gitcode/scripts/compile.sh 发现 3 个问题 (P2×1, P3×2)
.gitcode/workflows/cann-samples_action.yml 发现 2 个问题 (P1×2)
.gitcode/workflows/codecheck_action.yml 发现 1 个问题 (P2×1)
.gitcode/workflows/compile_action.yml 发现 3 个问题 (P2×3)
.gitcode/workflows/staticcheck_action.yml 发现 2 个问题 (P2×1, P3×1)

按优先级统计:P1×2,P2×6,P3×3,共计 11 个问题。

整体风险判断:中高风险。 两个 P1 问题(cann-samples_action.yml 中双重 .gitcode 路径错误)会导致 pre_actionpost_action 引用解析失败,直接影响 CI 流水线的 PreBuild 和 Post 阶段。P2 问题涉及编译产物上传丢失(*.tar.gz 不匹配 *.zip)、api-check 永不触发(task_name 不匹配)、commit_id 硬编码为 '0' 导致静态检查基线错误、系统路径无条件删除、以及密钥泄露风险。建议优先修复 P1 路径错误和 compile_action.yml 中的 P2 问题后再合并上线。

类型 数量
🔴 阻塞 2
🟡 建议 4

⛔ 需要修改

likedislike
CANN-robotCANN-robot成员
16 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
16 天前 评论:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here
You can get sig-info at here


PR Approval Progress

Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
.gitcode/** Larry_liuyi, tanghaoran7 (2/2) Larry_liuyi (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

cui_jiahao, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
此处折叠了44条消息 查看更多
CANN-robotCANN-robot成员
15 天前 添加了label:ci-pipeline-passed
tanghaoran
tanghaoran成员
15 天前 评论:

/lgtm

likedislike
Larry成员
15 天前 评论:

/approve
/lgtm

likedislike
CANN-robotCANN-robot成员
15 天前 添加了label:lgtmapproved
CANN-robotCANN-robot成员
15 天前 合入了pull request