已合并
action上线适配 #226
cui_jiahao创建于 11 天前
action上线适配 #226
已合并
cui_jiahao创建于 11 天前
6 个文件变更+535-0
A.gitcode/scripts/compile.sh+73-0
@@ -0,0 +1,73 @@
1+#!/bin/bash
2+# -----------------------------------------------------------------------------------------------------------
3+# Copyright (c) 2026 Huawei Technologies Co., Ltd.
4+# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
5+# CANN Open Software License Agreement Version 2.0 (the "License").
6+# Please refer to the License for details. You may not use this file except in compliance with the License.
7+# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8+# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
9+# See LICENSE in the root of the software repository for the full text of the License.
10+# -----------------------------------------------------------------------------------------------------------
11+set -e
12+ 
13+REPOSITORY_NAME="ops-ras"
14+echo $(grep -E "^VERSION_ID=" /etc/os-release | cut -d'"' -f2)
15+export PATH=/opt/buildtools/python-3.10.2/bin:$PATH
16+if [[ "${task_name}" == *ubuntu24* ]]; then
17+ sudo update-alternatives --set gcc /usr/bin/gcc-14
18+else
19+ if [[ -f "/opt/rh/devtoolset-7/enable" ]]; then
20+ echo "source devtoolset"
21+ source /opt/rh/devtoolset-7/enable
22+ fi
23+fi
24+gcc --version
25+ 
26+if [ -z "${ASCEND_3RD_LIB_PATH}" ]; then
27+ export ASCEND_3RD_LIB_PATH=/home/jenkins/opensource
28+fi
29+ 
30+if [ -z "${OS_TYPE}" ]; then
31+ OS_TYPE=$(uname -m)
32+fi
33+ 
34+if [ -f /home/jenkins/Ascend/cann/bin/setenv.bash ]; then
35+ source /home/jenkins/Ascend/cann/bin/setenv.bash
36+fi
37+ 
38+LOG_HEAD()
39+{
40+ echo "========================================"
41+ echo " $1"
42+ echo "========================================"
43+}
44+ 
45+LOG_DO()
46+{
47+ echo "[LOG_DO] $*"
48+ "$@"
49+}
50+ 
51+DP_ASSERT_EQUAL()
52+{
53+ local actual="$1"
54+ local expected="$2"
55+ local msg="$3"
56+ if [ "${actual}" != "${expected}" ]; then
57+ echo "::error::ASSERT FAILED: ${msg} (expected=${expected}, actual=${actual})"
58+ exit 1
59+ fi
60+}
61+ 
62+if [[ "${task_name}" =~ Compile_Ascend_X86_ubuntu24 ]]; then
63+ sed -i "1i set(CMAKE_EXPORT_COMPILE_COMMANDS ON)" "CMakeLists.txt"
64+ echo "api-check=compile" >> "${ATOMGIT_OUTPUT}"
65+else
66+ echo "api-check=continue" >> "${ATOMGIT_OUTPUT}"
67+fi
68+ 
69+LOG_HEAD "Build ${REPOSITORY_NAME}."
70+cd ${WORKSPACE}/ || exit 1
71+LOG_DO bash build.sh --pkg --soc=ascend950
72+DP_ASSERT_EQUAL "$?" "0" "exec cmd: [bash build.sh --pkg --soc=ascend950]"
73+exit 0
A.gitcode/scripts/ut.sh+68-0
@@ -0,0 +1,68 @@
1+#!/bin/bash
2+# -----------------------------------------------------------------------------------------------------------
3+# Copyright (c) 2026 Huawei Technologies Co., Ltd.
4+# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
5+# CANN Open Software License Agreement Version 2.0 (the "License").
6+# Please refer to the License for details. You may not use this file except in compliance with the License.
7+# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8+# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
9+# See LICENSE in the root of the software repository for the full text of the License.
10+# -----------------------------------------------------------------------------------------------------------
11+ 
12+set -e
13+set -o pipefail
14+ 
15+echo "ge_st_rt2: ${ge_st_rt2}"
16+echo "GIT_TARGET_BRANCH: ${GIT_TARGET_BRANCH}"
17+echo "ut_type: ${ut_type}"
18+ 
19+########
20+# Init #
21+########
22+ 
23+function LOG_HEAD() {
24+ local assert_msg=${1}
25+ date_time=$(date +%Y%m%d-%H%M%S)
26+ echo -e "[INFO] ${date_time} ${assert_msg}"
27+}
28+ 
29+function LOG_DO() {
30+ local cmd="$*"
31+ date_time=$(date +%Y%m%d-%H%M%S)
32+ echo -e "[Command] ${date_time} ${cmd}"
33+ ${cmd}
atomgit-bot
atomgit-botatomgit-bot11 天前

🟡 Medium Priority

ut.sh 第 29-34 行的 LOG_DO 函数将参数拼接为字符串 cmd="$*" 然后执行 ${cmd}(未加引号)。这会经过 shell 的单词拆分和 glob 展开,如果命令参数中含有空格、特殊字符或 glob 模式,命令行为将不可预期。

对比 compile.sh 第 45-49 行的 LOG_DO 使用 "$@" 正确保留了参数结构。

变更行:ut.sh:33${cmd} 失败模式:当构建命令参数含空格或特殊字符时,命令会被错误拆分执行,可能导致构建失败或意外行为。

建议:使用 eval "${cmd}" 或改为与 compile.sh 一致的 "$@" 模式来正确执行带参数的命令。

likedislike
34+}
35+ 
36+function DP_ASSERT_EQUAL() {
37+ local actual_value=${1}
38+ local expect_value=${2}
39+ local assert_msg=${3}
40+ local log_flag=${4:-"true"}
41+ local log_path=${5}
42+ if [ "${actual_value}" != "${expect_value}" ]; then
43+ if [ -n "${log_path}" ] && [ -f "${log_path}" ]; then
44+ cat ${log_path}
45+ fi
46+ echo "${assert_msg} is failed."
47+ exit 1
48+ else
49+ if [ "${log_flag}" = "true" ]; then
50+ echo "${assert_msg} is success."
51+ fi
52+ fi
53+}
54+ 
55+REPOSITORY_NAME="ops-math"
56+ 
57+echo $(grep -E "^VERSION_ID=" /etc/os-release | cut -d'"' -f2)
58+sudo update-alternatives --set gcc /usr/bin/gcc-14
59+gcc --version
60+rm -rf /home/jenkins/opensource/json
61+source /home/jenkins/Ascend/cann/bin/setenv.bash
62+main(){
63+ LOG_HEAD "Start run c++ testcase"
64+ LOG_DO sh build.sh --opkernel -u
65+ DP_ASSERT_EQUAL "$?" "0" "exec cmd: [sh build.sh -u --opkernel -u]"
atomgit-bot
atomgit-botatomgit-bot11 天前

🟡 Medium Priority

ut.sh 第 12 行设置了 set -e(遇错即退),第 65 行使用 DP_ASSERT_EQUAL "$?" "0" 检查上一条命令 LOG_DO sh build.sh ... 的退出码。但 set -e 会在 LOG_DO 中的命令返回非零时立即退出脚本,永远不会执行到第 65 行的断言。这使得第 65 行成为死代码 — 它只能在成功时被调用($? 永远是 0),失败时不会执行。

对比 compile.sh 第 11 行使用 set +e,然后通过 DP_ASSERT_EQUAL "$?" "0" 正确捕获构建失败。

变更行:ut.sh:12 + ut.sh:65 失败模式:构建失败时脚本无定制错误信息直接退出,且 set -e 和断言模式互相矛盾。

建议:二选一:(1) 去掉 set -e,让 DP_ASSERT_EQUAL "$?" "0" 能捕获失败并给出定制错误信息(与 compile.sh 一致);(2) 保留 set -e,去掉失效的 DP_ASSERT_EQUAL "$?" "0" 行,因为失败时根本不会执行到此处。

likedislike
66+}
67+main_param=$@
68+main $main_param
atomgit-bot
atomgit-botatomgit-bot11 天前

