Skip to content

Commit 01e3d59

Browse files
celestialliYikun
andauthored
add workflow to build and release wheel (#775)
### What this PR does / why we need it? This is a continuing work of #716. This PR add workflow to build and release wheel, and also release source to PYPI. We have 3 conditions to trigger the workflow: 1. PR to `main` and `*-dev` 2. push to `main` and `*-dev` 3. push tag with name of `v*` Release to PYPI will only be done under condition 3. Under condition 1 and 2, it will generate .tar.gz and build .whl, upload to github artifacts but will not release. update: Will build .whl and upload to github artifacts with scheduled task. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? All triggered conditions are well tested with my fork repo. --------- Signed-off-by: Shuqiao Li <celestialli@outlook.com> Signed-off-by: Yikun Jiang <yikunkero@gmail.com> Co-authored-by: Yikun Jiang <yikunkero@gmail.com>
1 parent a0c3e9b commit 01e3d59

File tree

6 files changed

+233
-2
lines changed

6 files changed

+233
-2
lines changed

.github/Dockerfile.buildwheel

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#
2+
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# This file is a part of the vllm-ascend project.
16+
#
17+
ARG PY_VERSION=3.10
18+
FROM quay.io/ascend/cann:8.0.0-910b-ubuntu22.04-py${PY_VERSION}
19+
20+
ARG COMPILE_CUSTOM_KERNELS=1
21+
22+
# Define environments
23+
ENV DEBIAN_FRONTEND=noninteractive
24+
ENV COMPILE_CUSTOM_KERNELS=${COMPILE_CUSTOM_KERNELS}
25+
RUN apt-get update -y && \
26+
apt-get install -y python3-pip git vim wget net-tools gcc g++ cmake libnuma-dev && \
27+
rm -rf /var/cache/apt/* && \
28+
rm -rf /var/lib/apt/lists/*
29+
30+
WORKDIR /workspace
31+
32+
COPY . /workspace/vllm-ascend/
33+
34+
# Install req
35+
RUN python3 -m pip install -r vllm-ascend/requirements.txt --extra-index https://download.pytorch.org/whl/cpu/ && \
36+
python3 -m pip install twine
37+
38+
# Install vllm-ascend
39+
RUN source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
40+
source /usr/local/Ascend/nnal/atb/set_env.sh && \
41+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib && \
42+
cd vllm-ascend && \
43+
python3 setup.py bdist_wheel && \
44+
ls -l dist && \
45+
for f in dist/*.whl; do mv "$f" "$(echo "$f" | sed -e 's/-linux_x86_64\.whl$/-manylinux1_x86_64.whl/' -e 's/-linux_aarch64\.whl$/-manylinux2014_aarch64.whl/')"; done && \
46+
ls -l dist
47+
48+
CMD ["/bin/bash"]

.github/actionlint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ self-hosted-runner:
55
- linux-arm64-npu-2
66
- linux-arm64-npu-4
77
- linux-arm64-npu-static-8
8+
- ubuntu-24.04-arm

.github/workflows/actionlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747

4848
- name: "Run actionlint"
4949
env:
50-
SHELLCHECK_OPTS: --exclude=SC2046,SC2006
50+
SHELLCHECK_OPTS: --exclude=SC2046,SC2006,SC2086
5151
run: |
5252
echo "::add-matcher::.github/workflows/matchers/actionlint.json"
5353
tools/actionlint.sh -color

.github/workflows/release_code.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#
2+
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# This file is a part of the vllm-ascend project.
16+
#
17+
18+
name: build / sdist
19+
20+
on:
21+
pull_request:
22+
branches:
23+
- 'main'
24+
- '*-dev'
25+
paths:
26+
- '.github/workflows/release_code.yml'
27+
- 'vllm_ascend/**'
28+
- 'setup.py'
29+
- 'pyproject.toml'
30+
- 'requirements.txt'
31+
- 'cmake/**'
32+
- 'CMakeLists.txt'
33+
- 'csrc/**'
34+
push:
35+
branches:
36+
- 'main'
37+
- '*-dev'
38+
tags:
39+
- 'v*'
40+
paths:
41+
- '.github/workflows/release_code.yml'
42+
- 'vllm_ascend/**'
43+
- 'setup.py'
44+
- 'pyproject.toml'
45+
- 'requirements.txt'
46+
- 'cmake/**'
47+
- 'CMakeLists.txt'
48+
- 'csrc/**'
49+
50+
jobs:
51+
build:
52+
name: release code
53+
runs-on: ubuntu-latest
54+
strategy:
55+
matrix:
56+
python-version: ["3.10"]
57+
steps:
58+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
59+
60+
- name: Print
61+
run: |
62+
lscpu
63+
64+
- name: Set up Python ${{ matrix.python-version }}
65+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
66+
with:
67+
python-version: ${{ matrix.python-version }}
68+
69+
- name: Install dependencies
70+
run: |
71+
python3 -m pip install twine setuptools_scm
72+
73+
- name: Generate tar.gz
74+
run: |
75+
python3 setup.py sdist
76+
ls dist
77+
78+
- name: Archive tar.gz
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: vllm-ascend-src
82+
path: dist/*
83+
84+
- name: Release
85+
if: startsWith(github.ref, 'refs/tags/')
86+
run: |
87+
python3 -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}

.github/workflows/release_whl.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#
2+
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# This file is a part of the vllm-ascend project.
16+
#
17+
18+
name: build / wheel
19+
20+
on:
21+
pull_request:
22+
branches:
23+
- 'main'
24+
- '*-dev'
25+
paths:
26+
- '.github/workflows/release_whl.yml'
27+
- '.github/Dockerfile.buildwheel'
28+
- 'vllm_ascend/**'
29+
- 'setup.py'
30+
- 'pyproject.toml'
31+
- 'requirements.txt'
32+
- 'cmake/**'
33+
- 'CMakeLists.txt'
34+
- 'csrc/**'
35+
push:
36+
branches:
37+
- 'main'
38+
- '*-dev'
39+
tags:
40+
- 'v*'
41+
paths:
42+
- '.github/workflows/release_whl.yml'
43+
- '.github/Dockerfile.buildwheel'
44+
- 'vllm_ascend/**'
45+
- 'setup.py'
46+
- 'pyproject.toml'
47+
- 'requirements.txt'
48+
- 'cmake/**'
49+
- 'CMakeLists.txt'
50+
- 'csrc/**'
51+
52+
jobs:
53+
build:
54+
name: build and release wheel
55+
strategy:
56+
matrix:
57+
os: [ubuntu-24.04, ubuntu-24.04-arm]
58+
python-version: ['3.9', '3.10', '3.11']
59+
runs-on: ${{ matrix.os }}
60+
steps:
61+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
62+
63+
- name: Print
64+
run: |
65+
lscpu
66+
67+
- name: Build wheel
68+
run: |
69+
ls
70+
docker build -f ./.github/Dockerfile.buildwheel \
71+
--build-arg PY_VERSION=${{ matrix.python-version }} \
72+
-t wheel:v1 .
73+
docker run --rm \
74+
-v $(pwd):/outpwd \
75+
wheel:v1 \
76+
bash -c "cp -r /workspace/vllm-ascend/dist /outpwd"
77+
ls dist
78+
79+
- name: Archive wheel
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: vllm-ascend-${{ matrix.os }}-py${{ matrix.python-version }}-wheel
83+
path: dist/*
84+
85+
- name: Set up Python ${{ matrix.python-version }}
86+
if: startsWith(github.ref, 'refs/tags/')
87+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
88+
with:
89+
python-version: ${{ matrix.python-version }}
90+
91+
- name: Release
92+
if: startsWith(github.ref, 'refs/tags/')
93+
run: |
94+
python3 -m pip install twine
95+
python3 -m twine upload --verbose dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}

tools/actionlint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# This file is a part of the vllm-ascend project.
1919
# Adapted from https://github.com/vllm-project/vllm/tree/main/tools
2020
#
21-
export SHELLCHECK_OPTS="--exclude=SC2046,SC2006"
21+
export SHELLCHECK_OPTS="--exclude=SC2046,SC2006,SC2086"
2222

2323
if command -v actionlint &> /dev/null; then
2424
actionlint .github/workflows/*.yml .github/workflows/*.yaml

0 commit comments

Comments
 (0)