Build wheels and deploy #15
Workflow file for this run
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
# This workflow will: | |
# - Create a new Github release | |
# - Build wheels for supported architectures | |
# - Deploy the wheels to the Github release | |
# - Release the static code to PyPi | |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
name: Build wheels and deploy | |
on: | |
create: | |
tags: | |
- v* | |
jobs: | |
setup_release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get the tag version | |
id: extract_branch | |
run: echo ::set-output name=branch::${GITHUB_REF#refs/tags/} | |
shell: bash | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.extract_branch.outputs.branch }} | |
release_name: ${{ steps.extract_branch.outputs.branch }} | |
build_wheels: | |
name: Build Wheel | |
needs: setup_release | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04] | |
python-version: ['cp39', 'cp310', 'cp311', 'cp312'] | |
cuda-version: ['11.8', '12.3'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set CUDA and PyTorch versions | |
run: | | |
echo "MATRIX_CUDA_MAJOR=$(echo ${{ matrix.cuda-version }} | awk -F \. {'print $1'})" >> $GITHUB_ENV | |
- name: Free up disk space | |
if: ${{ runner.os == 'Linux' }} | |
# https://github.com/easimon/maximize-build-space/blob/master/action.yml | |
# https://github.com/easimon/maximize-build-space/tree/test-report | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /opt/hostedtoolcache/CodeQL | |
- name: Set up swap space | |
if: runner.os == 'Linux' | |
uses: pierotofy/[email protected] | |
with: | |
swap-size-gb: 10 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: ${{ matrix.python-version }}-manylinux_x86_64 | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014_x86_64_cuda_${{ matrix.cuda-version }} | |
- name: Log Built Wheels | |
run: | | |
ls wheelhouse | |
wheel_name=$(basename wheelhouse/*.whl) | |
echo "wheel_name=${wheel_name}" >> $GITHUB_ENV | |
- name: Get the tag version | |
id: extract_branch | |
run: echo ::set-output name=branch::${GITHUB_REF#refs/tags/} | |
- name: Get Release with tag | |
id: get_current_release | |
uses: joutvhu/get-release@v1 | |
with: | |
tag_name: ${{ steps.extract_branch.outputs.branch }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Release Asset | |
id: upload_release_asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_current_release.outputs.upload_url }} | |
asset_path: ./wheelhouse/${{env.wheel_name}} | |
asset_name: ${{env.wheel_name}} | |
asset_content_type: application/* | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{env.wheel_name}} | |
path: ./wheelhouse/${{env.wheel_name}} | |
publish_package: | |
name: Publish package | |
needs: [build_wheels] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
pip install setuptools==68.0.0 | |
pip install git+https://github.com/nshepperd/setuptools-cuda-cpp | |
pip install ninja packaging wheel pybind11 | |
- name: Build core package | |
run: | | |
CUDA_HOME=/ python setup.py sdist --dist-dir=dist | |
- name: Retrieve release distributions | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist/ | |
merge-multiple: true | |
- name: Publish release distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |