From 52b77aff0fd70690cf84e7bdb1233a5933c0e465 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 29 Jul 2025 09:46:09 -0600 Subject: [PATCH 01/10] ci: add Android wheels / tests --- .github/workflows/cibw-cc.yaml | 48 ++++++++++++++++------------------ 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/.github/workflows/cibw-cc.yaml b/.github/workflows/cibw-cc.yaml index da27acc..3bdf782 100644 --- a/.github/workflows/cibw-cc.yaml +++ b/.github/workflows/cibw-cc.yaml @@ -4,46 +4,42 @@ on: workflow_dispatch: pull_request: branches: - - master + - master concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -jobs: - build-pyodide: - name: Pyodide - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - - - uses: pypa/cibuildwheel@v3.1 - env: - CIBW_PLATFORM: pyodide - - uses: actions/upload-artifact@v4 - with: - name: wheels-pyodide - path: dist/*.whl - - build-ios: - name: iOS - runs-on: macos-latest +jobs: + build: + strategy: + matrix: + include: + - platform: android + os: ubuntu-latest + - platform: android + os: macos-latest + - platform: ios + os: macos-latest + archs: all + - platform: pyodide + os: ubuntu-latest + + name: ${{ matrix.platform }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - - run: brew upgrade cmake - - uses: pypa/cibuildwheel@v3.1 env: - CIBW_PLATFORM: ios - CIBW_ARCHS: all + CIBW_PLATFORM: ${{ matrix.platform }} + CIBW_ARCHS: ${{ matrix.archs }} - uses: actions/upload-artifact@v4 with: - name: wheels-ios + name: wheels-${{ matrix.platform }}-${{ matrix.os }} path: dist/*.whl From 46b9c9367f44ee512594530695fd63fdfb5b3661 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 29 Jul 2025 15:46:25 +0000 Subject: [PATCH 02/10] style: pre-commit fixes --- .github/workflows/cibw-cc.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibw-cc.yaml b/.github/workflows/cibw-cc.yaml index 3bdf782..6ece77a 100644 --- a/.github/workflows/cibw-cc.yaml +++ b/.github/workflows/cibw-cc.yaml @@ -25,10 +25,10 @@ jobs: archs: all - platform: pyodide os: ubuntu-latest - + name: ${{ matrix.platform }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} - + steps: - uses: actions/checkout@v4 From 4a786f9830ccf2a40e4551ac1a16ac6d4010eef5 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 29 Jul 2025 09:48:27 -0600 Subject: [PATCH 03/10] Update cibw-cc.yaml --- .github/workflows/cibw-cc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibw-cc.yaml b/.github/workflows/cibw-cc.yaml index 6ece77a..39da352 100644 --- a/.github/workflows/cibw-cc.yaml +++ b/.github/workflows/cibw-cc.yaml @@ -37,7 +37,7 @@ jobs: - uses: pypa/cibuildwheel@v3.1 env: CIBW_PLATFORM: ${{ matrix.platform }} - CIBW_ARCHS: ${{ matrix.archs }} + CIBW_ARCHS: ${{ matrix.archs || 'auto' }} - uses: actions/upload-artifact@v4 with: From 91320a34af71856ed119b958f49d1b889467da7f Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 29 Jul 2025 09:53:06 -0600 Subject: [PATCH 04/10] Update pyproject.toml --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 908086d..7843a8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,6 +62,9 @@ build-frontend = {name = "build", args = ["--exports", "whole_archive"]} build-frontend = "build" xbuild-tools = ["cmake", "ninja"] +[tool.cibuildwheel.android] +build-frontend = "build" + [tool.ruff.lint] extend-select = [ "B", # flake8-bugbear From 44f34a21d77de439c854a66427d29b9d30a705ea Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 29 Jul 2025 10:20:30 -0600 Subject: [PATCH 05/10] Update cibw-cc.yaml --- .github/workflows/cibw-cc.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/cibw-cc.yaml b/.github/workflows/cibw-cc.yaml index 39da352..2492a5a 100644 --- a/.github/workflows/cibw-cc.yaml +++ b/.github/workflows/cibw-cc.yaml @@ -14,6 +14,7 @@ concurrency: jobs: build: strategy: + fail-fast: false matrix: include: - platform: android @@ -34,6 +35,9 @@ jobs: - uses: actions/setup-python@v5 + - if: matrix.platform == 'ios' + run: brew upgrade cmake + - uses: pypa/cibuildwheel@v3.1 env: CIBW_PLATFORM: ${{ matrix.platform }} From 3bce36ac94d280ec3ba40353bff709de765322a5 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 12 Aug 2025 16:29:08 -0400 Subject: [PATCH 06/10] chore: use commit with fix Signed-off-by: Henry Schreiner --- .github/workflows/cibw-cc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibw-cc.yaml b/.github/workflows/cibw-cc.yaml index 2492a5a..adbbf5e 100644 --- a/.github/workflows/cibw-cc.yaml +++ b/.github/workflows/cibw-cc.yaml @@ -38,7 +38,7 @@ jobs: - if: matrix.platform == 'ios' run: brew upgrade cmake - - uses: pypa/cibuildwheel@v3.1 + - uses: pypa/cibuildwheel@63bdd4f043a77f1bd23b2ba9376972b6dc7b4779 env: CIBW_PLATFORM: ${{ matrix.platform }} CIBW_ARCHS: ${{ matrix.archs || 'auto' }} From b22ad7263b641c40e511805b10a6459481748eba Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 12 Aug 2025 16:33:38 -0400 Subject: [PATCH 07/10] fix: android level for C++ Signed-off-by: Henry Schreiner --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 7843a8b..9121c30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,6 +64,7 @@ xbuild-tools = ["cmake", "ninja"] [tool.cibuildwheel.android] build-frontend = "build" +environment.ANDROID_API_LEVEL = "24" [tool.ruff.lint] extend-select = [ From 7fa8c1340319b99c0085b9e48a1cc78ad941d8fd Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 12 Aug 2025 16:42:14 -0400 Subject: [PATCH 08/10] fix: add patchelf Signed-off-by: Henry Schreiner --- .github/workflows/cibw-cc.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cibw-cc.yaml b/.github/workflows/cibw-cc.yaml index adbbf5e..0cf0374 100644 --- a/.github/workflows/cibw-cc.yaml +++ b/.github/workflows/cibw-cc.yaml @@ -38,6 +38,9 @@ jobs: - if: matrix.platform == 'ios' run: brew upgrade cmake + - if: matrix.platform == 'android' + run: pipx install patchelf + - uses: pypa/cibuildwheel@63bdd4f043a77f1bd23b2ba9376972b6dc7b4779 env: CIBW_PLATFORM: ${{ matrix.platform }} From 2bacf51f20fbeee70dea933f9145cc4e420d0994 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 12 Aug 2025 16:55:47 -0400 Subject: [PATCH 09/10] Update cibw-cc.yaml --- .github/workflows/cibw-cc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibw-cc.yaml b/.github/workflows/cibw-cc.yaml index 0cf0374..f49023f 100644 --- a/.github/workflows/cibw-cc.yaml +++ b/.github/workflows/cibw-cc.yaml @@ -18,7 +18,7 @@ jobs: matrix: include: - platform: android - os: ubuntu-latest + os: macos-13 - platform: android os: macos-latest - platform: ios From ac44c4841096c13fb6643b25336561ce81e9a103 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 12 Aug 2025 19:42:17 -0400 Subject: [PATCH 10/10] ci: pull in config from pybind11's tests Signed-off-by: Henry Schreiner --- .github/workflows/cibw-cc.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/cibw-cc.yaml b/.github/workflows/cibw-cc.yaml index f49023f..d2da777 100644 --- a/.github/workflows/cibw-cc.yaml +++ b/.github/workflows/cibw-cc.yaml @@ -38,6 +38,19 @@ jobs: - if: matrix.platform == 'ios' run: brew upgrade cmake + # GitHub Actions can't currently run the Android emulator on macOS. + - name: Skip Android tests on macOS + if: runner.os == 'macOS' + run: echo "CIBW_TEST_COMMAND=" >> "$GITHUB_ENV" + + # https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/ + - name: Enable KVM for Android emulator + if: runner.os == 'Linux' && matrix.platform == 'android' + 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 + - if: matrix.platform == 'android' run: pipx install patchelf