Skip to content

Commit

Permalink
Switch build wheels to use native mode and separate runners (#48)
Browse files Browse the repository at this point in the history
* Switch build wheels to use native mode and separate runners

* Switch to Ubuntu latest for x_86 wheel

* Ensure artifacts from both runners are named differently
  • Loading branch information
StephenOman authored Feb 12, 2025
1 parent 047a0b8 commit 137abc5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
36 changes: 22 additions & 14 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,23 +115,21 @@ jobs:
build_wheels:
name: Build wheels on Ubuntu
needs: test_repo
runs-on: ubuntu-20.04 # Can be also run for macOS
runs-on: ${{ matrix.os }} # Can be also run for macOS
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU # Required for building manylinux aarch64 wheels on x86_64
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Build wheels
if: github.event_name != 'release'
uses: pypa/[email protected] # The main configuration is in pyproject.toml
env:
# Build of cp312-manylinux_aarch64 wheels failing, so restrict
# to only building _x86_64 wheel
CIBW_BUILD: "cp312-manylinux_x86_64" # Build only python 3.12 wheels for testing
CIBW_BUILD: "cp312-manylinux_*" # Build only python 3.12 wheels for testing
# Increase verbosity to see what's going on in the build in case of failure
CIBW_BUILD_VERBOSITY: 3
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
Expand All @@ -145,12 +143,12 @@ jobs:
- name: Save wheels
uses: actions/upload-artifact@v4
with:
name: python-wheels
name: python-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
test_manylinux_3_12:
name: Test manylinux wheel on Ubuntu w/ Py3.12
needs: build_wheels
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Setup Python 3.12 env
uses: actions/setup-python@v5
Expand All @@ -164,7 +162,7 @@ jobs:
- name: Get wheels artifacts
uses: actions/download-artifact@v4
with:
name: python-wheels
name: python-wheels-ubuntu-latest
path: dist
- name: Install from wheel # Install wheel mathcing the Python version and architecture
run: |
Expand Down Expand Up @@ -201,10 +199,15 @@ jobs:
with:
name: python-sdist
path: dist
- name: Get wheels artifacts # Get wheels artifacts from the build_wheels job
- name: Get wheels artifacts # Get x86 wheels artifacts from the build_wheels job
uses: actions/download-artifact@v4
with:
name: python-wheels-ubuntu-latest
path: dist
- name: Get wheels artifacts # Get aarch64 wheels artifacts from the build_wheels job
uses: actions/download-artifact@v4
with:
name: python-wheels
name: python-wheels-ubuntu-24.04-arm
path: dist
- name: Report dist contents
run: |
Expand Down Expand Up @@ -242,10 +245,15 @@ jobs:
with:
name: python-sdist
path: dist
- name: Get wheels artifacts # Get wheels artifacts from the build_wheels job
- name: Get wheels artifacts # Get x86 wheels artifacts from the build_wheels job
uses: actions/download-artifact@v4
with:
name: python-wheels-ubuntu-latest
path: dist
- name: Get wheels artifacts # Get aarch64 wheels artifacts from the build_wheels job
uses: actions/download-artifact@v4
with:
name: python-wheels
name: python-wheels-ubuntu-24.04-arm
path: dist
- name: Report dist contents
run: |
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ build = "cp{38,39,310,311,312}-manylinux*"
# and install the dependencies using yum, as manylinux2014 image is CentOS 7-based
before-all = "rm -rf {project}/build {project}/*.so {project}/CMakeCache.txt && yum install -y autoconf bison cmake flex git libtool"

# Only x86_64 and aarch64 (ARM) architectures are supported
archs = "x86_64 aarch64"
# Build for the architecure of the runner in the GitHub Actions workflow:
# ubuntu-20.04 -> x86_64
# ubuntu-24.04-arm -> aarch64
archs = "native"

# Use manylinux2014 image for both x86_64 and aarch64
manylinux-x86_64-image = "manylinux2014"
Expand Down

0 comments on commit 137abc5

Please sign in to comment.