From c50d72c03c024d129f5e8d74ee24e24759a98df3 Mon Sep 17 00:00:00 2001 From: Jakub Kuczys <6032823+jack1142@users.noreply.github.com> Date: Wed, 17 Aug 2022 15:56:57 +0200 Subject: [PATCH] Show how to build for Intel macOS on Cirrus CI --- README.md | 3 ++- docs/faq.md | 8 ++++++++ examples/cirrus-ci-intel-mac.yml | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 examples/cirrus-ci-intel-mac.yml diff --git a/README.md b/README.md index 184c3ea7..af5dbf5f 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,11 @@ Usage | AppVeyor | ✅ | ✅ | ✅ | | ✅² | | CircleCI | ✅ | ✅ | | | ✅² | | Gitlab CI | ✅ | | | | ✅² | -| Cirrus CI | ✅ | | ✅ | ✅ | ✅ | +| Cirrus CI | ✅ | ✅³ | ✅ | ✅ | ✅ | ¹ [Requires emulation](https://cibuildwheel.readthedocs.io/en/stable/faq/#emulation), distributed separately. Other services may also support Linux ARM through emulation or third-party build hosts, but these are not tested in our CI.
² [Uses cross-compilation](https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2). It is not possible to test `arm64` and the `arm64` part of a `universal2` wheel on this CI platform.
+³ [Uses cross-compilation](https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2). Thanks to Rosetta 2 emulation, it is possible to test `x86_64` and both parts of a `universal2` wheel on this CI platform.
diff --git a/docs/faq.md b/docs/faq.md index 85314cd3..555e296c 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -81,6 +81,14 @@ Here's an example GitHub Actions workflow with a job that builds for Apple Silic {% include "../examples/github-apple-silicon.yml" %} ``` +Here's an example Cirrus CI workflow with a job that builds for macOS Intel through Rosetta 2 emulation and for Apple Silicon natively: + +> .cirrus.yml + +```yml +{% include "../examples/cirrus-ci-intel-mac.yml" %} +``` + ### Building non-native architectures using emulation {: #emulation} cibuildwheel supports building non-native architectures on Linux, via diff --git a/examples/cirrus-ci-intel-mac.yml b/examples/cirrus-ci-intel-mac.yml new file mode 100644 index 00000000..9c369869 --- /dev/null +++ b/examples/cirrus-ci-intel-mac.yml @@ -0,0 +1,21 @@ +build_and_store_wheels: &BUILD_AND_STORE_WHEELS + install_cibuildwheel_script: + - python -m pip install cibuildwheel==2.9.0 + run_cibuildwheel_script: + - cibuildwheel + wheels_artifacts: + path: "wheelhouse/*" + + +macos_task: + name: Build macOS x86_64 and arm64 wheels. + macos_instance: + image: ghcr.io/cirruslabs/macos-monterey-xcode + + env: + PATH: /opt/homebrew/opt/python@3.10/bin:$PATH + CIBW_ARCHS_MACOS: x86_64 arm64 + install_pre_requirements_script: + - brew install python@3.10 + - ln -s python3 /opt/homebrew/opt/python@3.10/bin/python + <<: *BUILD_AND_STORE_WHEELS