From 46ba98d04eb121b9a08d61c436185b00f2dfcda3 Mon Sep 17 00:00:00 2001 From: Shuqiao Li Date: Tue, 29 Apr 2025 09:51:37 +0800 Subject: [PATCH] add github action for release code and whl Signed-off-by: Shuqiao Li --- .github/Dockerfile.buildwheel | 57 ++++++++++++++++++++++++++++ .github/actionlint.yaml | 1 + .github/workflows/actionlint.yml | 2 +- .github/workflows/release_code.yaml | 46 ++++++++++++++++++++++ .github/workflows/release_wheel.yaml | 54 ++++++++++++++++++++++++++ 5 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 .github/Dockerfile.buildwheel create mode 100644 .github/workflows/release_code.yaml create mode 100644 .github/workflows/release_wheel.yaml diff --git a/.github/Dockerfile.buildwheel b/.github/Dockerfile.buildwheel new file mode 100644 index 0000000000..9831746386 --- /dev/null +++ b/.github/Dockerfile.buildwheel @@ -0,0 +1,57 @@ +# +# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# This file is a part of the vllm-ascend project. +# +ARG PY_VERSION=3.10 +FROM quay.io/ascend/cann:8.0.0-910b-ubuntu22.04-py${PY_VERSION} + +ARG COMPILE_CUSTOM_KERNELS=1 +ARG TAG +ARG PYPI_TOKEN + +# Define environments +ENV DEBIAN_FRONTEND=noninteractive +ENV COMPILE_CUSTOM_KERNELS=${COMPILE_CUSTOM_KERNELS} +RUN apt-get update -y && \ + apt-get install -y python3-pip git vim wget net-tools gcc g++ cmake libnuma-dev && \ + rm -rf /var/cache/apt/* && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /workspace + +COPY . /workspace/vllm-ascend/ + +# Install vLLM +ARG VLLM_REPO=https://github.com/vllm-project/vllm.git +RUN git clone --depth 1 $VLLM_REPO --branch ${TAG} /workspace/vllm +# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. +RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -v -e /workspace/vllm/ --extra-index https://download.pytorch.org/whl/cpu/ && \ + python3 -m pip uninstall -y triton && \ + python3 -m pip cache purge + +# Install req +RUN python3 -m pip install -r vllm-ascend/requirements.txt --extra-index https://download.pytorch.org/whl/cpu/ && \ + python3 -m pip install twine + +# Install vllm-ascend +RUN source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ + source /usr/local/Ascend/nnal/atb/set_env.sh && \ + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib && \ + cd vllm-ascend && \ + python3 setup.py bdist_wheel && \ + ls ./dist && \ + python3 -m twine upload dist/* -u __token__ -p ${PYPI_TOKEN} + +CMD ["/bin/bash"] diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml index 972abb39ae..06b9ddbc07 100644 --- a/.github/actionlint.yaml +++ b/.github/actionlint.yaml @@ -3,3 +3,4 @@ self-hosted-runner: labels: - linux-arm64-npu-1 - linux-arm64-npu-4 + - ubuntu-24.04-arm diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index daeb9d01ea..91cd9c4120 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -47,7 +47,7 @@ jobs: - name: "Run actionlint" env: - SHELLCHECK_OPTS: --exclude=SC2046,SC2006 + SHELLCHECK_OPTS: --exclude=SC2046,SC2006,SC2086 run: | echo "::add-matcher::.github/workflows/matchers/actionlint.json" tools/actionlint.sh -color diff --git a/.github/workflows/release_code.yaml b/.github/workflows/release_code.yaml new file mode 100644 index 0000000000..57f3b70166 --- /dev/null +++ b/.github/workflows/release_code.yaml @@ -0,0 +1,46 @@ +# +# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# This file is a part of the vllm-ascend project. +# + +name: Release Code + +on: + push: + # Release when push tag + tags: + - 'v*' + +jobs: + build: + name: release code + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10"] + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install twine setuptools_scm + - name: Generate tar.gz and release + run: | + python3 setup.py sdist + ls ./dist + python3 -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release_wheel.yaml b/.github/workflows/release_wheel.yaml new file mode 100644 index 0000000000..4ac2aca21f --- /dev/null +++ b/.github/workflows/release_wheel.yaml @@ -0,0 +1,54 @@ +# +# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# This file is a part of the vllm-ascend project. +# + +name: Build and Release Wheel + +on: + push: + # Release when push tag + tags: + - 'v*' + +jobs: + build: + name: build and release wheel + strategy: + matrix: + os: [ubuntu-24.04, ubuntu-24.04-arm] + python-version: ['3.9', '3.10', '3.11'] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - name: Print + run: | + lscpu + + - name: Get tag + id: get-tag + run: | + result=$(basename ${{ github.ref }}) + echo "tag=$result" >> $GITHUB_OUTPUT + + - name: Build wheels + run: | + ls + docker build -f ./.github/Dockerfile.buildwheel \ + --build-arg PY_VERSION=${{ matrix.python-version }} \ + --build-arg TAG=${{ steps.get-tag.outputs.tag }} \ + --build-arg PYPI_TOKEN=${{ secrets.PYPI_TOKEN }} \ + -t wheel:v1 .