1- name : DLCompiler main test ci
1+ name : Release on Tag
22
33on :
4- workflow_dispatch :
54 push :
6- branches :
7- - main
8- pull_request :
9- branches :
10- - main
5+ tags :
6+ - " v*.*.*" # 只对形如 v1.2.3 的 tag 触发
7+
8+ jobs :
9+ release :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v4
13+ with :
14+ fetch-depth : 0 # 获取完整 git 历史,便于 setuptools_scm 等工具
15+
16+ - name : Set up Python
17+ uses : actions/setup-python@v5
18+ with :
19+ python-version : " 3.10"
20+
21+ - name : Install build dependencies
22+ run : |
23+ pip install build twine
24+
25+ # 可选:如果使用 setuptools_scm 动态管理版本,需安装
26+ # - name: Install setuptools_scm
27+ # run: pip install setuptools_scm
28+
29+ - name : Build package
30+ run : python -m build
31+
32+ - name : Create Release and Upload Assets
33+ uses : softprops/action-gh-release@v2
34+ with :
35+ files : |
36+ dist/*.whl
37+ dist/*.tar.gz
38+ env :
39+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
40+
1141
1242env :
13- CI_PATH : " ${{ vars.CI_BASE_PATH }}/GitHub/${{ github.repository }}/${GITHUB_RUN_NUMBER}"
43+ RELEASE_PATH : " ${{ vars.CI_BASE_PATH }}/GitHub/Release /${{ github.repository }}/${GITHUB_RUN_NUMBER}"
1444 THIRD_PARTY_PATH : " ${{ vars.CI_BASE_PATH }}/data/DLCompiler/third_party"
1545
1646concurrency :
1747 group : ${{ github.workflow }}-${{ github.ref }}
1848 cancel-in-progress : true
1949
2050jobs :
21- AscendTests :
51+ release :
2252 if : github.repository == 'DeepLink-org/DLCompiler'
2353 runs-on : DLC-60
2454
@@ -31,35 +61,39 @@ jobs:
3161 - name : Create custom directory
3262 run : |
3363 set -ex
34- echo ${{ env.CI_PATH }}
35- mkdir -p ${{ env.CI_PATH }}
64+ echo ${{ env.RELEASE_PATH }}
65+ mkdir -p ${{ env.RELEASE_PATH }}
3666
3767 - name : Clean custom directory
3868 run : |
3969 set -ex
40- if [ -d "${{ env.CI_PATH }}" ]; then
41- rm -rf ${{ env.CI_PATH }}/*
42- rm -rf ${{ env.CI_PATH }}/.github
70+ if [ -d "${{ env.RELEASE_PATH }}" ]; then
71+ rm -rf ${{ env.RELEASE_PATH }}/*
72+ rm -rf ${{ env.RELEASE_PATH }}/.github
4373 fi
4474
4575 - name : Move code to custom directory
4676 run : |
4777 set -ex
48- mv $GITHUB_WORKSPACE/* ${{ env.CI_PATH }}/
49- mv $GITHUB_WORKSPACE/.github ${{ env.CI_PATH }}/
50- mv $GITHUB_WORKSPACE/.git ${{ env.CI_PATH }}/
78+ mv $GITHUB_WORKSPACE/* ${{ env.RELEASE_PATH }}/
79+ mv $GITHUB_WORKSPACE/.github ${{ env.RELEASE_PATH }}/
80+ mv $GITHUB_WORKSPACE/.git ${{ env.RELEASE_PATH }}/
5181
5282 - name : Setup Git Safe Directory
5383 run : |
5484 git config --global --add safe.directory '*'
5585
86+ - name : Install build dependencies
87+ run : |
88+ pip install build twine -i https://mirrors.huaweicloud.com/repository/pypi/simple
89+
5690 - name : Build and install DLCompiler
5791 run : |
5892 set -ex
5993 source /home/dlc_ci/.bashrc
6094 source activate dlcompiler
6195 source /usr/local/Ascend/ascend-toolkit/set_env.sh
62- cd ${{ env.CI_PATH }}
96+ cd ${{ env.RELEASE_PATH }}
6397 export JSON_PATH34=${{ vars.CI_BASE_PATH }}/data/v34/include.zip
6498 export GOOGLETEST_DIR34=${{ vars.CI_BASE_PATH }}/data/v34/googletest
6599 export LLVM_TGZ_PATH34=${{ vars.CI_BASE_PATH }}/data/v34/llvm-064f02da-ubuntu-arm64.tar.gz
@@ -74,20 +108,17 @@ jobs:
74108 git submodule update --init
75109 echo "git submodule update done."
76110 pip install nanobind -i https://mirrors.huaweicloud.com/repository/pypi/simple
77- bash compile_shared.sh apply_patch=true
111+ if [[ "${{ github.ref }}" == refs/tags/* ]]; then
112+ bash compile_shared.sh apply_patch=true build_package=true
113+ fi
78114
79- - name : Run tests on ascend
80- run : |
81- set -ex
82- source /home/dlc_ci/.bashrc
83- source activate dlcompiler
84- source /usr/local/Ascend/ascend-toolkit/set_env.sh
85- cd ${{env.CI_PATH }}
86- echo "whoami? $(whoami)"
87- echo "which python? $(which python)"
88- export PATH=${{ vars.CI_BASE_PATH }}/data/bishengir_latest/:$PATH
89- export ASCEND_RT_VISIBLE_DEVICES=7
90- bash test/ascend/run_tests.sh
115+ - name : Create Release and Upload Assets
116+ uses : softprops/action-gh-release@v2
117+ with :
118+ files : |
119+ third_party/triton/dist/*.whl
120+ env :
121+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
91122
92123 - name : Clear workfile
93124 if : always()
97128 rm -rf $workdir
98129 mkdir $workdir
99130 chmod -R 777 $workdir
100- if [ -d "${{ env.CI_PATH }}" ]; then
101- rm -rf ${{ env.CI_PATH }}
102- fi
131+ if [ -d "${{ env.RELEASE_PATH }}" ]; then
132+ rm -rf ${{ env.RELEASE_PATH }}
133+ fi
0 commit comments