Skip to content

Commit

Permalink
Split build wheels by x86_64 and arm wheels jobs, update actions version
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie256 committed Nov 21, 2023
1 parent ea02fd1 commit 92f9b3f
Showing 1 changed file with 86 additions and 27 deletions.
113 changes: 86 additions & 27 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Build Python Wheels

on:
# allow manual runs
workflow_dispatch:
# run when we tag a release
release:
types:
- "created"
types: ["created"]

env:
BUILD_TYPE: Release
Expand All @@ -16,13 +13,13 @@ jobs:
name: Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
persist-credentials: false

- uses: actions/setup-python@v2
name: Install Python
- uses: actions/setup-python@v4
name: Install Python 3.8
with:
python-version: '3.8'

Expand All @@ -32,11 +29,11 @@ jobs:
- name: Build sdist
run: python setup.py sdist

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

build_wheels:
build_wheels_x86_64:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
Expand All @@ -55,53 +52,115 @@ jobs:
arch: x86_64,
cc: "gcc", cxx: "g++"
}
- {
name: "Ubuntu Latest, GCC, aarch64",
os: ubuntu-latest,
arch: aarch64,
cc: "gcc", cxx: "g++"
}
- {
name: "Windows Latest, MSVC",
os: windows-latest,
arch: x86_64,
cc: "cl", cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
}

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true
persist-credentials: false

- name: Set up Python 3.x
uses: actions/setup-python@v2
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Set up Qemu when building arm
if: ${{ matrix.config.arch == 'aarch64' }}
uses: docker/setup-qemu-action@v1
with:
platforms: arm64

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.7.0
run: python -m pip install cibuildwheel==2.16.2

- name: Build wheels
run: python -m cibuildwheel --output-dir dist
env:
CIBW_PRERELEASE_PYTHONS: True # enable Python 3.11
CIBW_SKIP: "*-win32"
CIBW_BUILD: "cp36-*64 cp37-*64 cp38-*64 cp39-*64 cp310-*64 cp311-*64"
CIBW_BUILD: "cp36-*64 cp37-*64 cp38-*64 cp39-*64 cp310-*64 cp311-*64 cp312-*64"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ARCHS_MACOS: "x86_64 universal2"
CIBW_ARCHS_LINUX: ${{ matrix.config.arch }}
CIBW_BEFORE_TEST: pip install pytest numpy
CIBW_TEST_COMMAND: 'python -m pytest {package}/python/tests'

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

build_wheels_manylinux:
name: "ARM Manylinux Wheels"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Set up Qemu for ARM builds
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2

- name: Build ARM wheels
run: python -m cibuildwheel --output-dir dist
env:
CIBW_PRERELEASE_PYTHONS: True
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_*"
CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*"
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
CIBW_ARCHS_LINUX: "aarch64"
CIBW_BEFORE_TEST: 'if [ "$CIBW_PYTHON_VERSION" = "cp310" ]; then pip install pytest numpy; fi'
CIBW_TEST_COMMAND: 'if [ "$CIBW_PYTHON_VERSION" = "cp310" ]; then python -m pytest {package}/python/tests; fi'

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

build_wheels_musllinux:
name: "ARM Musllinux Wheels"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Set up Qemu for ARM builds
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2

- name: Build Musllinux ARM wheels
run: python -m cibuildwheel --output-dir dist
env:
CIBW_PRERELEASE_PYTHONS: True
CIBW_SKIP: "*-win32 *-manylinux_i686 *-manylinux*"
CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*"
CIBW_ARCHS_LINUX: "aarch64"
CIBW_BEFORE_TEST: 'if [ "$CIBW_PYTHON_VERSION" = "cp310" ]; then pip install pytest numpy; fi'
CIBW_TEST_COMMAND: 'if [ "$CIBW_PYTHON_VERSION" = "cp310" ]; then python -m pytest {package}/python/tests; fi'

- uses: actions/upload-artifact@v2
with:
path: ./dist/*.whl

0 comments on commit 92f9b3f

Please sign in to comment.