🟡 Medium Priority

ut.sh 第 67-68 行: main_param=$@ main mainparammain_param `@赋值给普通变量main_param时会丢失参数数组结构(所有参数合并为一个字符串),然后mainparam(未加引号)再次经过单词拆分。若参数中含有空格,会被错误拆分。正确写法应为main"main_param`(未加引号)再次经过单词拆分。若参数中含有空格,会被错误拆分。正确写法应为 `main "@"`。

变更行:ut.sh:67-68 失败模式:如果脚本被调用时传入含空格的参数,main 函数收到的参数个数和内容将不正确。

建议:将 main_param=$@ / main $main_param 改为 main "$@",直接传递参数,保留参数完整性。

likedislike
A.gitcode/workflows/compile_action.yml+109-0
@@ -0,0 +1,109 @@
1+name: compile_action
2+ 
3+on:
4+ workflow_call:
5+ inputs:
6+ task_name:
7+ required: true
8+ type: string
9+ image_version:
10+ required: true
11+ type: string
12+ ge_st_rt2:
13+ required: false
14+ type: string
15+ arch:
16+ required: false
17+ type: string
18+ default: 'x64'
19+ package_name:
20+ required: false
21+ type: string
22+ default: ''
23+ spec:
24+ required: false
25+ type: string
26+ default: 'xlarge'
27+ 
28+jobs:
29+ JOB_compile:
30+ name: Compile
31+ needs: []
32+ steps:
33+ -
34+ name: Checkout
35+ identifier: process_checkout
36+ uses: checkout
37+ with:
38+ ref: ${{ atomgit.event.pull_request.merge_commit_sha }}
atomgit-bot
atomgit-botatomgit-bot11 天前

