Blocksparse Stagewise KKT Solver #151
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 wheels and upload to PyPI | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
jobs: | |
setup_build_targets: | |
name: Setup build targets | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v3 | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.21.3 | |
- name: Generate strategy matrix | |
id: set-matrix | |
run: python3 ci/cibuildwheel_matrix.py | |
build_wheels: | |
name: Build wheels for ${{ matrix.target.arch }} on ${{ matrix.target.os }} | |
needs: setup_build_targets | |
runs-on: ${{ matrix.target.os }} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.setup_build_targets.outputs.matrix) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Setup Ninja | |
if: runner.os == 'Windows' | |
uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.21.3 | |
env: | |
CIBW_ENVIRONMENT_LINUX: ${{ (matrix.target.arch == 'x86_64' || matrix.target.arch == 'amd64') && 'CMAKE_ARGS="-DBLASFEO_X64_DIR=/opt/blasfeo_x64 -DBLASFEO_X64_AVX2_DIR=/opt/blasfeo_x64_avx2 -DBLASFEO_X64_AVX512_DIR=/opt/blasfeo_x64_avx512"' || ((matrix.target.arch == 'arm64' || matrix.target.arch == 'aarch64') && 'CMAKE_ARGS="-DBLASFEO_ARM64_DIR=/opt/blasfeo_arm64"' || '') }} | |
CIBW_ENVIRONMENT_MACOS: ${{ (matrix.target.arch == 'x86_64' || matrix.target.arch == 'amd64') && 'CMAKE_ARGS="-DBLASFEO_X64_DIR=/opt/blasfeo_x64 -DBLASFEO_X64_AVX2_DIR=/opt/blasfeo_x64_avx2 -DBLASFEO_X64_AVX512_DIR=/opt/blasfeo_x64_avx512"' || ((matrix.target.arch == 'arm64' || matrix.target.arch == 'aarch64') && 'CMAKE_ARGS="-DBLASFEO_ARM64_DIR=/opt/blasfeo_arm64"' || '') }} | |
CIBW_ENVIRONMENT_WINDOWS: CMAKE_ARGS="-DBLASFEO_X64_DIR=c:/opt/blasfeo_x64 -DBLASFEO_X64_AVX2_DIR=c:/opt/blasfeo_x64_avx2 -DBLASFEO_X64_AVX512_DIR=c:/opt/blasfeo_x64_avx512" | |
CIBW_ARCHS_LINUX: ${{ matrix.target.arch }} | |
CIBW_BEFORE_ALL_LINUX: bash ci/cibw_before_all_linux.sh | |
CIBW_BEFORE_ALL_WINDOWS: bash ci/cibw_before_all_windows.sh | |
CIBW_BEFORE_ALL_MACOS: bash ci/cibw_before_all_macos_${{ runner.arch == 'ARM64' && 'arm64' || 'x86_64' }}.sh | |
CIBW_BUILD: ${{ matrix.target.build }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Build sdist | |
run: pipx run build --sdist | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
upload_pypi: | |
name: Upload to PyPI | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/piqp | |
permissions: | |
id-token: write | |
if: github.event_name == 'release' && github.event.action == 'published' | |
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) | |
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
# repository-url: https://test.pypi.org/legacy/ |