|
| 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 }} |
0 commit comments