🟡 Medium Priority

compile_action.yml 第 38 行 checkout 步骤的 ref 仅为 ${{ atomgit.event.pull_request.merge_commit_sha }},没有 || atomgit.sha 回退。而同仓库中 codecheck_action.yml(第 23、65 行)和 staticcheck_action.yml(第 22 行)都使用了 || atomgit.sha 回退模式。当 pipeline 通过 workflow_dispatch 等非 PR 事件触发时,pull_request.merge_commit_sha 可能为空,导致 checkout 行为不确定(可能 checkout 默认分支而非预期代码)。

变更行:compile_action.yml:38 失败模式:workflow_dispatch 触发时 checkout 可能失败或 checkout 到错误 ref,整个编译流程使用错误的代码版本。

建议:添加回退值:ref: ${{ atomgit.event.pull_request.merge_commit_sha || atomgit.sha }},与其他 workflow(codecheck_action.yml、staticcheck_action.yml)保持一致。

likedislike
39+ token: ${{ secrets.GIT_TOKEN }}
40+ -
41+ name: download
42+ uses: obs-download
43+ with:
44+ endpoint: "https://obs.cn-north-4.myhuaweicloud.com"
45+ bucket: "ascend-ci"
46+ access-key: ${{ secrets.AK }}
47+ secret-key: ${{ secrets.SK }}
48+ key: |
49+ ${{ env.obs_path }}/pr_filelist.txt
50+ ${{ env.obs_path }}/pr_filelist_mod.txt
51+ ${{ env.obs_path }}/update_file_detail.txt
52+ ${{ env.obs_path }}/compile.sh
53+ path: ${{ steps.process_checkout.outputs.path }}
54+ -
55+ name: compile_acc
56+ identifier: compile
57+ uses: build-accelerate
58+ with:
59+ command: |
60+ export WORKSPACE=${{ steps.process_checkout.outputs.path }}
61+ cd ${{ steps.process_checkout.outputs.path }}
62+ export task_name=${{ inputs.task_name }}
63+ export ge_st_rt2=${{ inputs.ge_st_rt2 }}
64+ export GIT_TARGET_BRANCH=${{ env.TARGET_BRANCH }}
65+ export OS_TYPE=${{ inputs.arch == 'arm64' && 'aarch64' || 'x86_64' }}
66+ echo "${ge_st_rt2}"
67+ BuildAccelerate bash compile.sh
68+ AC_SERVER_IP: ${{ vars.AC_SERVER_IP }}
69+ -
70+ name: rename_package
71+ if: ${{ inputs.package_name != '' }}
72+ run: |
73+ cd ${{ steps.process_checkout.outputs.path }}
74+ if [[ "${{ inputs.task_name }}" == *single* ]]; then
75+ mv ../single.tar.gz ${{ inputs.package_name }}
76+ echo "mv: ../single.tar.gz -> ${{ inputs.package_name }}"
77+ else
78+ cd ./build_out
79+ for f in *.run; do
80+ [ -f "$f" ] || continue
81+ [ "$f" = "${{ inputs.package_name }}" ] && continue
82+ mv "$f" "${{ inputs.package_name }}"
83+ echo "Renamed: $f -> ${{ inputs.package_name }}"
84+ break
85+ done
86+ fi
87+ -
88+ name: verify_package
89+ uses: cann/.gitcode/actions/verify-package@master
90+ with:
91+ workspace: ${{ steps.process_checkout.outputs.path }}
92+ -
93+ name: upload
94+ uses: obs-upload
95+ with:
96+ endpoint: "https://obs.cn-north-4.myhuaweicloud.com"
97+ bucket: "ascend-ci"
98+ access-key: ${{ secrets.AK }}
99+ secret-key: ${{ secrets.SK }}
100+ artifact-path: |
101+ ${{ steps.process_checkout.outputs.path }}/build_out/${{ inputs.package_name != '' && inputs.package_name || '*.tar.gz' }}
102+ object-prefix: ${{ env.obs_path }}/
103+ if: "${{ default() }}"
104+ runs-on:
105+ - dedicate-hosted
106+ - ${{ inputs.arch }}
107+ - ${{ inputs.spec }}
108+ container:
109+ image: swr.cn-north-4.myhuaweicloud.com/ci_cann/${{ inputs.image_version }}
A.gitcode/workflows/llt_action.yml+78-0
@@ -0,0 +1,78 @@
1+name: llt_action
2+ 
3+on:
4+ workflow_call:
5+ inputs:
6+ ut_type:
7+ required: true
8+ type: string
9+ ut_package:
10+ type: string
11+ default: 'ut_cov_*.tar.gz'
12+ ge_st_rt2:
13+ required: false
14+ type: string
15+ image_version:
16+ required: true
17+ type: string
18+ 
19+jobs:
20+ JOB_ut:
21+ name: UT
22+ steps:
23+ -
24+ name: Checkout
25+ identifier: process_checkout
26+ uses: checkout
27+ with:
28+ ref: ${{ atomgit.event.pull_request.merge_commit_sha }}
atomgit-bot
atomgit-botatomgit-bot11 天前

