Fix and test Android build #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| tests: | |
| runs-on: ${{ matrix.runs-on }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runs-on: [macos-latest] | |
| python-version: [3.7.17, 3.8.20, 3.9.22, 3.10.17, 3.11.12, 3.12.10] | |
| include: | |
| - runs-on: macos-latest | |
| c-compiler: "clang" | |
| cxx-compiler: "clang++" | |
| initial-dashboard-cache: "CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.13" | |
| name: python-${{ matrix.python-version }}-${{ matrix.runs-on }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| path: src | |
| - name: Setup cmake | |
| uses: jwlawson/actions-setup-cmake@3a6cbe35ba64df7ca70c51365c4aff65db9a9037 # v2.1.1 | |
| with: | |
| cmake-version: 3.20.6 | |
| - name: Setup ninja | |
| uses: ashutoshvarma/setup-ninja@66ad2db9ed7d211c065daeeb849e9c8c895773c9 # master | |
| with: | |
| version: 1.10.0 | |
| - name: Download dashboard script | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: 'python-cmake-buildsystem/python-cmake-buildsystem' | |
| ref: dashboard | |
| fetch-depth: 0 | |
| path: scripts | |
| - name: Writing initial dashboard cache | |
| shell: bash | |
| run: | | |
| cat > scripts/initial-dashboard-cache.txt << EOF | |
| ${{ matrix.initial-dashboard-cache }} | |
| EOF | |
| cat scripts/initial-dashboard-cache.txt | |
| - name: Build & Test | |
| run: ctest --timeout 360 -S scripts/github_actions_dashboard.cmake -VV | |
| env: | |
| PY_VERSION: ${{ matrix.python-version }} | |
| CC: ${{ matrix.c-compiler }} | |
| CXX: ${{ matrix.cxx-compiler }} | |
| tests-android: | |
| runs-on: ${{ matrix.host }} | |
| strategy: | |
| matrix: | |
| ndk-arch: [x86_64] | |
| arch: [x86_64] | |
| api-level: [21] | |
| target: [default] | |
| host: [ubuntu-24.04] | |
| python-version: [3.11.12] | |
| include: | |
| - ndk-arch: arm64-v8a | |
| arch: x86_64 | |
| api-level: 30 | |
| target: google_apis | |
| host: ubuntu-24.04 | |
| python-version: 3.11.12 | |
| - ndk-arch: x86 | |
| arch: x86 | |
| api-level: 21 | |
| target: default | |
| host: ubuntu-24.04 | |
| python-version: 3.11.12 | |
| - ndk-arch: armeabi-v7a | |
| arch: x86_64 | |
| api-level: 30 | |
| target: google_apis | |
| host: ubuntu-24.04 | |
| python-version: 3.11.12 | |
| name: python-android-${{ matrix.python-version }}-${{ matrix.host }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| path: src | |
| - name: Enable KVM | |
| 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 | |
| - name: Make build and prefix directories | |
| run: | | |
| mkdir build | |
| mkdir install-prefix | |
| - name: run action | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| target: ${{ matrix.target }} | |
| arch: ${{ matrix.arch }} | |
| profile: Galaxy Nexus | |
| cores: 2 | |
| ram-size: 2048M | |
| sdcard-path-or-size: 100M | |
| emulator-build: 7425822 # https://github.com/ReactiveCircus/android-emulator-runner/issues/160 | |
| avd-name: test | |
| force-avd-creation: false | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| disable-animations: true | |
| working-directory: build/ | |
| ndk: 23.0.7421159 | |
| cmake: 3.10.2.4988404 | |
| channel: beta | |
| script: | | |
| adb devices | |
| ls $(pwd)/.. | |
| cmake -DANDROID_NDK=/usr/local/lib/android/sdk/ndk/23.0.7421159/ -DCMAKE_INSTALL_PREFIX:PATH=../install-prefix -DCMAKE_TOOLCHAIN_FILE=/usr/local/lib/android/sdk/ndk/23.0.7421159/build/cmake/android.toolchain.cmake -DANDROID_ABI=${{ matrix.ndk-arch }} -DCMAKE_CROSSCOMPILING_EMULATOR=$(pwd)/.github/workflows/adb-emu.sh -DANDROID_ALLOW_UNDEFINED_SYMBOLS=On -DENABLE_DECIMAL=Off -DENABLE_CTYPES=Off -DENABLE_CODECS_JP=OFF -DENABLE_CODECS_KR=OFF -DENABLE_CODECS_TW=OFF -DENABLE_MULTIBYTECODEC=OFF -DENABLE_CODECS_CN=OFF -DENABLE_CODECS_HK=OFF -DENABLE_CODECS_ISO2022=OFF -DBUILD_EXTENSIONS_AS_BUILTIN=On -DANDROID_PLATFORM=android-21 -DPYTHON_VERSION=${{ matrix.python-version }} $(pwd)/.. | |
| cmake --build . -- VERBOSE=1 | |
| cmake --build . --target install | |
| pass: # This job does nothing and is only used for the branch protection | |
| if: always() | |
| needs: | |
| - tests | |
| - tests-android | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Decide whether the needed jobs succeeded or failed | |
| uses: re-actors/alls-green@2765efec08f0fd63e83ad900f5fd75646be69ff6 # v1.2.2 | |
| with: | |
| jobs: ${{ toJSON(needs) }} |