Add release workflow for sgl-deep-gemm wheels (#24348)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Baizhou Zhang
2026-05-04 00:58:44 -07:00
committed by GitHub
co-authored by Claude Opus 4.7
parent 52b4609789
commit de08c804c5
5 changed files with 408 additions and 0 deletions
+196
View File
@@ -0,0 +1,196 @@
name: Release sgl-deep-gemm
on:
workflow_dispatch:
inputs:
version:
description: "Wheel version (e.g. 0.1.0, 0.1.1rc0)"
type: string
required: true
target:
type: choice
description: "Build target (default: all)"
required: false
default: 'all'
options:
- 'all'
- 'cu129'
- 'cu130'
branch:
description: "DeepGEMM branch to build from (default: release-0426)"
type: string
required: false
default: 'release-0426'
concurrency:
group: release-sgl-deepgemm-${{ github.ref }}
cancel-in-progress: true
jobs:
build-cu129-matrix:
if: |
github.repository == 'sgl-project/sglang' &&
(github.event.inputs.target == 'all' || github.event.inputs.target == 'cu129')
strategy:
matrix:
python-version: ["3.10"]
cuda-version: ["12.9"]
arch: [x86_64, aarch64]
include:
- arch: x86_64
runner: x64-kernel-build-node
- arch: aarch64
runner: arm-kernel-build-node
runs-on: ${{ matrix.runner }}
steps:
- name: Clean workspace (remove root-owned files from prior runs)
run: |
docker run --rm -v "${{ github.workspace }}:/workspace" alpine:3 \
sh -c 'rm -rf /workspace/..?* /workspace/.[!.]* /workspace/*' || true
- uses: actions/checkout@v4
- name: Checkout DeepGEMM
uses: actions/checkout@v4
with:
repository: sgl-project/DeepGEMM
ref: ${{ inputs.branch }}
path: DeepGEMM
submodules: recursive
- name: Set wheel version
run: |
echo -n "${{ inputs.version }}" > DeepGEMM/sgl_deep_gemm/VERSION
cat DeepGEMM/sgl_deep_gemm/VERSION
- name: Build wheel
run: |
chmod +x ./scripts/build_sgl_deep_gemm.sh
./scripts/build_sgl_deep_gemm.sh "${{ matrix.python-version }}" "${{ matrix.cuda-version }}" "${{ github.workspace }}/DeepGEMM" "${{ matrix.arch }}"
- name: Rename wheel
run: |
chmod +x ./scripts/rename_sgl_deep_gemm_whl.sh
./scripts/rename_sgl_deep_gemm_whl.sh DeepGEMM/dist cu129 ${{ matrix.arch }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: deepgemm-wheel-cuda${{ matrix.cuda-version }}-${{ matrix.arch }}
path: DeepGEMM/dist/*.whl
release-cu129:
needs: build-cu129-matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true
pattern: deepgemm-wheel-cuda12.9-*
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ inputs.version }}
repository: sgl-project/whl
token: ${{ secrets.GH_PAT_FOR_WHL_RELEASE }}
files: |
dist/*
- name: Clone wheel index
run: git clone https://oauth2:${WHL_TOKEN}@github.com/sgl-project/whl.git sgl-whl
env:
WHL_TOKEN: ${{ secrets.GH_PAT_FOR_WHL_RELEASE }}
- name: Update wheel index
run: python3 scripts/update_deepgemm_whl_index.py --cuda 129
- name: Push wheel index
run: |
cd sgl-whl
git config --local user.name "sglang-bot"
git config --local user.email "sglangbot@gmail.com"
git add -A
git commit -m "update sgl-deep-gemm whl index for v${{ inputs.version }}"
git push
build-cu130-matrix:
if: |
github.repository == 'sgl-project/sglang' &&
(github.event.inputs.target == 'all' || github.event.inputs.target == 'cu130')
strategy:
matrix:
python-version: ["3.10"]
cuda-version: ["13.0"]
arch: [x86_64, aarch64]
include:
- arch: x86_64
runner: x64-kernel-build-node
- arch: aarch64
runner: arm-kernel-build-node
runs-on: ${{ matrix.runner }}
steps:
- name: Clean workspace (remove root-owned files from prior runs)
run: |
docker run --rm -v "${{ github.workspace }}:/workspace" alpine:3 \
sh -c 'rm -rf /workspace/..?* /workspace/.[!.]* /workspace/*' || true
- uses: actions/checkout@v4
- name: Checkout DeepGEMM
uses: actions/checkout@v4
with:
repository: sgl-project/DeepGEMM
ref: ${{ inputs.branch }}
path: DeepGEMM
submodules: recursive
- name: Set wheel version
run: |
echo -n "${{ inputs.version }}" > DeepGEMM/sgl_deep_gemm/VERSION
cat DeepGEMM/sgl_deep_gemm/VERSION
- name: Build wheel
run: |
chmod +x ./scripts/build_sgl_deep_gemm.sh
./scripts/build_sgl_deep_gemm.sh "${{ matrix.python-version }}" "${{ matrix.cuda-version }}" "${{ github.workspace }}/DeepGEMM" "${{ matrix.arch }}"
- name: Rename wheel
run: |
chmod +x ./scripts/rename_sgl_deep_gemm_whl.sh
./scripts/rename_sgl_deep_gemm_whl.sh DeepGEMM/dist cu130 ${{ matrix.arch }}
- name: Strip +cu130 local version for PyPI upload
working-directory: DeepGEMM
run: |
set -eux
pip install wheel
mkdir -p dist-pypi
for w in dist/*.whl; do
tmp=$(mktemp -d)
python3 -m wheel unpack "$w" --dest "$tmp"
unpacked=$(find "$tmp" -mindepth 1 -maxdepth 1 -type d | head -1)
info=$(find "$unpacked" -maxdepth 1 -type d -name "*.dist-info" | head -1)
meta="$info/METADATA"
orig=$(grep '^Version:' "$meta" | head -1 | sed 's/^Version:[[:space:]]*//')
new=$(echo "$orig" | sed 's/+cu[0-9]\+$//')
if [ "$orig" != "$new" ]; then
sed -i "s/^Version:.*/Version: ${new}/" "$meta"
old_base=$(basename "$info")
new_base="${old_base/${orig}/${new}}"
mv "$info" "$(dirname "$info")/${new_base}"
fi
python3 -m wheel pack "$unpacked" --dest-dir dist-pypi
rm -rf "$tmp"
done
ls -lh dist-pypi/
- name: Upload to PyPI
working-directory: DeepGEMM
run: |
pip install twine
python3 -m twine upload --skip-existing dist-pypi/* -u __token__ -p ${{ secrets.SGL_DEEP_GEMM_PYPI_TOKEN }}