🟡 Medium Priority

compile_action.yml 第 38 行相同问题:llt_action.yml 第 28 行 checkout 步骤的 ref 仅为 ${{ atomgit.event.pull_request.merge_commit_sha }},没有回退。非 PR 事件触发时可能导致 checkout 行为不确定。

建议:添加回退值:ref: ${{ atomgit.event.pull_request.merge_commit_sha || atomgit.sha }}

likedislike
29+ token: ${{secrets.GIT_TOKEN}}
30+ -
31+ name: download
32+ uses: obs-download
33+ with:
34+ endpoint: "https://obs.cn-north-4.myhuaweicloud.com"
35+ bucket: "ascend-ci"
36+ key: |
37+ ${{ env.obs_path }}/pr_filelist.txt
38+ ${{ env.obs_path }}/pr_filelist_mod.txt
39+ ${{ env.obs_path }}/ut.sh
40+ path: ${{ steps.process_checkout.outputs.path }}
41+ -
42+ name: redis-cache
43+ uses: cann/.gitcode/actions/redis-cache@master
44+ -
45+ name: ut_acc
46+ identifier: ut
47+ run: |
48+ export WORKSPACE=${{ steps.process_checkout.outputs.path }}
49+ cd ${{ steps.process_checkout.outputs.path }}
50+ export ut_type=${{ inputs.ut_type }}
51+ export ge_st_rt2=${{ inputs.ge_st_rt2 }}
52+ export GIT_TARGET_BRANCH=${{ env.TARGET_BRANCH }}
53+ bash ut.sh
54+ -
55+ name: ut_cov
56+ identifier: ut_cov
57+ uses: cann/.gitcode/actions/ut-cov-report@master
58+ with:
59+ ut_process: ${{ steps.ut.outputs.ut_process }}
atomgit-bot
atomgit-botatomgit-bot11 天前

🟡 Medium Priority

llt_action.yml 第 46 行的 ut 步骤是 run: 类型(执行 bash ut.sh),第 59 行 ut_cov 步骤引用 ${{ steps.ut.outputs.ut_process }}。标准的 run 步骤不会自动产生 outputs,除非脚本显式写入输出变量(如 GitHub Actions 的 $GITHUB_OUTPUT)。ut.sh 脚本中并没有设置任何 output 变量,所以 steps.ut.outputs.ut_process 将始终为空,导致 ut-cov-report action 接收到空的 ut_process 参数。

