Skip to content

Commit 17fc6c1

Browse files
committed
add workflow to build and release wheel
Signed-off-by: Shuqiao Li <celestialli@outlook.com>
1 parent fd515cd commit 17fc6c1

File tree

7 files changed

+298
-2
lines changed

7 files changed

+298
-2
lines changed

.github/Dockerfile.buildwheel

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
ARG TAG=main
22+
23+
# Define environments
24+
ENV DEBIAN_FRONTEND=noninteractive
25+
ENV COMPILE_CUSTOM_KERNELS=${COMPILE_CUSTOM_KERNELS}
26+
RUN apt-get update -y && \
27+
apt-get install -y python3-pip git vim wget net-tools gcc g++ cmake libnuma-dev && \
28+
rm -rf /var/cache/apt/* && \
29+
rm -rf /var/lib/apt/lists/*
30+
31+
WORKDIR /workspace
32+
33+
COPY . /workspace/vllm-ascend/
34+
35+
# Install vLLM
36+
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
37+
RUN git clone --depth 1 $VLLM_REPO --branch ${TAG} /workspace/vllm
38+
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
39+
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -v -e /workspace/vllm/ --extra-index https://download.pytorch.org/whl/cpu/ && \
40+
python3 -m pip uninstall -y triton && \
41+
python3 -m pip cache purge
42+
43+
# Install req
44+
RUN python3 -m pip install -r vllm-ascend/requirements.txt --extra-index https://download.pytorch.org/whl/cpu/ && \
45+
python3 -m pip install twine
46+
47+
# Install vllm-ascend
48+
RUN source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
49+
source /usr/local/Ascend/nnal/atb/set_env.sh && \
50+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib && \
51+
cd vllm-ascend && \
52+
python3 setup.py bdist_wheel && \
53+
ls -l dist && \
54+
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 && \
55+
ls -l dist
56+
57+
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
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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 Schedule
19+
20+
on:
21+
pull_request:
22+
branches:
23+
- 'main'
24+
paths:
25+
- '.github/workflows/build_whl_sch.yml'
26+
- '.github/Dockerfile.buildwheel'
27+
28+
schedule:
29+
# * is a special character in YAML so you have to quote this string
30+
- cron: '0 22 * * *'
31+
32+
jobs:
33+
build:
34+
name: build and archive wheel
35+
strategy:
36+
matrix:
37+
os: [ubuntu-24.04-arm]
38+
python-version: ['3.10']
39+
runs-on: ${{ matrix.os }}
40+
steps:
41+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42+
43+
- name: Print
44+
run: |
45+
lscpu
46+
47+
- name: Build wheel
48+
run: |
49+
ls
50+
docker build -f ./.github/Dockerfile.buildwheel \
51+
--build-arg PY_VERSION=${{ matrix.python-version }} \
52+
--build-arg TAG=main \
53+
-t wheel:v1 .
54+
docker run --rm \
55+
-v $(pwd):/outpwd \
56+
wheel:v1 \
57+
bash -c "cp -r /workspace/vllm-ascend/dist /outpwd"
58+
ls dist
59+
60+
- name: Archive wheel
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: vllm-ascend-${{ matrix.os }}-py${{ matrix.python-version }}
64+
path: dist/*

.github/workflows/release_code.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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: Release Code
19+
20+
on:
21+
pull_request:
22+
branches:
23+
- 'main'
24+
- '*-dev'
25+
paths:
26+
- '.github/workflows/release_code.yml'
27+
- 'vllm_ascend/**'
28+
push:
29+
branches:
30+
- 'main'
31+
- '*-dev'
32+
tags:
33+
- 'v*'
34+
paths:
35+
- '.github/workflows/release_code.yml'
36+
- 'vllm_ascend/**'
37+
38+
jobs:
39+
build:
40+
name: release code
41+
runs-on: ubuntu-latest
42+
strategy:
43+
matrix:
44+
python-version: ["3.10"]
45+
steps:
46+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47+
48+
- name: Print
49+
run: |
50+
lscpu
51+
52+
- name: Set up Python ${{ matrix.python-version }}
53+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
54+
with:
55+
python-version: ${{ matrix.python-version }}
56+
57+
- name: Install dependencies
58+
run: |
59+
python3 -m pip install twine setuptools_scm
60+
61+
- name: Generate tar.gz
62+
run: |
63+
python3 setup.py sdist
64+
ls dist
65+
66+
- name: Archive tar.gz
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: vllm-ascend-src
70+
path: dist/*
71+
72+
- name: Release
73+
if: startsWith(github.ref, 'refs/tags/')
74+
run: |
75+
python3 -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}

.github/workflows/release_whl.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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 and Release 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+
push:
30+
branches:
31+
- 'main'
32+
- '*-dev'
33+
tags:
34+
- 'v*'
35+
paths:
36+
- '.github/workflows/release_whl.yml'
37+
- '.github/Dockerfile.buildwheel'
38+
- 'vllm_ascend/**'
39+
40+
jobs:
41+
build:
42+
name: build and release wheel
43+
strategy:
44+
matrix:
45+
os: [ubuntu-24.04, ubuntu-24.04-arm]
46+
python-version: ['3.9', '3.10', '3.11']
47+
runs-on: ${{ matrix.os }}
48+
steps:
49+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50+
51+
- name: Print
52+
run: |
53+
lscpu
54+
55+
- name: Get tag
56+
id: get-tag
57+
run: |
58+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
59+
echo "Triggered with PR, using base_ref"
60+
ref_name="${{ github.base_ref }}"
61+
else
62+
echo "Triggered with push, using ref"
63+
ref_name=$(basename "${{ github.ref }}")
64+
fi
65+
echo "Original ref: $ref_name"
66+
result=$(echo "$ref_name" | sed -E 's/(v[0-9]+\.[0-9]+\.[0-9]+)(rc[0-9]+|-dev)/\1/')
67+
echo "Processed tag: $result"
68+
echo "tag=$result" >> $GITHUB_OUTPUT
69+
70+
- name: Build wheel
71+
run: |
72+
ls
73+
docker build -f ./.github/Dockerfile.buildwheel \
74+
--build-arg PY_VERSION=${{ matrix.python-version }} \
75+
--build-arg TAG=${{ steps.get-tag.outputs.tag }} \
76+
-t wheel:v1 .
77+
docker run --rm \
78+
-v $(pwd):/outpwd \
79+
wheel:v1 \
80+
bash -c "cp -r /workspace/vllm-ascend/dist /outpwd"
81+
ls dist
82+
83+
- name: Archive wheel
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: vllm-ascend-${{ matrix.os }}-py${{ matrix.python-version }}-wheel
87+
path: dist/*
88+
89+
- name: Set up Python ${{ matrix.python-version }}
90+
if: startsWith(github.ref, 'refs/tags/')
91+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
92+
with:
93+
python-version: ${{ matrix.python-version }}
94+
95+
- name: Release
96+
if: startsWith(github.ref, 'refs/tags/')
97+
run: |
98+
python3 -m pip install twine
99+
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)