From c4b099205fbbc2e8f9c78a4173234dffdbd81245 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 12 Aug 2025 16:24:03 -0400 Subject: [PATCH 1/6] chore: adding Android wheels Signed-off-by: Henry Schreiner --- .github/workflows/wheels.yml | 52 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 89fb710f..b5b33600 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -145,32 +145,32 @@ jobs: path: wheelhouse/*.whl name: wheels-ios-${{ matrix.runs-on }} - # build_android_wheels: - # name: Android ${{ matrix.runs-on }} - # runs-on: ${{ matrix.runs-on }} - # strategy: - # fail-fast: false - # matrix: - # runs-on: [ubuntu-latest, macos-latest] - # steps: - # - uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - # submodules: true - # - # - uses: mhsmith/cibuildwheel@android - # env: - # CIBW_PLATFORM: android - # - # - name: Verify clean directory - # run: git diff --exit-code - # shell: bash - # - # - name: Upload wheels - # uses: actions/upload-artifact@v4 - # with: - # path: wheelhouse/*.whl - # name: wheels-android-${{ matrix.runs-on }} + build_android_wheels: + name: Android ${{ matrix.runs-on }} + runs-on: ${{ matrix.runs-on }} + strategy: + fail-fast: false + matrix: + runs-on: [ubuntu-latest, macos-latest] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + + - uses: pypa/cibuildwheel@63bdd4f043a77f1bd23b2ba9376972b6dc7b4779 + env: + CIBW_PLATFORM: android + + - name: Verify clean directory + run: git diff --exit-code + shell: bash + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + path: wheelhouse/*.whl + name: wheels-android-${{ matrix.runs-on }} upload_all: name: Upload if release From e10089d36ac01133e2e7ab2c2fe99fd64a14ba87 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 20:25:10 +0000 Subject: [PATCH 2/6] style: pre-commit fixes --- .github/workflows/wheels.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index b5b33600..20e5f521 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -157,15 +157,15 @@ jobs: with: fetch-depth: 0 submodules: true - + - uses: pypa/cibuildwheel@63bdd4f043a77f1bd23b2ba9376972b6dc7b4779 env: CIBW_PLATFORM: android - + - name: Verify clean directory run: git diff --exit-code shell: bash - + - name: Upload wheels uses: actions/upload-artifact@v4 with: From f5864ea1a8033f6e23400ef4994255109b0c5bf7 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 12 Aug 2025 16:28:48 -0400 Subject: [PATCH 3/6] Update wheels.yml --- .github/workflows/wheels.yml | 53 ++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 20e5f521..c57290cc 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -145,32 +145,33 @@ jobs: path: wheelhouse/*.whl name: wheels-ios-${{ matrix.runs-on }} - build_android_wheels: - name: Android ${{ matrix.runs-on }} - runs-on: ${{ matrix.runs-on }} - strategy: - fail-fast: false - matrix: - runs-on: [ubuntu-latest, macos-latest] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: true - - - uses: pypa/cibuildwheel@63bdd4f043a77f1bd23b2ba9376972b6dc7b4779 - env: - CIBW_PLATFORM: android - - - name: Verify clean directory - run: git diff --exit-code - shell: bash - - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - path: wheelhouse/*.whl - name: wheels-android-${{ matrix.runs-on }} + build_android_wheels: + name: Android ${{ matrix.runs-on }} + runs-on: ${{ matrix.runs-on }} + strategy: + fail-fast: false + matrix: + runs-on: [ubuntu-latest, macos-latest] + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + + - uses: pypa/cibuildwheel@63bdd4f043a77f1bd23b2ba9376972b6dc7b4779 + env: + CIBW_PLATFORM: android + + - name: Verify clean directory + run: git diff --exit-code + shell: bash + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + path: wheelhouse/*.whl + name: wheels-android-${{ matrix.runs-on }} upload_all: name: Upload if release From 22754db6a345a61fa4c6c7146966867376a2b44d Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 12 Aug 2025 17:33:26 -0400 Subject: [PATCH 4/6] Update pyproject.toml --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 25c8f504..068cd28e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -208,11 +208,11 @@ xbuild-tools = ["cmake", "ninja"] test-command = "python -m pytest --benchmark-disable tests" environment.PIP_EXTRA_INDEX_URL = "https://pypi.anaconda.org/beeware/simple/" -# [tool.cibuildwheel.android] -# build-frontend = "build" -# xbuild-tools = ["cmake", "ninja"] -# test-command = "pytest --benchmark-disable tests" -# environment.PIP_EXTRA_INDEX_URL = "https://chaquo.com/pypi-13.1" +[tool.cibuildwheel.android] +build-frontend = "build" +test-command = "python -m pytest --benchmark-disable tests" +environment.ANDROID_API_LEVEL = "24" +environment.PIP_EXTRA_INDEX_URL = "https://chaquo.com/pypi-13.1" [[tool.cibuildwheel.overrides]] select = "pp310-macosx_arm64" From 10a46d0bf0b0425ca6c3f48e28d458e837806459 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 12 Aug 2025 18:18:13 -0400 Subject: [PATCH 5/6] ci: install patchelf Signed-off-by: Henry Schreiner --- .github/workflows/wheels.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index c57290cc..b1555db4 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -151,14 +151,15 @@ jobs: strategy: fail-fast: false matrix: - runs-on: [ubuntu-latest, macos-latest] - + runs-on: [macos-13, macos-latest] steps: - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true + - run: pipx install patchelf + - uses: pypa/cibuildwheel@63bdd4f043a77f1bd23b2ba9376972b6dc7b4779 env: CIBW_PLATFORM: android From 71936ebd9e550a9c2e4160c10d4012c95a999bda Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 12 Aug 2025 21:22:32 -0400 Subject: [PATCH 6/6] fix: add emulation and skip Signed-off-by: Henry Schreiner --- .github/workflows/wheels.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index b1555db4..9103b8af 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -151,16 +151,27 @@ jobs: strategy: fail-fast: false matrix: - runs-on: [macos-13, macos-latest] + runs-on: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true - - run: pipx install patchelf + # GitHub Actions can't currently run the Android emulator on macOS. + - name: Skip Android tests on macOS + if: contains(matrix.runs-on, 'macos') + run: echo "CIBW_TEST_COMMAND=" >> "$GITHUB_ENV" - - uses: pypa/cibuildwheel@63bdd4f043a77f1bd23b2ba9376972b6dc7b4779 + # https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/ + - name: Enable KVM for Android emulator + if: contains(matrix.runs-on, 'ubuntu') + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - uses: pypa/cibuildwheel@v3.1 env: CIBW_PLATFORM: android