已合并
action上线适配 #39
yajie_caroline创建于 13 天前
action上线适配 #39
已合并
yajie_caroline创建于 13 天前
6 个文件变更+544-0
@@ -0,0 +1,92 @@
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, 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+LOG_HEAD() {
14+ local msg=${1}
15+ local ts
16+ ts=$(date +%Y%m%d-%H%M%S)
17+ echo "[INFO] ${ts} ${msg}"
18+}
19+ 
20+LOG_ERROR() {
21+ local msg=${1}
22+ local ts
23+ ts=$(date +%Y%m%d-%H%M%S)
24+ echo "[ERROR] ${ts} ${msg}"
25+}
26+ 
27+LOG_DO() {
28+ local cmd="$*"
29+ local ts
30+ ts=$(date +%Y%m%d-%H%M%S)
31+ echo "[Command] ${ts} ${cmd}"
32+ ${cmd}
33+}
34+ 
35+LOG_INFO() {
36+ local msg=${1}
37+ local ts
38+ ts=$(date +%Y%m%d-%H%M%S)
39+ echo "[INFO] ${ts} ${msg}"
40+}
41+ 
42+DP_ASSERT_CHECK_SKIP() {
43+ local actual_value=${1}
44+ local assert_msg=${2}
45+ if [ "${actual_value}" != "0" ] && [ "${actual_value}" != "200" ]; then
46+ LOG_ERROR "${assert_msg} is failed."
47+ exit 1
48+ else
49+ LOG_INFO "${assert_msg} is success."
50+ fi
51+}
52+ 
53+CHECK_ENV_VAR() {
54+ local var_name=${1}
55+ local var_value=${!var_name}
56+ if [[ -z "${var_value}" ]]; then
57+ LOG_ERROR "Environment variable ${var_name} is not set"
58+ exit 1
59+ fi
60+}
61+ 
62+CHECK_ENV_VAR task_name
63+CHECK_ENV_VAR WORKSPACE
64+CHECK_ENV_VAR GIT_TARGET_BRANCH
65+ 
66+LOG_HEAD "package_name: ${package_name}"
67+LOG_HEAD "task_name: ${task_name}"
68+LOG_HEAD "WORKSPACE: ${WORKSPACE}"
69+LOG_HEAD "GIT_TARGET_BRANCH: ${GIT_TARGET_BRANCH}"
70+LOG_HEAD "ge_st_rt2: ${ge_st_rt2}"
71+ 
72+ASCEND_3RD_LIB_PATH="/home/jenkins/opensource"
73+ 
74+if [[ "${task_name}" == *_ubuntu24 ]]; then
75+ sudo update-alternatives --set gcc /usr/bin/gcc-14
76+else
77+ rm -rf /home/jenkins/opensource/lib_cache
78+ ln -s /home/jenkins/opensource/ubuntu20/lib_cache /home/jenkins/opensource/lib_cache
79+ echo "source devtoolset"
80+ source /opt/rh/devtoolset-7/enable
81+fi
82+gcc --version
83+cmake --version
84+ 
85+cd "${WORKSPACE}" || exit
86+ 
87+ 
88+set +e
89+LOG_DO bash build.sh --pkg --cann_3rd_lib_path="/home/jenkins/opensource"
90+BUILD_EXIT_CODE=$?
91+set -e
92+DP_ASSERT_CHECK_SKIP "${BUILD_EXIT_CODE}" "bash build.sh"
@@ -0,0 +1,96 @@
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, 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+LOG_HEAD() {
14+ local msg=${1}
15+ local ts
16+ ts=$(date +%Y%m%d-%H%M%S)
17+ echo "[INFO] ${ts} ${msg}"
18+}
19+ 
20+LOG_ERROR() {
21+ local msg=${1}
22+ local ts
23+ ts=$(date +%Y%m%d-%H%M%S)
24+ echo "[ERROR] ${ts} ${msg}"
25+}
26+ 
27+LOG_DO() {
28+ local cmd="$*"
29+ local ts
30+ ts=$(date +%Y%m%d-%H%M%S)
31+ echo "[Command] ${ts} ${cmd}"
32+ ${cmd}
33+}
34+ 
35+LOG_INFO() {
36+ local msg=${1}
37+ local ts
38+ ts=$(date +%Y%m%d-%H%M%S)
39+ echo "[INFO] ${ts} ${msg}"
40+}
41+ 
42+DP_ASSERT_CHECK_SKIP() {
43+ local actual_value=${1}
44+ local assert_msg=${2}
45+ if [ "${actual_value}" != "0" ] && [ "${actual_value}" != "200" ]; then
46+ LOG_ERROR "${assert_msg} is failed."
47+ exit 1
48+ else
49+ LOG_INFO "${assert_msg} is success."
50+ fi
51+}
52+ 
53+CHECK_ENV_VAR() {
54+ local var_name=${1}
55+ local var_value=${!var_name}
56+ if [[ -z "${var_value}" ]]; then
57+ LOG_ERROR "Environment variable ${var_name} is not set"
58+ exit 1
59+ fi
60+}
61+ 
62+CHECK_ENV_VAR WORKSPACE
63+CHECK_ENV_VAR repo_name
64+CHECK_ENV_VAR GIT_TARGET_BRANCH
65+ 
66+LOG_INFO "External environment variables:"
67+LOG_INFO " WORKSPACE=${WORKSPACE}"
68+LOG_INFO " repo_name=${repo_name}"
69+LOG_INFO " GIT_TARGET_BRANCH=${GIT_TARGET_BRANCH}"
70+ 
71+export PATH=/opt/buildtools/python-3.10.2/bin:$PATH
72+sudo update-alternatives --set gcc /usr/bin/gcc-14
73+gcc --version
74+cmake --version
75+rm -rf /home/jenkins/opensource/json
76+ 
77+if [ -f "/home/jenkins/Ascend/cann/bin/setenv.bash" ]; then
78+ export ASCEND_HOME_PATH=/home/jenkins/Ascend/cann
79+elif [ -f "/home/jenkins/Ascend/latest/bin/setenv.bash" ]; then
80+ export ASCEND_HOME_PATH=/home/jenkins/Ascend/latest
81+else
82+ export ASCEND_HOME_PATH=/home/jenkins/Ascend/ascend-toolkit/latest
83+ export ASCEND_CUSTOM_PATH=/home/jenkins/Ascend/ascend-toolkit/latest
84+ export STABLE_LIBS_PATH=/home/jenkins/Ascend/ascend-toolkit/latest
85+fi
86+ 
87+source "${ASCEND_HOME_PATH}/bin/setenv.bash"
88+# cat "${ASCEND_INSTALL_PATH}/compiler/version.info"
89+ 
90+cd "${WORKSPACE}" || exit
91+ 
92+set +e
93+LOG_DO sh build.sh --utest --cann_3rd_lib_path="/home/jenkins/opensource"
94+BUILD_EXIT_CODE=$?
95+set -e
96+DP_ASSERT_CHECK_SKIP "${BUILD_EXIT_CODE}" "Run UT TESTCASE"
@@ -0,0 +1,118 @@
1+name: PR-pipeline_atvc
2+ 
3+concurrency:
4+ max: 15
5+ exceed-action: IGNORE
6+ enable: false
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: ${{atomgit.event.repository.name}}
24+ MERGE_ID: ${{atomgit.event.pull_request.number}}
25+ obs_path: "${{ env.org_name }}/${{ env.repo_name }}/ci/package/${{ env.MERGE_ID }}"
26+ TARGET_BRANCH: ${{atomgit.ref_name}}
27+ SOURCE_BRANCH: ${{atomgit.head_ref}}
28+ obs_smoke_path: "${{ env.obs_path }}/presmoke/2"
29+ online: ${{ vars.APPLY_LABEL }}
30+ 
31+ 
32+stages:
33+ stage1:
34+ name: PreBuild
35+ jobs:
36+ JOB_image:
37+ name: Test_image
38+ steps:
39+ - name: revise_image
40+ identifier: revise_image
41+ uses: cann/.gitcode/actions/revise-img@master
42+ with:
43+ repo_name: 'atvc'
44+ target_branch: ${{ env.TARGET_BRANCH }}
45+ repo_url: ${{ vars.CI_PATH }}
46+ -
47+ name: show_output
48+ run: |
49+ echo "Compile_Ascend_X86: ${{ steps.revise_image.outputs.Compile_Ascend_X86 }}"
50+ runs-on: [self-hosted, arch=x64, spec=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-atvc_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-atvc_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_ubuntu24 }}
84+ arch: 'x64'
85+ package_name: 'cann-atvc_linux-x86_64_ubuntu24.run'
86+ JOB_codecheck:
87+ name: CodeCheck
88+ uses: cann/.gitcode/.gitcode/workflows/codecheck_action.yml@master
89+ with:
90+ precommit_image_version: ${{ jobs.JOB_image.outputs.precommit }}
91+ codecheck_image_version: ${{ jobs.JOB_image.outputs.codecheck }}
92+ JOB_staticcheck_md_check:
93+ name: CodeCheck_staticcheck_md_check
94+ uses: .gitcode/workflows/staticcheck_action.yml
95+ with:
96+ check_type: 'md_check'
97+ image_version: ${{ jobs.JOB_image.outputs.staticcheck }}
98+ pre:
99+ - type: auto
100+ fail-fast: false
101+ stage3:
102+ name: UT
103+ jobs:
104+ JOB_ut:
105+ name: UT_atvc
106+ uses: .gitcode/workflows/ut_action.yml
107+ with:
108+ image_version: ${{ jobs.JOB_image.outputs.UT_Test }}
109+ ge_st_rt2: 'ophost'
110+ pre:
111+ - type: auto
112+ fail-fast: false
113+ 
114+post:
115+ jobs:
116+ job_post:
117+ name: Test_post
118+ uses: cann/.gitcode/.gitcode/workflows/post_action.yml@master
A.gitcode/workflows/compile_action.yml+104-0文件内容审核中,请稍后刷新重试
A.gitcode/workflows/staticcheck_action.yml+66-0文件内容审核中,请稍后刷新重试
A.gitcode/workflows/ut_action.yml+68-0文件内容审核中,请稍后刷新重试