Repository navigation
Conversation
|
Hi, I'm the maintainer of Python's Android support. Could someone take a look at this PR when you have time? cffi is one of the most popular packages not yet supported on Android, and there are many other things that depend on it. Thanks. |
fametrano
left a comment
There was a problem hiding this comment.
Rebased on current main, this PR's Android wheels build, and the x86_64 ones work on the emulator.
With cibuildwheel 4.3.5, the fork run builds cp313 to cp315 for both architectures and passes src/c on the x86_64 emulator: https://github.com/fametrano/cffi/actions/runs/43691179094. With its cp314 x86_64 wheel, btclib-secp256k1's ffi.callback() tests pass 44 of 44: https://github.com/btclib-org/btclib-secp256k1/actions/runs/43692367457.
The inline suggestions are the fork run's changes to the Android job.
| outputs: | ||
| matrix_json: ${{ steps.make_matrix.outputs.matrix_json }} | ||
| steps: | ||
| - uses: actions/checkout@v4 |
There was a problem hiding this comment.
Main now uses actions/checkout@v7.
| - uses: actions/checkout@v4 | |
| - uses: actions/checkout@v7 |
| include: | ||
| # arm64 Android device | ||
| - { spec: cp313-android_arm64_v8a, libffi_arch: aarch64-linux-android } | ||
| - { spec: cp314-android_arm64_v8a, libffi_arch: aarch64-linux-android } |
There was a problem hiding this comment.
Main builds cp315 for iOS, and cibuildwheel 4.3.5 builds it for Android too.
| - { spec: cp314-android_arm64_v8a, libffi_arch: aarch64-linux-android } | |
| - { spec: cp314-android_arm64_v8a, libffi_arch: aarch64-linux-android } | |
| - { spec: cp315-android_arm64_v8a, libffi_arch: aarch64-linux-android } |
|
|
||
| # x86_64 Android (emulator) | ||
| - { spec: cp313-android_x86_64, libffi_arch: x86_64-linux-android } | ||
| - { spec: cp314-android_x86_64, libffi_arch: x86_64-linux-android } |
There was a problem hiding this comment.
The same for x86_64, where the emulator also tests it.
| - { spec: cp314-android_x86_64, libffi_arch: x86_64-linux-android } | |
| - { spec: cp314-android_x86_64, libffi_arch: x86_64-linux-android } | |
| - { spec: cp315-android_x86_64, libffi_arch: x86_64-linux-android } |
|
|
||
| android: | ||
| needs: [python_sdist, make_android_matrix] | ||
| runs-on: ubuntu-24.04 |
There was a problem hiding this comment.
Every other build job on main has a timeout, and 45 minutes is the iOS job's.
| runs-on: ubuntu-24.04 | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 45 |
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: ${{ needs.python_sdist.outputs.sdist_artifact_name }} | ||
|
|
||
| - name: install python | ||
| uses: actions/setup-python@v5 |
There was a problem hiding this comment.
Main now uses download-artifact@v8 and setup-python@v7.
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ needs.python_sdist.outputs.sdist_artifact_name }} | |
| - name: install python | |
| uses: actions/setup-python@v5 | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: ${{ needs.python_sdist.outputs.sdist_artifact_name }} | |
| - name: install python | |
| uses: actions/setup-python@v7 |
| - name: build wheel prereqs | ||
| run: | | ||
| set -eux | ||
| python3 -m pip install --user --upgrade cibuildwheel>=3.1.0 |
There was a problem hiding this comment.
Unquoted, bash reads >=3.1.0 as a redirect to a file named =3.1.0, and pip installs cibuildwheel unconstrained.
| python3 -m pip install --user --upgrade cibuildwheel>=3.1.0 | |
| python3 -m pip install --user --upgrade "cibuildwheel>=3.1.0" |
| - name: build/test wheels | ||
| id: build | ||
| env: | ||
| CIBW_BUILD: ${{ matrix.spec }} |
There was a problem hiding this comment.
Main sets this on every other build job, so a prerelease Python builds here too.
| CIBW_BUILD: ${{ matrix.spec }} | |
| CIBW_BUILD: ${{ matrix.spec }} | |
| CIBW_ENABLE: cpython-prerelease |
| 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/ |
There was a problem hiding this comment.
This is the toggle #278 gave the other build jobs: assertions on in CI tests, off in released wheels.
| CIBW_TEST_COMMAND: python -m pytest -sv cffi/src/c/ | |
| CIBW_TEST_COMMAND: python -m pytest -sv cffi/src/c/ | |
| CIBW_ENVIRONMENT: > | |
| CPPFLAGS="$CPPFLAGS ${{ env.skip_artifact_upload == 'true' && '-UNDEBUG' || '-DNDEBUG' }}" |
| echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: upload artifacts | ||
| uses: actions/upload-artifact@v4 |
There was a problem hiding this comment.
Main now uses upload-artifact@v7.
| uses: actions/upload-artifact@v4 | |
| uses: actions/upload-artifact@v7 |
This PR adds building wheels for Android in CI.
Android is official supported since 3.13 (see PEP 738), so only wheels for Python 3.13 and 3.14 are build.
The prebuild libffi from https://github.com/beeware/cpython-android-source-deps is used similar to the iOS build. This prebuild version is the same that the official python build uses (see here).
FYI: @mhsmith