Skip to content

move to Cibuildwheel workflow #93

move to Cibuildwheel workflow

move to Cibuildwheel workflow #93

name: Python cibuildwheel
on:
push:
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build_wheels:
name: Build wheels for ${{ matrix.os }} on ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
# separate archs, so they use individual caches
arch: [ 'x86_64', 'arm64' ]
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/ccache-action@v1.2.11
with:
key: ${{ matrix.os }}-${{ matrix.arch }}-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: Build python wheels for ${{ matrix.os }} on ${{ matrix.arch }}
uses: pypa/cibuildwheel@v2.16.2
env:
# Skip CPython 3.6 and CPython 3.7
CIBW_SKIP: cp36-* cp37-*
# skip tests on pypy, currently fails for indexer tests
CIBW_TEST_SKIP: 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