Build Wheels #2
This file contains hidden or 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: Build Wheels | |
on: [workflow_dispatch] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Build Wheels for ${{matrix.platform_id}} on ${{matrix.os}} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# manylinux x86_64 | |
- os: ubuntu-latest | |
platform_id: manylinux_x86_64 | |
# MacOS x86_64 | |
- os: macos-13 | |
platform_id: macosx_x86_64 | |
# MacOS arm64 | |
- os: macos-14 | |
platform_id: macosx_arm64 | |
# Windows x86_64 | |
- os: windows-latest | |
platform_id: win_amd64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Set up QEMU for Linux ARM builds | |
if: ${{runner.os == 'Linux' && endsWith(matrix.platform_id, '_aarch64')}} | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Set macOS Deployment Target | |
if: runner.os == 'macOS' | |
run: | | |
if [[ "${{ matrix.os }}" == "macos-13" ]]; then | |
echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV | |
elif [[ "${{ matrix.os }}" == "macos-14" ]]; then | |
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV | |
fi | |
- name: Install Boost | |
if: runner.os == 'Windows' | |
uses: MarkusJx/[email protected] | |
id: install-boost | |
with: | |
boost_version: 1.84.0 | |
platform_version: 2022 | |
toolset: mingw | |
- name: Setup MSVC Developer Command Prompt | |
if: runner.os == 'Windows' | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Build Wheels | |
uses: pypa/[email protected] | |
env: # Can specify per os - e.g. CIBW_BEFORE_ALL_LINUX, CIBW_BEFORE_ALL_MACOS, CIBW_BEFORE_ALL_WINDOWS | |
CIBW_BEFORE_ALL_LINUX: ./build_tools/before_all_linux.sh | |
CIBW_BEFORE_ALL_MACOS: ./build_tools/before_all_mac.sh | |
CIBW_BEFORE_ALL_WINDOWS: bash ./build_tools/before_all_windows.sh | |
CIBW_ENVIRONMENT_WINDOWS: Boost_INCLUDE_DIR='${{ steps.install-boost.outputs.BOOST_ROOT }}/include' Boost_LIBRARY_DIRS='${{ steps.install-boost.outputs.BOOST_ROOT }}/lib' | |
CIBW_ARCHS_LINUX: ${{endsWith(matrix.platform_id, '_x86_64') && 'x86_64' || 'aarch64'}} | |
CIBW_ARCHS_MACOS: ${{endsWith(matrix.platform_id, 'universal2') && 'universal2' || 'auto'}} | |
CIBW_ARCHS_WINDOWS: ${{endsWith(matrix.platform_id, '_amd64') && 'AMD64' || 'ARM64'}} | |
CIBW_BUILD: "*${{matrix.platform_id}}" | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: pytest {package}/tests | |
CIBW_TEST_SKIP: "*-macosx_universal2:x86_64" # skip x86 on m1 mac | |
CIBW_SKIP: pp* # Disable building PyPy wheels on all platforms | |
- name: Upload Wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.platform_id }} | |
path: ./wheelhouse/*.whl |