Skip to content

Commit 3f61eab

Browse files
rework release build (#237)
* build and release * build and release * fix build error * fix build error * fix build error * fix build error * fix build error * fix torch_npu version casuing build issue
1 parent 241cfd0 commit 3f61eab

File tree

4 files changed

+97
-65
lines changed

4 files changed

+97
-65
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build and Release SGL-Kernel-NPU
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
pull_request:
9+
branches:
10+
- 'main'
11+
paths:
12+
- '.github/workflows/build_and_release.yml'
13+
14+
jobs:
15+
16+
build-and-release:
17+
runs-on: ubuntu-24.04-arm
18+
container:
19+
image: quay.io/ascend/cann:8.3.rc1-a3-ubuntu22.04-py3.11
20+
defaults:
21+
run:
22+
shell: bash
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v6
27+
28+
- name: Mark repository safe
29+
run: |
30+
git config --system --add safe.directory ${GITHUB_WORKSPACE}
31+
32+
- name: Build packages
33+
run: |
34+
env -i PATH=${PATH} bash --login scripts/build_and_release.sh
35+
36+
- name: Upload Release Artifacts
37+
if: github.event_name != 'pull_request'
38+
uses: softprops/action-gh-release@v2
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
files: output/*.whl

.github/workflows/release.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

scripts/build_and_release.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
export DEBIAN_FRONTEND=noninteractive
5+
export PIP_INSTALL="python3 -m pip install --no-cache-dir"
6+
7+
8+
### Install required dependencies
9+
## APT packages
10+
apt update -y && \
11+
apt upgrade -y && \
12+
apt install -y \
13+
locales \
14+
ca-certificates \
15+
build-essential \
16+
cmake \
17+
ccache \
18+
pkg-config \
19+
zlib1g-dev \
20+
wget \
21+
curl
22+
23+
## Setup
24+
locale-gen en_US.UTF-8
25+
update-ca-certificates
26+
export LANG=en_US.UTF-8
27+
export LANGUAGE=en_US:en
28+
export LC_ALL=en_US.UTF-8
29+
30+
## Python packages
31+
${PIP_INSTALL} --upgrade pip
32+
# Pin wheel to 0.45.1, REF: https://github.com/pypa/wheel/issues/662
33+
${PIP_INSTALL} \
34+
wheel==0.45.1 \
35+
pybind11
36+
37+
38+
### Install PyTorch
39+
## PyTorch
40+
TORCH_VERSION="2.8.0"
41+
TORCHVISION_VERSION="0.23.0"
42+
${PIP_INSTALL} \
43+
torch==${TORCH_VERSION} \
44+
torchvision==${TORCHVISION_VERSION} \
45+
torchaudio==${TORCH_VERSION} \
46+
--index-url https://download.pytorch.org/whl/cpu
47+
48+
## PTA
49+
PTA_URL="https://gitcode.com/Ascend/pytorch/releases/download/v7.2.0-pytorch2.8.0/torch_npu-2.8.0-cp311-cp311-manylinux_2_28_aarch64.whl"
50+
${PIP_INSTALL} ${PTA_URL}
51+
52+
53+
### Build SGL-Kernel-NPU
54+
export LD_LIBRARY_PATH=${ASCEND_HOME_PATH}/runtime/lib64/stub:${LD_LIBRARY_PATH}
55+
bash build.sh

scripts/release_ci_dependency.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)