move to Cibuildwheel workflow #99
Workflow file for this run
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: Python cibuildwheel | |
on: | |
push: | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
build_wheels: | |
name: Build wheels for ${{ matrix.os }} on ${{ matrix.arch }} (Linux target ${{ matrix.target }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macos-12] | |
# separate archs, so they use individual caches | |
arch: [ 'x86_64', 'arm64' ] | |
# separate musl and many on linux, for mac we just skip one of those | |
target: [ 'many', 'musl' ] | |
exclude: | |
- os: macos-12 | |
target: musl | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
if: ${{ (runner.os == 'Linux') && (matrix.arch == 'arm64') }} | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: ccache | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.target }}-python | |
- name: Sets env for x86_64 | |
run: | | |
echo "CIBW_ARCHS_LINUX=auto64" >> $GITHUB_ENV | |
echo "CIBW_ARCHS_MACOS=x86_64" >> $GITHUB_ENV | |
if: matrix.arch == 'x86_64' | |
- name: Sets env for arm64 | |
run: | | |
echo "CIBW_ARCHS_LINUX=aarch64" >> $GITHUB_ENV | |
echo "CIBW_ARCHS_MACOS=arm64" >> $GITHUB_ENV | |
if: matrix.arch == 'arm64' | |
- name: Skip manylinux for musllinux target | |
if: ${{ matrix.target == 'musl' }} | |
run: | | |
echo "CIBW_SKIP=*manylinux*" >> $GITHUB_ENV | |
- name: Skip musllinux for manylinux target | |
if: ${{ matrix.target == 'many' }} | |
run: | | |
echo "CIBW_SKIP=*musllinux*" >> $GITHUB_ENV | |
- name: Build python wheels for ${{ matrix.os }} on ${{ matrix.arch }} | |
uses: pypa/[email protected] | |
env: | |
# Skip CPython 3.6 and CPython 3.7 | |
CIBW_SKIP: ${{ env.CIBW_SKIP }} cp36-* cp37-* | |
# skip testing all python versions on linux arm, only test 3.12 | |
# skip tests on pypy, currently fails for indexer tests | |
CIBW_TEST_SKIP: "*p{38,39,310,311}-m*linux_aarch64 pp*" | |
# (many)linux custom docker images | |
CIBW_MANYLINUX_X86_64_IMAGE: 'keyvidev/manylinux-builder-x86_64' | |
CIBW_MANYLINUX_AARCH64_IMAGE: 'keyvidev/manylinux-builder-aarch64' | |
CIBW_MUSLLINUX_X86_64_IMAGE: 'keyvidev/musllinux-builder-x86_64' | |
CIBW_MUSLLINUX_AARCH64_IMAGE: 'keyvidev/musllinux-builder-aarch64' | |
# macos build requirements | |
CIBW_BEFORE_ALL_MACOS: > | |
brew update && | |
brew install zlib snappy boost && | |
brew install ccache | |
# ccache using path | |
CIBW_ENVIRONMENT_MACOS: PATH=/usr/local/opt/ccache/libexec:$PATH | |
CIBW_ENVIRONMENT_LINUX: PATH=/usr/local/bin:/usr/lib/ccache:$PATH CCACHE_DIR=/host${{ github.workspace }}/.ccache CCACHE_CONFIGPATH=/host/home/runner/.config/ccache/ccache.conf | |
# python dependencies | |
CIBW_BEFORE_BUILD: pip install -r python/requirements.txt | |
# testing | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: > | |
python -m pytest {package}/tests && | |
python -m pytest {package}/integration-tests | |
with: | |
package-dir: python | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl |