Bump pypa/cibuildwheel from 2.19 to 2.20 #65
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: Wheel builder and uploader | |
# Update on every push and PR to main, and upon release creation | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**' | |
- '!*' | |
- '*.py' | |
- '!tests/**' | |
- '!.github/**' | |
- '.github/workflows/wheels.yml' | |
pull_request: | |
branches: | |
- main | |
release: | |
types: [created] | |
jobs: | |
build_wheels: | |
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }} | |
runs-on: ${{ matrix.buildplat[0] }} | |
strategy: | |
# Ensure that a wheel builder finishes even if another fails | |
fail-fast: false | |
matrix: | |
# Following numpy's setup | |
buildplat: | |
- [ubuntu-latest, manylinux, x86_64] | |
- [macos-latest, macosx, x86_64] | |
- [macos-latest, macosx, arm64] | |
- [windows-2019, win, amd64] | |
python: ["cp38", "cp39", "cp310", "cp311", "cp312"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}_${{ matrix.buildplat[2] }} | |
CIBW_ARCHS_MACOS: ${{ matrix.buildplat[2] }} | |
CIBW_REPAIR_WHEEL_COMMAND_MACOS: > | |
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} && | |
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel -v --require-archs {delocate_archs} -w {dest_dir} {wheel} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}_${{ matrix.buildplat[2] }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source directory for release | |
if: github.event_name == 'release' && github.event.action == 'created' | |
runs-on: ubuntu-latest | |
steps: | |
# check-out this repository | |
- uses: actions/checkout@v4 | |
# Setup python | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Build sdist | |
run: | | |
pip install build | |
python -m build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: sdist | |
path: ./dist/*.tar.gz | |
# Deploy wheels and sdist to PyPI (upon release creation) | |
deploy_pypi: | |
name: Deploy to PyPI | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'created' | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
mkdir tmp_wheelhouse | |
mkdir wheelhouse | |
- uses: actions/download-artifact@v4 | |
with: | |
path: tmp_wheelhouse/ | |
- run: find tmp_wheelhouse/ -mindepth 2 -type f -exec mv -i '{}' wheelhouse/ ';' | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.pypi_token }} | |
packages_dir: wheelhouse/ |