-
Notifications
You must be signed in to change notification settings - Fork 60
Add support for building ARM64 iOS wheels on CI #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
277ae40
74e7a04
5fd5b26
f97f89c
138ace0
c4e3a87
716f435
585ef3d
a0cf74a
82638d4
8b23c71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,7 +112,7 @@ jobs: | |
- { spec: cp314-manylinux_aarch64, arch: aarch64 } | ||
- { spec: cp314t-manylinux_aarch64, arch: aarch64 } | ||
|
||
# aarch64 musllinux | ||
# aarch64 musllinux | ||
- { spec: cp39-musllinux_aarch64, arch: aarch64, omit: ${{ env.skip_ci_redundant_jobs }} } | ||
- { spec: cp310-musllinux_aarch64, arch: aarch64, omit: ${{ env.skip_ci_redundant_jobs }} } | ||
- { spec: cp311-musllinux_aarch64, arch: aarch64, omit: ${{ env.skip_ci_redundant_jobs }} } | ||
|
@@ -379,8 +379,111 @@ jobs: | |
if-no-files-found: error | ||
if: ${{ env.skip_artifact_upload != 'true' }} | ||
|
||
make_ios_matrix: | ||
runs-on: ubuntu-24.04 | ||
outputs: | ||
matrix_json: ${{ steps.make_matrix.outputs.matrix_json }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: make a matrix | ||
id: make_matrix | ||
uses: ./.github/actions/dynamatrix | ||
with: | ||
matrix_yaml: | | ||
include: | ||
# arm64 iOS device | ||
- { spec: cp313-ios_arm64_iphoneos, platform: 'iphoneos' } | ||
- { spec: cp314-ios_arm64_iphoneos, platform: 'iphoneos' } | ||
|
||
# arm64 iOS simulator | ||
- { spec: cp313-ios_arm64_iphonesimulator, platform: 'iphonesimulator' } | ||
- { spec: cp314-ios_arm64_iphonesimulator, platform: 'iphonesimulator' } | ||
|
||
ios: | ||
needs: [python_sdist, make_ios_matrix] | ||
runs-on: macos-14 | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(needs.make_ios_matrix.outputs.matrix_json) }} | ||
|
||
steps: | ||
- name: fetch sdist artifact | ||
id: fetch_sdist | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ needs.python_sdist.outputs.sdist_artifact_name }} | ||
|
||
- name: install python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.13' | ||
|
||
- name: build wheel prereqs | ||
run: | | ||
set -eux | ||
python3 -m pip install --user --upgrade cibuildwheel>=3.1.0 | ||
brew uninstall --ignore-dependencies libffi 2>&1 || true | ||
|
||
- name: download libffi for iOS | ||
env: | ||
CFFI_IOS_LIBFFI_VERSION: '3.4.7-2' | ||
run: | | ||
set -eux | ||
|
||
# Download prebuilt libffi from beeware/cpython-apple-source-deps | ||
platform="${{ matrix.platform }}" | ||
version="${CFFI_IOS_LIBFFI_VERSION}" | ||
url="https://github.com/beeware/cpython-apple-source-deps/releases/download/libFFI-${version}/libffi-${version}-${platform}.arm64.tar.gz" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While it looks a little weird to download binaries from beeware, |
||
|
||
echo "Downloading libffi for iOS (${platform})..." | ||
curl -L -o libffi-ios.tar.gz "${url}" | ||
|
||
# Extract libffi | ||
mkdir -p libffi-ios | ||
tar zxf libffi-ios.tar.gz -C libffi-ios | ||
|
||
# Set up paths for cibuildwheel | ||
echo "LIBFFI_IOS_DIR=$(pwd)/libffi-ios" >> "$GITHUB_ENV" | ||
Comment on lines
+421
to
+446
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would make sense to plug this into the |
||
|
||
- name: build/test wheels | ||
id: build | ||
env: | ||
CIBW_BUILD: ${{ matrix.spec }} | ||
CIBW_ENABLE: cpython-prerelease | ||
CIBW_PLATFORM: ios | ||
SDKROOT: ${{ matrix.platform }} | ||
CIBW_TEST_REQUIRES: pytest setuptools | ||
CIBW_TEST_SOURCES: cffi | ||
# Running tests from `testing/` will not work since they try to compile C code on device | ||
CIBW_TEST_COMMAND: python -m pytest -sv cffi/src/c/ | ||
# Environment variables for the build | ||
CIBW_ENVIRONMENT: > | ||
CFLAGS="-I${LIBFFI_IOS_DIR}/include" | ||
LDFLAGS="-L${LIBFFI_IOS_DIR}/lib" | ||
PYTHONUNBUFFERED=1 | ||
# Pass through our custom env vars | ||
CIBW_ENVIRONMENT_PASS_IOS: LIBFFI_IOS_DIR PYTHONUNBUFFERED | ||
run: | | ||
set -eux | ||
|
||
mkdir cffi | ||
|
||
tar zxf ${{ steps.fetch_sdist.outputs.download-path }}/cffi*.tar.gz --strip-components=1 -C cffi | ||
|
||
python3 -m cibuildwheel --output-dir dist cffi | ||
ambv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT" | ||
|
||
- name: upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.build.outputs.artifact_name }} | ||
path: dist/*.whl | ||
if-no-files-found: error | ||
if: ${{ env.skip_artifact_upload != 'true' }} | ||
|
||
merge_artifacts: | ||
needs: [python_sdist, linux, macos, windows] | ||
needs: [python_sdist, linux, macos, windows, ios] | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: merge all artifacts | ||
|
@@ -456,7 +559,7 @@ jobs: | |
|
||
check: | ||
if: always() | ||
needs: [python_sdist, linux, macos, windows, clang_TSAN, pytest-run-parallel, merge_artifacts] | ||
needs: [python_sdist, linux, macos, windows, ios, clang_TSAN, pytest-run-parallel, merge_artifacts] | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Verify all previous jobs succeeded (provides a single check to sample for gating purposes) | ||
|
Uh oh!
There was an error while loading. Please reload this page.