* Use cibuildwheel in ci `cibuildwheel` is a system that automatically compiles and repairs wheels for many python versions and architectures at once. This has some advantages vs the old situation: - Macosx wheels had inconsistent minimum versions ranging between 10.9 and 11.0. I'm not sure why this happens, but for some users this means they have to build from source on macosx. With cibuildwheel, the build is consistent, with 10.9 as the minimum for x86 and 11.0 for arm64. - Consolidation between the packaging tests and manylinux tests. - Addition of musllinux targets and additional cross-compilation to ppc64le and s390x. - With cibuildwheel, new python versions should be automatically picked up. - Separation of the sdist build and lint checks. There is not reason to run that many times. All possible build targets succeed, except for ARM64 on Windows. The upstream capnp build fails. I've disabled it. The cross-compilation builds on linux are pretty slow. This could potentially be sped up by separating the builds of manylinux and musllinux, but I'm not sure if it's worth the extra complexity. (One can also contemplate disabling these targets.) Tests for macosx arm64 cannot be run (but also couldn't be run in the previous system. This should be remedied once apple silicon becomes available on the CI. I've also added some commented-out code that can automatically take care of uploading a build to PyPi when a release is created. One might contemplate using this. * Set CMAKE_OSX_ARCHITECTURES for arm64 and disable universal2
117 lines
3.4 KiB
YAML
117 lines
3.4 KiB
YAML
name: Build
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
build_wheels:
|
|
name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
max-parallel: 99
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
arch: x86_64
|
|
- os: ubuntu-latest
|
|
arch: i686
|
|
- os: ubuntu-latest
|
|
arch: aarch64
|
|
- os: ubuntu-latest
|
|
arch: ppc64le
|
|
- os: ubuntu-latest
|
|
arch: s390x
|
|
|
|
- os: macOS-latest
|
|
arch: x86_64
|
|
- os: macOS-latest
|
|
arch: arm64
|
|
# Disabled until someone figures out how to build capnproto for arm64 and x86_64 simultaneously
|
|
# - os: macOS-latest
|
|
# arch: universal2
|
|
|
|
- os: windows-2019
|
|
arch: AMD64
|
|
- os: windows-2019
|
|
arch: x86
|
|
# Does not build currently
|
|
# - os: windows-2019
|
|
# arch: ARM64
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up QEMU
|
|
if: runner.os == 'Linux'
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
# Used to host cibuildwheel
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install cibuildwheel
|
|
run: python -m pip install cibuildwheel==2.12.0
|
|
|
|
- name: Build wheels
|
|
run: python -m cibuildwheel --output-dir wheelhouse
|
|
env:
|
|
CIBW_ARCHS: ${{ matrix.arch }}
|
|
# TODO: Disable building PyPy wheels. If the build system gets modernized, this should be
|
|
# auto-detected based on the Cython dependency.
|
|
CIBW_SKIP: pp*
|
|
CIBW_TEST_REQUIRES: pytest
|
|
CIBW_TEST_COMMAND: pytest {project}
|
|
# Only needed to make the macosx arm64 build work
|
|
CMAKE_OSX_ARCHITECTURES: "${{ matrix.arch == 'arm64' && 'arm64' || '' }}"
|
|
|
|
- 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: Build sdist
|
|
run: pipx run build --sdist
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
path: dist/*.tar.gz
|
|
|
|
lint:
|
|
name: Lint with flake8 and check black
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Lint with flake8 and check black
|
|
run: |
|
|
pip install black flake8
|
|
flake8 . --filename '*.py,*.pyx,*.pxd' --count --show-source --statistics --exclude benchmark,build,capnp/templates/module.pyx
|
|
flake8 . --count --show-source --statistics --exclude benchmark,build
|
|
black . --check --diff --color
|
|
|
|
# upload_pypi:
|
|
# needs: [build_wheels, build_sdist]
|
|
# runs-on: ubuntu-latest
|
|
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
|
# steps:
|
|
# - 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@v1.5.0
|
|
# with:
|
|
# user: __token__
|
|
# password: ${{ secrets.PYPI_PASSWORD_RELEASE }}
|
|
|
|
# # password: ${{ secrets.PYPI_PASSWORD }}
|
|
# # repository_url: https://test.pypi.org/legacy/
|