已合并
[CICD]Add a GitCode Actions workflow for PR #492
dilililiwhy创建于 8月5日
[CICD]Add a GitCode Actions workflow for PR #492
已合并
共 3 个文件变更+257-0
| @@ -0,0 +1,129 @@ | |||
| 1 | +name: PR-pipeline_mindie-sd | ||
| 2 | + | ||
| 3 | +on: | ||
| 4 | + pull_request_comment: | ||
| 5 | + types: [ created ] | ||
| 6 | + branches: [ "dev", "master" ] | ||
| 7 | + comments: [ '^compile$' ] | ||
| 8 | + | ||
| 9 | +env: | ||
| 10 | + pr_id: ${{ atomgit.event.pull_request.number }} | ||
| 11 | + | ||
| 12 | +stages: | ||
| 13 | + stage1: | ||
| 14 | + name: CodeCheck | ||
| 15 | + select: selected_by_default | ||
| 16 | + jobs: | ||
| 17 | + | ||
| 18 | + CodeCheck_pre_commit: | ||
| 19 | + name: CodeCheck_pre_commit | ||
| 20 | + runs-on: [ dedicate-hosted, x64, 2xlarge ] | ||
| 21 | + container: | ||
| 22 | + image: swr.cn-north-4.myhuaweicloud.com/inference/ascend_mindie_ubuntu_x86:20260704_ubuntu24_3.1.0_cann9.0.1_torch2.9.0_py311 | ||
| 23 | + steps: | ||
| 24 | + - name: checkout | ||
| 25 | + uses: checkout | ||
| 26 | + with: | ||
| 27 | + ref: refs/merge-requests/${{ env.pr_id }}/merge | ||
| 28 | + - name: install gitleaks | ||
| 29 | + run: | | ||
| 30 | + cd ${ATOMGIT_WORKSPACE} | ||
| 31 | + # TODO 将gitleaks依赖集成到镜像 | ||
| 32 | + wget --no-host-directories -c --no-check-certificate https://pytorch-package.obs.cn-north-4.myhuaweicloud.com/pta-codecheck/gitleaks | ||
| 33 | + chmod +x gitleaks | ||
| 34 | + cd - | ||
| 35 | + - name: pre-commit | ||
| 36 | + uses: openlibing-pre-commit-action | ||
| 37 | + | ||
| 38 | + Detect_file_changes: | ||
| 39 | + name: Detect_file_changes | ||
| 40 | + runs-on: [ dedicate-hosted, x64, 2xlarge ] | ||
| 41 | + container: | ||
| 42 | + image: swr.cn-north-4.myhuaweicloud.com/inference/ascend_mindie_ubuntu_x86:20260704_ubuntu24_3.1.0_cann9.0.1_torch2.9.0_py311 | ||
| 43 | + outputs: | ||
| 44 | + need_build: ${{ steps.set-skip.outputs.need_build }} | ||
| 45 | + steps: | ||
| 46 | + - name: checkout | ||
| 47 | + uses: checkout | ||
| 48 | + with: | ||
| 49 | + ref: refs/merge-requests/${{ env.pr_id }}/merge | ||
| 50 | + fetch-depth: 0 | ||
| 51 | + - name: Only_doc_commit | ||
| 52 | + id: filter | ||
| 53 | + uses: paths-changes-filter | ||
| 54 | + with: | ||
| 55 | + event-name: 'pull_request' | ||
| 56 | + base: ${{ atomgit.event.pull_request.base.ref }} | ||
| 57 | + repo: ${{ atomgit.repository }} | ||
| 58 | + number: ${{ env.pr_id }} | ||
| 59 | + token: ${{ atomgit.ATOMGIT_TOKEN }} | ||
| 60 | + list-files: json | ||
| 61 | + predicate-quantifier: every | ||
| 62 | + filters: | | ||
| 63 | + changed: | ||
| 64 | + - '**' | ||
| 65 | + non-doc: | ||
| 66 | + - '!**.md' | ||
| 67 | + - '!**.rst' | ||
| 68 | + - '!**.log' | ||
| 69 | + - '!**.png' | ||
| 70 | + - '!**.jpg' | ||
| 71 | + - '!**.doc' | ||
| 72 | + - '!**.eddx' | ||
| 73 | + - '!**.svg' | ||
| 74 | + - name: set build skip flag | ||
| 75 | + id: set-skip | ||
| 76 | + run: | | ||
| 77 | + echo "changed: ${{ steps.filter.outputs.changed_files }}" | ||
| 78 | + echo "non-doc: ${{ steps.filter.outputs.non-doc }}" | ||
| 79 | + if [ "${{ steps.filter.outputs.non-doc }}" = "true" ]; then | ||
| 80 | + echo "need_build=yes" >> "$ATOMGIT_OUTPUT" | ||
| 81 | + else | ||
| 82 | + echo "need_build=no" >> "$ATOMGIT_OUTPUT" | ||
| 83 | + fi | ||
| 84 | + | ||
| 85 | + stage2: | ||
| 86 | + name: Build | ||
| 87 | + select: selected_by_default | ||
| 88 | + jobs: | ||
| 89 | + Build_linux_x86_abi1: | ||
| 90 | + name: Build_linux_x86_abi1 | ||
| 91 | + if: ${{ jobs.Detect_file_changes.outputs.need_build == 'yes' }} | ||
| 92 | + uses: .gitcode/workflows/build_job.yml | ||
| 93 | + with: | ||
| 94 | + abi_type: "1" | ||
| 95 | + arch: "x86_64" | ||
| 96 | + CP_DOCKER_IMG: "swr.cn-north-4.myhuaweicloud.com/inference/ascend_mindie_ubuntu_x86:20260704_ubuntu24_3.1.0_cann9.0.1_torch2.9.0_py311" | ||
| 97 | + runs_on_arch: "x86" | ||
| 98 | + pr_id: "${{ atomgit.event.pull_request.number }}" | ||
| 99 | + | ||
| 100 | + Build_linux_arm_abi1: | ||
| 101 | + name: Build_linux_arm_abi1 | ||
| 102 | + if: ${{ jobs.Detect_file_changes.outputs.need_build == 'yes' }} | ||
| 103 | + uses: .gitcode/workflows/build_job.yml | ||
| 104 | + with: | ||
| 105 | + abi_type: "1" | ||
| 106 | + arch: "aarch64" | ||
| 107 | + CP_DOCKER_IMG: "swr.cn-north-4.myhuaweicloud.com/inference/ascend_mindie_ubuntu_aarch64:20260704_ubuntu24_3.1.0_cann9.0.1_torch2.9.0_py311" | ||
| 108 | + runs_on_arch: "arm64" | ||
| 109 | + pr_id: "${{ atomgit.event.pull_request.number }}" | ||
| 110 | + | ||
| 111 | + Build_linux_arm_abi0: | ||
| 112 | + name: Build_linux_arm_abi0 | ||
| 113 | + if: ${{ jobs.Detect_file_changes.outputs.need_build == 'yes' }} | ||
| 114 | + uses: .gitcode/workflows/build_job.yml | ||
| 115 | + with: | ||
| 116 | + abi_type: "0" | ||
| 117 | + arch: "aarch64" | ||
| 118 | + CP_DOCKER_IMG: "swr.cn-north-4.myhuaweicloud.com/inference/ascend_mindie_ubuntu_aarch64:20260704_ubuntu24_3.1.0_cann9.0.1_torch2.9.0_py311" | ||
| 119 | + runs_on_arch: "arm64" | ||
| 120 | + pr_id: "${{ atomgit.event.pull_request.number }}" | ||
| 121 | + | ||
| 122 | + UT_linux_arm: | ||
| 123 | + name: UT_linux_arm | ||
| 124 | + if: ${{ jobs.Detect_file_changes.outputs.need_build == 'yes' }} | ||
| 125 | + uses: .gitcode/workflows/ut_job.yml | ||
| 126 | + with: | ||
| 127 | + CP_DOCKER_IMG: "swr.cn-north-4.myhuaweicloud.com/inference/ascend_mindie_ubuntu_aarch64:20260704_ubuntu24_3.1.0_cann9.0.1_torch2.9.0_py311" | ||
| 128 | + runs_on_arch: "arm64" | ||
| 129 | + pr_id: "${{ atomgit.event.pull_request.number }}" | ||
| @@ -0,0 +1,62 @@ | |||
| 1 | +name: Build Job | ||
| 2 | + | ||
| 3 | +on: | ||
| 4 | + workflow_call: | ||
| 5 | + inputs: | ||
| 6 | + abi_type: | ||
| 7 | + required: true | ||
| 8 | + type: string | ||
| 9 | + CP_DOCKER_IMG: | ||
| 10 | + required: true | ||
| 11 | + type: string | ||
| 12 | + pr_id: | ||
| 13 | + required: true | ||
| 14 | + type: string | ||
| 15 | + runs_on_arch: | ||
| 16 | + required: true | ||
| 17 | + type: string | ||
| 18 | + arch: | ||
| 19 | + required: true | ||
| 20 | + type: string | ||
| 21 | + | ||
| 22 | +jobs: | ||
| 23 | + JOB_Compile: | ||
| 24 | + name: Compile | ||
| 25 | + select: selected_by_default | ||
| 26 | + needs: [ ] | ||
| 27 | + runs-on: [ 'dedicate-hosted', '${{ inputs.runs_on_arch }}', '2xlarge' ] | ||
| 28 | + container: | ||
| 29 | + image: ${{ inputs.CP_DOCKER_IMG }} | ||
| 30 | + options: --user root | ||
| 31 | + | ||
| 32 | + steps: | ||
| 33 | + - name: Checkout repository with pre merge | ||
| 34 | + uses: checkout | ||
| 35 | + with: | ||
| 36 | + repository: ${{atomgit.repositoryurl}} | ||
| 37 | + ref: refs/merge-requests/${{ inputs.pr_id }}/merge | ||
| 38 | + | ||
| 39 | + - name: Execute_shell | ||
| 40 | + run: |- | ||
| 41 | + abi_type=${{ inputs.abi_type }} | ||
| 42 | + arch=`uname -m` | ||
| 43 | + WORKSPACE=${{atomgit.workspace}} | ||
| 44 | + cd ${WORKSPACE} | ||
| 45 | + python_version_major=$(python --version 2>&1 |awk '{print $2}' | cut -d. -f1,2) | ||
| 46 | + # check python & abi version | ||
| 47 | + if [ "${python_version_major}" != "3.11" ]; then | ||
| 48 | + echo "Error: note that the required python version is 3.11, but the actual python version is ${python_version_major}" | ||
| 49 | + exit 1 | ||
| 50 | + else | ||
| 51 | + echo "python_version_major: ${python_version_major}" | ||
| 52 | + fi | ||
| 53 | + echo "abi version: ${abi_type}" | ||
| 54 | + if [ "${abi_type}"x == "0"x ]; then | ||
| 55 | + export PATH=/opt/rh/devtoolset-7/root/usr/bin:${PATH} | ||
| 56 | + gcc --version | ||
| 57 | + else | ||
| 58 | + gcc --version | ||
| 59 | + fi | ||
| 60 | + source /usr/local/Ascend/ascend-toolkit/set_env.sh | ||
| 61 | + export USER_ABI_VERSION="${abi_type}" && python setup.py bdist_wheel | ||
| 62 | + ls -l dist/* | ||
| @@ -0,0 +1,66 @@ | |||
| 1 | +name: UT Job | ||
| 2 | + | ||
| 3 | +on: | ||
| 4 | + workflow_call: | ||
| 5 | + inputs: | ||
| 6 | + CP_DOCKER_IMG: | ||
| 7 | + required: true | ||
| 8 | + type: string | ||
| 9 | + pr_id: | ||
| 10 | + required: true | ||
| 11 | + type: string | ||
| 12 | + runs_on_arch: | ||
| 13 | + required: true | ||
| 14 | + type: string | ||
| 15 | + | ||
| 16 | +jobs: | ||
| 17 | + JOB_Compile: | ||
| 18 | + name: Test | ||
| 19 | + select: selected_by_default | ||
| 20 | + needs: [ ] | ||
| 21 | + runs-on: [ 'dedicate-hosted', '${{ inputs.runs_on_arch }}', '2xlarge' ] | ||
| 22 | + container: | ||
| 23 | + image: ${{ inputs.CP_DOCKER_IMG }} | ||
| 24 | + steps: | ||
| 25 | + - name: Checkout repository with pre merge | ||
| 26 | + uses: checkout | ||
| 27 | + with: | ||
| 28 | + repository: ${{atomgit.repositoryurl}} | ||
| 29 | + ref: refs/merge-requests/${{ inputs.pr_id }}/merge | ||
| 30 | + | ||
| 31 | + - name: Execute_shell | ||
| 32 | + run: |- | ||
| 33 | + WORKSPACE=${{atomgit.workspace}} | ||
| 34 | + arch=`uname -m` | ||
| 35 | + python_3rdparty_path=/opt/buildtools/python-3.11.4/lib/python3.11/site-packages | ||
| 36 | + source /usr/local/Ascend/ascend-toolkit/set_env.sh | ||
| 37 | + export PYTHONPATH=${python_3rdparty_path}:$PYTHONPATH | ||
| 38 | + cd ${WORKSPACE}/build | ||
| 39 | + sh build.sh | ||
| 40 | + | ||
| 41 | + if [ ${arch} == aarch64 -a -f ${WORKSPACE}/tests/run_UT_test.sh ]; then | ||
| 42 | + pip list| grep torch | ||
| 43 | + wget -q https://repo.huaweicloud.com/ascend/repos/pypi/triton-ascend/triton_ascend-3.2.1-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl | ||
| 44 | + pip3 install triton_ascend-3.2.1-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl | ||
| 45 | + pip3 install -r ${WORKSPACE}/requirements.txt | ||
| 46 | + pip3 install coverage | ||
| 47 | + | ||
| 48 | + source /usr/local/Ascend/nnal/atb/set_env.sh | ||
| 49 | + export PYTORCH_NPU_INSTALL_PATH=${python_3rdparty_path}/torch_npu | ||
| 50 | + export LD_LIBRARY_PATH=${python_3rdparty_path}/torch_npu/lib:$LD_LIBRARY_PATH | ||
| 51 | + export LD_LIBRARY_PATH=${python_3rdparty_path}/torch/lib:$LD_LIBRARY_PATH | ||
| 52 | + export LD_LIBRARY_PATH=${python_3rdparty_path}/torch.libs:$LD_LIBRARY_PATH | ||
| 53 | + export LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu/libgomp.so.1:$LD_LIBRARY_PATH | ||
| 54 | + export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/$(uname -i)-linux/devlib:$LD_LIBRARY_PATH | ||
| 55 | + export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/$(uname -i)-linux/lib64:$LD_LIBRARY_PATH | ||
| 56 | + | ||
| 57 | + cd ${WORKSPACE}/tests | ||
| 58 | + sed -i '$d' run_UT_test.sh | ||
| 59 | + bash run_UT_test.sh 2>&1 |tee build.log | ||
| 60 | + if cat build.log|grep OK ; then | ||
| 61 | + echo dt success | ||
| 62 | + else | ||
| 63 | + echo dt failed | ||
| 64 | + exit 1 | ||
| 65 | + fi | ||
| 66 | + fi | ||
🟠 High Priority
第 51 行
export LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu/libgomp.so.1:$LD_LIBRARY_PATH将LD_LIBRARY_PATH设置为一个具体的.so.1文件路径。LD_LIBRARY_PATH的语义是目录列表,动态链接器(ld.so)只会在此列表中搜索目录,不会将单个.so文件视为有效搜索路径。这将导致该条目完全无效,且如果本意是让libgomp.so.1被找到,这个写法也无法达成目的。应使用目录路径/usr/lib/aarch64-linux-gnu。建议:将
.so文件路径替换为其所在目录/usr/lib/aarch64-linux-gnu,使动态链接器能正确搜索该目录下的共享库。/libgomp.so.1:$LD_LIBRARY_PATH