Fix builds for Windows & macOS

This commit is contained in:
Justin Traglia 2024-03-04 10:01:25 -06:00
parent 1f2a749f39
commit 5c92e043c9
1 changed files with 25 additions and 7 deletions

View File

@ -14,22 +14,31 @@ jobs:
os: os:
- ubuntu-latest - ubuntu-latest
- windows-latest - windows-latest
- macos-13 - macos-13 # x86_64
- macos-14 - macos-14 # aarch64
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
# On Linux, use QEMU to build multiple platforms.
- name: Setup QEMU - name: Setup QEMU
if: runner.os == 'Linux' if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
with: with:
platforms: all platforms: all
# Need this for macos-14, which doesn't come with python for some reason.
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with:
python-version: '3.10'
# Need this to get cl.exe on the path.
- name: Set up Visual Studio shell
if: runner.os == 'Windows'
uses: egor-tensin/vs-shell@v2
- name: Install cibuildwheel - name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.5 run: python -m pip install cibuildwheel==2.16.5
@ -37,18 +46,27 @@ jobs:
- name: Build wheels - name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse bindings/python run: python -m cibuildwheel --output-dir wheelhouse bindings/python
env: env:
# We have QEMU setup and can build everything.
CIBW_ARCHS_LINUX: x86_64 i686 aarch64 CIBW_ARCHS_LINUX: x86_64 i686 aarch64
# musllinux uses apk & manylinux uses yum # For some reason these don't use the same distro.
# musllinux uses apk & manylinux uses yum.
CIBW_BEFORE_BUILD_LINUX: | CIBW_BEFORE_BUILD_LINUX: |
if command -v apk > /dev/null; then if command -v apk > /dev/null; then
apk add --update clang && make -C src c_kzg_4844.o apk add --update clang && make -C src blst
elif command -v yum > /dev/null; then elif command -v yum > /dev/null; then
yum install -y clang && make -C src c_kzg_4844.o yum install -y clang && make -C src blst
fi fi
# Building x86 (32-bit) package is difficult.
# We're missing the 32-bit Python library.
CIBW_ARCHS_WINDOWS: AMD64
# We need blst.lib (via MSVC) which our Makefile doesn't support.
CIBW_BEFORE_BUILD_WINDOWS: | CIBW_BEFORE_BUILD_WINDOWS: |
make -C src c_kzg_4844.o cd blst && build.bat && cp blst.lib ../lib && cp bindings/*.h ../inc
CIBW_BEFORE_BUILD_MACOS: | CIBW_BEFORE_BUILD_MACOS: |
make -C src c_kzg_4844.o make -C src blst
- name: Publish to PyPI - name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1