Build wheel #11
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
name: Build wheel for Release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to build and push' | |
required: true | |
type: string | |
env: | |
# Tells where to store caches. | |
CI_CACHE_DIR: ${{ github.workspace }}/../../ci_cache | |
jobs: | |
build_wheel: | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.8", "3.9", "3.10", "3.11"] | |
cuda: ["11.8", "12.1"] | |
torch: ["2.1", "2.2", "2.3"] | |
runs-on: [self-hosted, linux, release] | |
env: | |
PYTHON_VERSION: ${{ matrix.python }} | |
CUDA_VERSION: ${{ matrix.cuda }} | |
TORCH_VERSION: ${{ matrix.torch }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Create cache directory | |
run: | | |
mkdir -p $CI_CACHE_DIR/.vcpkg/bincache | |
mkdir -p $CI_CACHE_DIR/.ccache | |
- name: Build wheel | |
run: | | |
docker pull vectorchai/scalellm_manylinux:cuda${CUDA_VERSION} | |
docker run --rm -t \ | |
-v "$CI_CACHE_DIR":/ci_cache \ | |
-v "$GITHUB_WORKSPACE":/ScaleLLM \ | |
-e PYTHON_VERSION=${PYTHON_VERSION} \ | |
-e CUDA_VERSION=${CUDA_VERSION} \ | |
-e TORCH_VERSION=${TORCH_VERSION} \ | |
-e SCALELLM_VERSION_SUFFIX="+cu${CUDA_VERSION//./}torch${TORCH_VERSION}" \ | |
-e VCPKG_DEFAULT_BINARY_CACHE=/ci_cache/.vcpkg/bincache \ | |
-e CCACHE_DIR=/ci_cache/.ccache \ | |
-u $(id -u):$(id -g) \ | |
vectorchai/scalellm_manylinux:cuda${CUDA_VERSION} \ | |
bash /ScaleLLM/scripts/build_wheel.sh | |
timeout-minutes: 60 | |
- name: show wheel size | |
run: du -h dist/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheel-cuda${{ matrix.cuda }}-torch${{ matrix.torch }}-python${{ matrix.python }} | |
path: dist/* | |
create_release: | |
needs: build_wheel | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Download wheel | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
merge-multiple: true | |
pattern: wheel-* | |
- name: Show wheels | |
run: ls -lha dist | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: dist/scalellm-*.whl | |
tag_name: ${{ inputs.tag }} | |
draft: true | |
prerelease: true | |
commit_whl_index: | |
needs: build_wheel | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download wheel | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
merge-multiple: true | |
pattern: wheel-* | |
- name: Show wheels | |
run: ls -lha dist | |
- name: Clone whl repo | |
run: | | |
git clone https://oauth2:${WHL_TOKEN}@github.com/vectorch-ai/whl.git | |
env: | |
WHL_TOKEN: ${{ secrets.WHL_TOKEN }} | |
- name: Append new whls into whl index | |
run: | | |
cd whl | |
python ./publish_whl.py --whl_path=../dist | |
- name: Commit whl index change | |
run: | | |
cd whl | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add -A | |
git commit -m "Update whl index for version ${{ inputs.tag }}" | |
git push | |