Skip to content

Build, test, and deploy to PyPI #124

Build, test, and deploy to PyPI

Build, test, and deploy to PyPI #124

name: Build, test, and deploy to PyPI
on:
push:
pull_request:
schedule:
# run weekly on a Monday
- cron: '0 0 * * 1'
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
jobs:
make_wheels:
strategy:
matrix:
include:
- config: {"name": "Linux", "os": "ubuntu-20.04", "arch": "x86_64"}
- config: {"name": "Linux", "os": "ubuntu-20.04", "arch": "aarch64"}
- config: {"name": "macOS", "os": "macos-11", "arch": "x86_64"}
- config: {"name": "Windows", "os": "windows-2022", "arch": "AMD64"}
name: Make wheels for ${{ matrix.config.os }} ${{ matrix.config.arch }}
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Build wheels
if: matrix.config.name == 'Linux'
uses: pypa/cibuildwheel@v2.12.3
env:
CIBW_ARCHS_LINUX: ${{ matrix.config.arch }}
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
CIBW_TEST_COMMAND: "bash {project}/ci/test"
CIBW_BEFORE_BUILD: "python -m pip install cffi cmake --upgrade && python build_ext.py"
CIBW_BUILD_VERBOSITY: 1
- name: Build wheels
if: matrix.config.name == 'Windows'
uses: pypa/cibuildwheel@v2.12.3
env:
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
CIBW_TEST_COMMAND: "bash {project}/ci/test"
CIBW_BEFORE_BUILD: "python -m pip install cffi cmake --upgrade && python build_ext.py"
CIBW_BUILD_VERBOSITY: 1
- name: Build wheels
if: matrix.config.name == 'macOS'
uses: pypa/cibuildwheel@v2.12.3
env:
CIBW_ARCHS_MACOS: ${{ matrix.config.arch }}
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
CIBW_TEST_COMMAND: "bash {project}/ci/test"
CIBW_BEFORE_BUILD: "python -m pip install cffi cmake --upgrade && python build_ext.py"
CIBW_BUILD_VERBOSITY: 1
SYSTEM_VERSION_COMPAT: 0
- uses: actions/upload-artifact@v3
with:
name: artifact
path: wheelhouse/*.whl
make_sdist:
name: Make sdist
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
name: artifact
path: dist/*.tar.gz
upload_all:
needs: [make_wheels, make_sdist]
runs-on: ubuntu-20.04
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.pypi_password }}