Skip to content

add workflow to build and release wheel #1

add workflow to build and release wheel

add workflow to build and release wheel #1

Workflow file for this run

#
# 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:
pull_request:
branches:
- 'main'
- '*-dev'
paths:
- '.github/workflows/release_whl.yml'
- '.github/Dockerfile.buildwheel'
- 'vllm_ascend/**'
push:
branches:
- 'main'
- '*-dev'
tags:
- 'v*'
paths:
- '.github/workflows/release_whl.yml'
- '.github/Dockerfile.buildwheel'
- 'vllm_ascend/**'
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Print
run: |
lscpu
- name: Get tag
id: get-tag
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "Triggered with PR, using base_ref"
ref_name="${{ github.base_ref }}"
else
echo "Triggered with push, using ref"
ref_name=$(basename "${{ github.ref }}")
fi
echo "Original ref: $ref_name"
result=$(echo "$ref_name" | sed -E 's/(v[0-9]+\.[0-9]+\.[0-9]+)(rc[0-9]+|-dev)/\1/')
echo "Processed tag: $result"
echo "tag=$result" >> $GITHUB_OUTPUT
- name: Build wheel
run: |
ls
docker build -f ./.github/Dockerfile.buildwheel \
--build-arg PY_VERSION=${{ matrix.python-version }} \
--build-arg TAG=${{ steps.get-tag.outputs.tag }} \
-t wheel:v1 .
docker run --rm \
-v $(pwd):/outpwd \
wheel:v1 \
bash -c "cp -r /workspace/vllm-ascend/dist /outpwd"
ls dist
- name: Archive wheel
uses: actions/upload-artifact@v4
with:
name: vllm-ascend-${{ matrix.os }}-py${{ matrix.python-version }}-wheel
path: dist/*
- name: Set up Python ${{ matrix.python-version }}
if: startsWith(github.ref, 'refs/tags/')
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.python-version }}
- name: Release
if: startsWith(github.ref, 'refs/tags/')
run: |
python3 -m pip install twine
python3 -m twine upload --verbose dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}