变更行:llt_action.yml:59 失败模式:ut-cov-report action 因为 ut_process 为空可能无法正常工作或产生不完整的覆盖率报告。

建议:确认 ut 步骤是否需要产生 ut_process 输出。如果是,需在 run 步骤中按平台规范写入输出(如 GitHub Actions 中写 echo "ut_process=..." >> $GITHUB_OUTPUT);如果不需要,则直接去掉该参数或设默认值。

likedislike
60+ workspace: ${{ steps.process_checkout.outputs.path }}
61+ ut_type: ${{ inputs.ut_type }}
62+ target_branch: ${{ env.TARGET_BRANCH }}
63+ git_token: ${{secrets.GIT_TOKEN}}
64+ -
65+ name: upload
66+ uses: obs-upload
67+ with:
68+ endpoint: "https://obs.cn-north-4.myhuaweicloud.com"
69+ bucket: "ascend-ci"
70+ access-key: ${{secrets.AK}}
71+ secret-key: ${{secrets.SK}}
72+ artifact-path: |
73+ ${{ steps.process_checkout.outputs.path }}/${{ inputs.ut_package }}
74+ object-prefix: ${{ env.obs_path }}/
75+ if: "${{ default() }}"
76+ runs-on: [dedicate-hosted, x64, xlarge]
77+ container:
78+ image: swr.cn-north-4.myhuaweicloud.com/ci_cann/${{ inputs.image_version }}
A.gitcode/workflows/ops-tensor_action.yml+141-0
@@ -0,0 +1,141 @@
1+name: PR-pipeline_ops-tensor
2+ 
3+concurrency:
4+ max: 5
5+ exceed-action: QUEUE
6+ enable: true
7+ preemption:
8+ enable: true
9+ events: [mr_id]
10+ 
11+on:
12+ workflow_dispatch:
13+ pull_request_comment:
14+ types: [created]
15+ branches: [ '*' ]
16+ comments: [ '^(?:\/)?compile*' ]
17+ pr_comment:
18+ types: [ created ]
19+ keyword: '^(?:\/)?compile*'
20+ 
21+env:
22+ org_name: ${{ vars.ORG_NAME }}
23+ repo_name: "ops-tensor"
24+ MERGE_ID: ${{ atomgit.event.pull_request.number }}
25+ TARGET_BRANCH: ${{ atomgit.base_ref }}
26+ SOURCE_BRANCH: ${{ atomgit.head_ref }}
27+ obs_path: "${{ vars.OBS_PATH }}/${{ env.MERGE_ID }}"
28+ obs_smoke_path: "${{ env.obs_path }}/presmoke/2"
atomgit-bot
atomgit-botatomgit-bot11 天前

🟡 Medium Priority

ops-tensor_action.yml 第 27-28 行: obs_path: "vars.OBSPATH/{{ vars.OBS_PATH }}/{{ env.MERGE_ID }}" obs_smoke_path: "env.obspath/presmoke/2"在同一个env块中,obspath引用了env.MERGEID(同块中第24行定义),obssmokepath引用了env.obspath(同块中第27行定义)。多数CI平台(如GitHubActions)不支持在同一个env块内自引用其他env变量,这会导致obspath中的{{ env.obs_path }}/presmoke/2" 在同一个 `env` 块中,`obs_path` 引用了 `env.MERGE_ID`(同块中第 24 行定义),`obs_smoke_path` 引用了 `env.obs_path`(同块中第 27 行定义)。多数 CI 平台(如 GitHub Actions)不支持在同一个 `env` 块内自引用其他 env 变量,这会导致 `obs_path` 中的 `{{ env.MERGE_ID }}` 解析为空字符串,进而使 OBS 路径错误,下游所有下载/上传步骤失败。

变更行:ops-tensor_action.yml:27-28 失败模式(取决于平台):obs_path 可能解析为 "<OBS_PATH>/"(MERGE_ID 为空),导致所有 OBS 操作使用错误路径。

建议:避免在 env 块内自引用。可将 MERGE_ID 的值直接内联到 obs_path 中,如 obs_path: "${{ vars.OBS_PATH }}/${{ atomgit.event.pull_request.number }}"

