Skip to content

Build wheels and deploy #18

Build wheels and deploy

Build wheels and deploy #18

Workflow file for this run

# 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/set-swap-space@v1.0
with:
swap-size-gb: 10
- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_BUILD: ${{ matrix.python-version }}-manylinux_x86_64
CIBW_MANYLINUX_X86_64_IMAGE: sameli/manylinux2014_x86_64_cuda_${{ matrix.cuda-version }}
CIBW_BUILD_VERBOSITY: 1
- 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