-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build ARM Linux and macOS wheels natively on Cirrus CI
Add .cirrus.yml workflow that runs natively on ARM macOS/Linux. For Linux, this is faster than building via emulation. For macOS, this is more correct, as cross-compiling was producing unusable wheels! It turns out we are building libhts.a incorrectly when cross-compiling: see #1231. Remove ARM builds from the x86_64 release.yaml GH Actions workflow. Also remove i686 builds: it's unclear whether these were being built correctly either, and probably very few people use them. Update to the very recently released current cibuildwheel, which updates to the also very recently released Python 3.12.0 (final).
- Loading branch information
Showing
2 changed files
with
79 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
build_wheels_task: | ||
only_if: $CIRRUS_BRANCH =~ "release/.*" || $CIRRUS_TAG =~ "v0\..*" | ||
|
||
matrix: | ||
- compute_engine_instance: | ||
image_project: cirrus-images | ||
image: family/docker-builder-arm64 | ||
architecture: arm64 | ||
platform: linux | ||
matrix: | ||
- name: Build ARM Linux py3.6-9 wheels | ||
env: | ||
CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-*" | ||
- name: Build ARM Linux py3.10-12 wheels | ||
env: | ||
CIBW_BUILD: "cp310-* cp311-* cp312-*" | ||
|
||
- name: Build ARM macOS wheels | ||
macos_instance: | ||
image: ghcr.io/cirruslabs/macos-ventura-base:latest | ||
env: | ||
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" | ||
|
||
alias: build_wheels | ||
|
||
env: | ||
CIRRUS_CLONE_DEPTH: 1 | ||
|
||
CIBW_SKIP: "*-musllinux_*" | ||
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28 | ||
|
||
install_script: | | ||
python3 -m pip install cibuildwheel==2.16.2 | ||
build_script: | | ||
cibuildwheel | ||
wheels_artifacts: | ||
path: wheelhouse/*.whl | ||
|
||
upload_pypi_task: | ||
only_if: $CIRRUS_BRANCH =~ "release/.*" || $CIRRUS_TAG =~ "v0\..*" | ||
depends_on: build_wheels | ||
|
||
name: Publish ARM wheels | ||
|
||
container: | ||
image: python:latest | ||
|
||
env: | ||
CIRRUS_CLONE_DEPTH: 1 | ||
API_BASEURL: https://api.cirrus-ci.com/v1 | ||
TWINE_USERNAME: __token__ | ||
|
||
install_script: | | ||
python3 -m pip install twine | ||
get_artifacts_script: | | ||
curl -sSLO $API_BASEURL/artifact/build/$CIRRUS_BUILD_ID/wheels.zip | ||
unzip -q wheels.zip | ||
upload_script: | | ||
case "$CIRRUS_TAG" in | ||
v0.*) | ||
export TWINE_REPOSITORY=pypi TWINE_PASSWORD=$PYPI_TOKEN ;; | ||
*) | ||
export TWINE_REPOSITORY=testpypi TWINE_PASSWORD=$TESTPYPI_TOKEN ;; | ||
esac | ||
echo Uploading wheels to $TWINE_REPOSITORY... | ||
python3 -m twine check wheelhouse/*.whl | ||
python3 -m twine upload --disable-progress-bar wheelhouse/*.whl |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,11 @@ jobs: | |
runs-on: ${{ matrix.os }}-latest | ||
strategy: | ||
matrix: | ||
os: [ubuntu] | ||
build: ["cp36-* cp37-*", "cp38-* cp39-*", "cp310-* cp311-*", "cp312-*"] | ||
os: [ubuntu, macos] | ||
build: ["cp36-* cp37-* cp38-* cp39-*", "cp310-* cp311-* cp312-*"] | ||
x64image: [manylinux_2_28] | ||
|
||
include: | ||
- os: macos | ||
build: "cp36-* cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*" | ||
|
||
- os: ubuntu | ||
build: "cp38-manylinux_x86_64" | ||
x64image: manylinux2014 | ||
|
@@ -31,31 +28,23 @@ jobs: | |
- name: Checkout pysam | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
if: runner.os == 'Linux' | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: arm64 | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected].1 | ||
uses: pypa/[email protected].2 | ||
env: | ||
CIBW_BUILD: ${{ matrix.build }} | ||
CIBW_SKIP: "*musllinux*" | ||
|
||
CIBW_ARCHS_LINUX: auto aarch64 | ||
CIBW_ARCHS_MACOS: x86_64 arm64 | ||
CIBW_ARCHS_LINUX: x86_64 | ||
CIBW_ARCHS_MACOS: x86_64 | ||
|
||
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.x64image }} | ||
CIBW_MANYLINUX_I686_IMAGE: manylinux2014 | ||
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28 | ||
|
||
CIBW_TEST_SKIP: "*-*linux_i686 *-*linux_aarch64 *-macosx_arm64" | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
path: wheelhouse/*.whl | ||
|
||
build_sdist: | ||
runs-on: ${{ matrix.os }}-latest | ||
|