likedislike
29+ online: ${{ vars.APPLY_LABEL }}
30+ 
31+stages:
32+ stage1:
L
LLarry11 天前

可以合并成2个job,image跟prebuild

likedislike
33+ name: PreBuild
34+ jobs:
35+ JOB_image:
36+ name: Test_image
37+ steps:
38+ - name: revise_image
39+ identifier: revise_image
40+ uses: cann/.gitcode/actions/revise-img@master
41+ with:
42+ repo_name: 'ops-tensor'
43+ target_branch: ${{ env.TARGET_BRANCH }}
44+ repo_url: ${{ vars.CI_PATH }}
45+ -
46+ name: show_output
47+ run: |
48+ echo "Compile_Ascend_X86: ${{ steps.revise_image.outputs.Compile_Ascend_X86 }}"
49+ if: "${{ default() }}"
50+ runs-on: [dedicate-hosted, x64, small]
51+ container:
52+ image: swr.cn-north-4.myhuaweicloud.com/ci_cann/ubuntu20.04.05_x86:k8s_v1.1006
53+ JOB_pre:
54+ name: Test_PreBuild
55+ uses: cann/.gitcode/.gitcode/workflows/pre_action.yml@master
56+ pre:
57+ - type: auto
58+ fail-fast: true
59+ stage2:
60+ name: Compile
61+ jobs:
62+ JOB_x86_compile:
63+ name: Compile_x86
64+ uses: .gitcode/workflows/compile_action.yml
65+ with:
66+ task_name: 'Compile_Ascend_X86'
67+ image_version: ${{ jobs.JOB_image.outputs.Compile_Ascend_X86 }}
68+ arch: 'x64'
69+ package_name: 'cann-ops-tensor_linux-x86_64.run'
70+ JOB_arm_compile:
71+ name: Compile_arm
72+ uses: .gitcode/workflows/compile_action.yml
73+ with:
74+ task_name: 'Compile_Ascend_ARM'
75+ image_version: ${{ jobs.JOB_image.outputs.Compile_Ascend_ARM }}
76+ arch: 'arm64'
77+ package_name: 'cann-ops-tensor_linux-aarch64.run'
78+ JOB_x86_compile_ubuntu24:
79+ name: Compile_x86_ubuntu24
80+ uses: .gitcode/workflows/compile_action.yml
81+ with:
82+ task_name: 'Compile_Ascend_X86_ubuntu24'
83+ image_version: ${{ jobs.JOB_image.outputs.Compile_Ascend_X86 }}
84+ arch: 'x64'
85+ package_name: 'cann-ops-tensor_linux-x86_64_ubuntu24.run'
86+ JOB_arm_compile_ubuntu24:
87+ name: Compile_arm_ubuntu24
88+ uses: .gitcode/workflows/compile_action.yml
89+ with:
90+ task_name: 'Compile_Ascend_ARM_ubuntu24'
91+ image_version: ${{ jobs.JOB_image.outputs.Compile_Ascend_ARM }}
92+ arch: 'arm64'
93+ package_name: 'cann-ops-tensor_linux-aarch64_ubuntu24.run'
94+ JOB_codecheck:
95+ name: CodeCheck
96+ uses: cann/.gitcode/.gitcode/workflows/codecheck_action.yml@master
97+ with:
98+ precommit_image_version: ${{ jobs.JOB_image.outputs.precommit }}
99+ codecheck_image_version: ${{ jobs.JOB_image.outputs.codecheck }}
100+ JOB_staticcheck_md_check:
101+ name: staticcheck_md_check
102+ uses: .gitcode/workflows/staticcheck_action.yml
103+ with:
104+ check_type: 'md_check'
105+ image_version: ${{ jobs.JOB_image.outputs.staticcheck }}
106+ pre:
107+ - type: auto
108+ fail-fast: false
109+ stage3:
110+ name: UT
111+ jobs:
112+ JOB_api_check:
113+ name: API_Check
114+ steps:
115+ -
116+ name: api-check
117+ identifier: api-check
118+ uses: cann/.gitcode/actions/api-check@master
119+ with:
120+ org_name: ${{ env.org_name }}
121+ mode: check
122+ repo_name: ${{ env.repo_name }}
123+ merge_id: ${{ env.MERGE_ID }}
124+ if: env.TARGET_BRANCH == 'master'
125+ runs-on: [dedicate-hosted, x64, small]
126+ container:
127+ image: swr.cn-north-4.myhuaweicloud.com/ci_cann/${{ jobs.JOB_image.outputs.API_Check }}
128+ JOB_UT_Test:
129+ name: UT_Test
130+ uses: .gitcode/workflows/llt_action.yml
131+ with:
132+ ut_type: 'UT_Test'
133+ image_version: ${{ jobs.JOB_image.outputs.UT_Test }}
134+ pre:
135+ - type: auto
136+ fail-fast: false
137+post:
L
LLarry11 天前

