[pre-commit.ci] pre-commit autoupdate #245
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 and upload to PyPI | |
on: [push] | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.cibw.build }} | |
runs-on: ${{ matrix.os }} | |
env: | |
CIBW_BUILD: "${{ matrix.cibw.build || '*' }}" | |
CIBW_ARCHS_LINUX: "${{ matrix.cibw.arch || 'auto' }}" | |
CIBW_ARCHS_MACOS: "${{ matrix.cibw.arch || 'auto' }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: macos-11 | |
name: mac-cpython | |
cibw: | |
arch: x86_64 | |
build: "*-macosx_x86_64" | |
- os: macos-11 | |
name: mac-cpython-arm | |
cibw: | |
arch: arm64 | |
build: "*-macosx_arm64" | |
- os: ubuntu-20.04 | |
name: manylinux-x86_64 | |
cibw: | |
arch: x86_64 | |
build: "*-manylinux_x86_64" | |
# - os: ubuntu-20.04 | |
# name: manylinux-arch64 | |
# cibw: | |
# arch: aarch64 | |
# build: "*-manylinux_aarch64" | |
steps: | |
- uses: actions/checkout@v3 | |
# Used to host cibuildwheel | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: customize mac-arm-64 | |
if: contains(matrix.os, 'macos') && matrix.cibw.arch == 'arm64' | |
run: | | |
echo 'MACOSX_DEPLOYMENT_TARGET=10.15' >> "$GITHUB_ENV" | |
echo 'OPENMP=0' >> "$GITHUB_ENV" | |
- name: Install cibuildwheel | |
run: | | |
python -m pip install cibuildwheel==2.12.0 | |
- name: list target wheels | |
run: | | |
python -m cibuildwheel . --print-build-identifiers | |
- name: Build wheels | |
run: python -m cibuildwheel --output-dir wheelhouse | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install build | |
run: | | |
python -m pip install build | |
- name: Build sdist | |
run: python -m build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
# upload to PyPI on every tag starting with 'v' | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
# alternatively, to publish when a GitHub Release is created, use the following rule: | |
# if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |