Release #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from https://github.com/punica-ai/punica/blob/591b59899f0a20760821785d06b331c8a2e5cb86/.github/workflows/release_wheel.yml | |
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
required: true | |
type: string | |
workflow_call: | |
inputs: | |
tag_name: | |
required: true | |
type: string | |
secrets: | |
WHL_TOKEN: | |
required: true | |
# PYPI_TEST_TOKEN: | |
# required: true | |
env: | |
TORCH_CUDA_ARCH_LIST: "8.0 8.9 9.0+PTX" | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.8", "3.9", "3.10", "3.11"] | |
cuda: ["11.8", "12.1"] | |
torch: ["2.1", "2.2"] | |
runs-on: [self-hosted] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Build wheel | |
run: | | |
chown -R $CI_UID:$CI_GID "$GITHUB_WORKSPACE" | |
version="$(cat version.txt)" | |
docker run --rm -t \ | |
-v "$CI_RUNNER_CACHE_DIR":/ci-cache \ | |
-v "$GITHUB_WORKSPACE":/app \ | |
-e FLASHINFER_CI_PYTHON_VERSION=${{ matrix.python }} \ | |
-e FLASHINFER_CI_CUDA_VERSION=${{ matrix.cuda }} \ | |
-e FLASHINFER_CI_TORCH_VERSION=${{ matrix.torch }} \ | |
-e FLASHINFER_BUILD_VERSION=$version \ | |
-e TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST" \ | |
--user $CI_UID:$CI_GID \ | |
pytorch/manylinux-builder:cuda${{ matrix.cuda }} \ | |
bash /app/scripts/run-ci-build-wheel.sh | |
timeout-minutes: 120 | |
- run: du -h python/dist/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheel-cuda${{ matrix.cuda }}-torch${{ matrix.torch }}-python${{ matrix.python }} | |
path: python/dist/* | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: python/dist/ | |
merge-multiple: true | |
pattern: wheel-* | |
- run: ls -lah python/dist/ | |
- uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ inputs.tag_name }} | |
files: | | |
python/dist/flashinfer-*.whl | |
python/dist/flashinfer-*.tar.gz | |
- name: Clone wheel index | |
run: git clone https://oauth2:${WHL_TOKEN}@github.com/flashinfer-ai/whl.git flashinfer-whl | |
env: | |
WHL_TOKEN: ${{ secrets.WHL_TOKEN }} | |
- name: Update wheel index | |
shell: python | |
run: | | |
import pathlib | |
import hashlib | |
import re | |
for path in sorted(pathlib.Path("python/dist").glob("*.whl")): | |
with open(path, "rb") as f: | |
sha256 = hashlib.sha256(f.read()).hexdigest() | |
ver, cu, torch = re.findall(r"flashinfer-([0-9.]+)\+cu(\d+)torch([0-9.]+)-", path.name)[0] | |
with open(f"flashinfer-whl/cu{cu}/torch{torch}/flashinfer/index.html", "a") as f: | |
f.write(f'<a href="https://github.com/flashinfer-ai/flashinfer/releases/download/v{ver}/{path.name}#sha256={sha256}">{path.name}</a><br>\n') | |
- name: Push wheel index | |
run: | | |
cd flashinfer-whl | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add -A | |
git commit -m "update whl" | |
git push | |
# - name: Upload sdist to pypi | |
# run: | | |
# pip install twine | |
# python -m twine upload --repository testpypi --username=__token__ dist/*.tar.gz | |
# env: | |
# TWINE_PASSWORD: ${{ secrets.PYPI_TEST_TOKEN }} |