用最新的job,已经封装了action,会简洁很多

likedislike
138+ jobs:
139+ job_post:
140+ name: Test_post
141+ uses: cann/.gitcode/.gitcode/workflows/post_action.yml@master
A.gitcode/workflows/staticcheck_action.yml+66-0
@@ -0,0 +1,66 @@
1+name: staticheck_action
atomgit-bot
atomgit-botatomgit-bot11 天前

🟡 Medium Priority

staticcheck_action.yml 第 1 行 workflow namestaticheck_action(缺少 'c'),而文件名是 staticcheck_action.yml。若 CI 平台通过 name 引用 workflow,此拼写不一致可能导致引用失败或混淆。

变更行:staticcheck_action.yml:1 失败模式:如果平台按 name 匹配或展示,该 workflow 的名称会与预期不符;引用方可能需要精确匹配此 name。

建议:将 workflow name 修正为 staticcheck_action(去掉多余的 e),与文件名 staticcheck_action.yml 保持一致。

改动建议
1
- name: staticheck_action
1
+ name: staticcheck_action
应用建议
likedislike
2+ 
3+on:
4+ workflow_call:
5+ inputs:
6+ check_type:
7+ required: true
8+ type: string
9+ image_version:
10+ required: true
11+ type: string
12+ 
13+jobs:
14+ JOB_staticcheck:
15+ name: CodeCheck_staticcheck
16+ steps:
17+ -
18+ name: Checkout
19+ identifier: process_checkout
20+ uses: checkout
21+ with:
22+ ref: ${{ atomgit.event.pull_request.merge_commit_sha || atomgit.sha }}
23+ token: ${{secrets.GIT_TOKEN}}
24+ -
25+ name: download
26+ uses: obs-download
27+ with:
28+ endpoint: "https://obs.cn-north-4.myhuaweicloud.com"
29+ bucket: "ascend-ci"
30+ access-key: ${{ secrets.AK }}
31+ secret-key: ${{ secrets.SK }}
32+ key: |
33+ ${{ env.obs_path }}/pr_filelist.txt
34+ ${{ env.obs_path }}/pr_filelist_mod.txt
35+ ${{ env.obs_path }}/update_file_detail.txt
36+ ${{ env.obs_path }}/gitdiff.txt
37+ path: ${{ steps.process_checkout.outputs.path }}
38+ -
39+ name: staticcheck
40+ identifier: staticcheck
41+ uses: cann/.gitcode/actions/staticcheck@master
42+ with:
43+ check_type: ${{ inputs.check_type }}
44+ target_branch: ${{ env.TARGET_BRANCH }}
45+ repo_name: ${{ env.repo_name }}
46+ merge_id: ${{ env.MERGE_ID }}
47+ commit_id: '0'
48+ workspace: ${{ steps.process_checkout.outputs.path }}
49+ org_name: ${{ env.org_name }}
50+ -
51+ name: upload
52+ if: ${{ always() }}
53+ uses: obs-upload
54+ with:
55+ endpoint: "https://obs.cn-north-4.myhuaweicloud.com"
56+ bucket: "ascend-ci"
57+ access-key: ${{secrets.AK}}
58+ secret-key: ${{secrets.SK}}
59+ artifact-path: |
60+ ${{ steps.process_checkout.outputs.path }}/*.csv
61+ ${{ steps.process_checkout.outputs.path }}/StaticCheck_*.json
62+ object-prefix: ${{ env.obs_path }}/
63+ if: "${{ default() }}"
64+ runs-on: [dedicate-hosted, x64, small]
65+ container:
66+ image: swr.cn-north-4.myhuaweicloud.com/static_check/${{ inputs.image_version }}