Pull Request已成功合入, 合并人@CANN-robot
(感谢 cui_jiahao 的贡献)变更摘要
此 PR 为 cann-samples 仓库新增了一套完整的 CI/CD 流水线配置,主要用于适配自动化编译与代码检查的上线流程。核心改动包括:新增构建脚本 compile.sh 以支持不同芯片平台(910c/950)和架构(x86/ARM)的编译;新增主流水线 cann-samples_action.yml,通过 PR 评论中的 /compile 指令触发,编排编译、代码检查及静态检查等阶段;同时新增三个可复用子流水线(compile_action.yml、codecheck_action.yml、staticcheck_action.yml),分别负责编译加速与制品上传、代码预检与 SCA/反投毒扫描、以及静态文档检查。
主要改动
-
新增
.gitcode/scripts/compile.sh构建脚本:根据task_name中的平台标识(如910c、950)选择对应的构建参数(dav-2201或dav-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 芯片的六种编译组合,以及CodeCheck和staticcheck_md_check检查任务;通过pull_request_comment和pr_comment事件以/compile关键字触发。 -
新增
.gitcode/workflows/compile_action.yml可复用编译流水线:封装了代码检出、OBS 文件下载、build-accelerate编译加速执行、制品重命名、api-check接口检查及 OBS 上传的完整编译流程,通过workflow_call接受任务名、镜像版本、架构等参数。 -
新增
.gitcode/workflows/codecheck_action.yml可复用代码检查流水线:包含precommit预提交检查、check-prPR 文件检查、SCA软件成分分析、Antipoison反病毒扫描以及CodeCheck通用代码检查五个作业,其中后三项仅在online标签启用时执行。 -
新增
.gitcode/workflows/staticcheck_action.yml可复用静态检查流水线:支持md_check类型的静态文档检查,通过cann/.gitcode/actions/staticcheck@master动作执行,并将检查结果(CSV/JSON)上传至 OBS。


代码审查
审查总结
已完成对全部 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_action 和 post_action 引用解析失败,直接影响 CI 流水线的 PreBuild 和 Post 阶段。P2 问题涉及编译产物上传丢失(*.tar.gz 不匹配 *.zip)、api-check 永不触发(task_name 不匹配)、commit_id 硬编码为 '0' 导致静态检查基线错误、系统路径无条件删除、以及密钥泄露风险。建议优先修复 P1 路径错误和 compile_action.yml 中的 P2 问题后再合并上线。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 2 |
| 🟡 建议 | 4 |
⛔ 需要修改


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
/approveor/lgtm- Commenting
/approveimplies 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. 👍


/lgtm


描述
关联的Issue
测试
文档更新
类型标签