Skip to content

Commit

Permalink
github actions: attempting to consolidate building all wheels using c…
Browse files Browse the repository at this point in the history
…ibuildwheel
  • Loading branch information
StephenCzarnecki committed Oct 30, 2024
1 parent 6af717b commit 503097c
Showing 1 changed file with 27 additions and 112 deletions.
139 changes: 27 additions & 112 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,131 +2,46 @@ name: Build wheels

on: [push, pull_request]

# Cannot use cibuildwheels because the current images used by cibuildwheels do not support C++17.

jobs:
build_wheels_windows:
name: ${{ matrix.os }} ${{ matrix.python-version }} ${{ matrix.arch }} wheels
build_wheels:
runs-on: ${{ matrix.os }}
env:
TEMP: C:\Temp
TMP: C:\Temp

strategy:
fail-fast: false
matrix:
os: [windows-2022]
arch: [x86, x64]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]

steps:
- name: Support longpaths
run: git config --system core.longpaths true

- name: Check LongPathsEnabled
run: |
(Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.arch }}

- name: Install packages
run: |
pip install wheel
pip install setuptools
pip install build
- name: build
run: python -m build

- name: upload wheels
uses: actions/upload-artifact@v3
with:
path: ./dist/*.whl

build_wheels_mac:
name: ${{ matrix.os }} ${{ matrix.python-version }} wheels
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Trying to use cibuildwheels to build mac wheels fails because the version of XCode is not high enough.
# There is documentation here https://github.com/pypa/cibuildwheel/blob/main/docs/cpp_standards.md on how to
# set it but I could not get it to work while using the standard images provided by github actions does work.
os: [macos-latest, macos-13]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
env:
SYSTEM_VERSION_COMPAT: 0
os: [ubuntu-latest, macos-latest, windows-latest]
architecture: [x64, x86, arm64]

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
- name: Setup Python for Windows (Only on Windows)
if: matrix.os == 'windows-latest'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: '3.x'
architecture: ${{ matrix.architecture }}

- name: Install packages
- name: Install cibuildwheel
run: |
pip install wheel
pip install setuptools
pip install build
- name: build
run: python -m build

- name: upload wheels
uses: actions/upload-artifact@v3
with:
path: ./dist/*.whl

build_wheels_manylinux_x86_64:
name: Build manylinux wheels
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Need to use the image specified below to build manylinux wheels
# PyPi only accepts manylinux wheels, it does not accept wheels for specific versions/architectures
# Note that at least manylinux2014 is needed to get support for C++17
- name: Build manylinux Python wheels
uses: RalfG/[email protected]_x86_64
with:
python-versions: 'cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312'
build-requirements: 'setuptools'

- name: upload wheels
uses: actions/upload-artifact@v3
with:
path: ./dist/*-manylinux*.whl

build_wheels_manylinux_arm64:
name: Build manylinux wheels (arm64)
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Register QEMU for cross-architecture emulation
- name: Set up QEMU for cross-compilation
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
python -m pip install --upgrade pip
pip install cibuildwheel
- name: Build wheels with cibuildwheel
env:
CIBW_ARCHS_LINUX: ${{ matrix.architecture }}
CIBW_ARCHS_MACOS: ${{ matrix.architecture }}
CIBW_ARCHS_WINDOWS: ${{ matrix.architecture }}
CIBW_SKIP: "cp36-* cp37-*"
run: |
cibuildwheel --output-dir wheelhouse
# Build manylinux Python wheels for arm64 architecture
- name: Build manylinux Python wheels (arm64)
uses: RalfG/[email protected]_aarch64
with:
python-versions: 'cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312'
build-requirements: 'setuptools'
- name: List wheels
run: |
ls wheelhouse
- name: Upload arm64 wheels
- name: Upload wheels as artifact
uses: actions/upload-artifact@v3
with:
path: ./dist/*-manylinux*.whl
name: python-wheels
path: wheelhouse/*.whl

0 comments on commit 503097c

Please sign in to comment.