workflow: Add Android build to CI matrix
This commit is contained in:
parent
d1aeef5c25
commit
27d905feff
|
|
@ -552,3 +552,156 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
PYTHONHOME=~/python/usr/local PYTHONPATH=built node built/bin/run_tests.js tests
|
||||
|
||||
android:
|
||||
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- android-abi: arm64-v8a
|
||||
android-arch: arm64
|
||||
android-triple: aarch64-linux-android
|
||||
ndk-version: 29.0.14206865
|
||||
runner: ubuntu-latest
|
||||
|
||||
- android-abi: armeabi-v7a
|
||||
android-arch: arm
|
||||
android-triple: arm-linux-androideabi
|
||||
ndk-version: 29.0.14206865
|
||||
runner: ubuntu-latest
|
||||
|
||||
- android-abi: x86_64
|
||||
android-arch: x86_64
|
||||
android-triple: x86_64-linux-android
|
||||
ndk-version: 29.0.14206865
|
||||
runner: ubuntu-latest
|
||||
|
||||
- android-abi: x86
|
||||
android-arch: x86
|
||||
android-triple: i686-linux-android
|
||||
ndk-version: 29.0.14206865
|
||||
runner: ubuntu-latest
|
||||
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
with:
|
||||
packages: 'tools platform-tools platforms;android-21 ndk;${{ matrix.ndk-version }}'
|
||||
|
||||
- name: Set up Android NDK
|
||||
run: |
|
||||
echo "ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/${{ matrix.ndk-version }}" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.13'
|
||||
|
||||
- name: Restore Python build cache
|
||||
id: cache-android-python-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ~/python-prefix
|
||||
key: cache-android-python-3.13.9-${{ matrix.android-abi }}-ndk${{ matrix.ndk-version }}
|
||||
|
||||
- name: Build Python 3.13
|
||||
if: steps.cache-android-python-restore.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
wget https://www.python.org/ftp/python/3.13.9/Python-3.13.9.tar.xz
|
||||
tar -xJf Python-3.13.9.tar.xz
|
||||
sed -i.bak "s/aarch64-linux-android/${{ matrix.android-triple }}/" Python-3.13.9/Android/android.py
|
||||
sed -i.bak "s/ndk_version=[0-9.]\{1,\}/ndk_version=${{ matrix.ndk-version }}/" Python-3.13.9/Android/android-env.sh
|
||||
(cd Python-3.13.9/Android && python3 android.py build ${{ matrix.android-triple }})
|
||||
cp -R Python-3.13.9/cross-build/${{ matrix.android-triple }}/prefix ~/python-prefix
|
||||
rm -rf Python-3.13.9
|
||||
|
||||
- name: Save Python build cache
|
||||
id: cache-android-python-save
|
||||
if: steps.cache-android-python-restore.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ~/python-prefix
|
||||
key: ${{ steps.cache-android-python-restore.outputs.cache-primary-key }}
|
||||
|
||||
- name: Restore thirdparty build cache
|
||||
id: cache-android-thirdparty-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ./thirdparty
|
||||
key: cache-android-thirdparty-afc7ad98aee90da0f2f6bad826a41f9b71e0cdd0-${{ matrix.android-abi }}-ndk${{ matrix.ndk-version }}
|
||||
|
||||
- name: Install yasm
|
||||
if: steps.cache-android-thirdparty-restore.outputs.cache-hit != 'true'
|
||||
run: ${{runner.os == 'macOS' && 'brew' || 'sudo apt-get'}} install yasm
|
||||
|
||||
- name: Build thirdparty packages
|
||||
if: steps.cache-android-thirdparty-restore.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
git clone --revision=afc7ad98aee90da0f2f6bad826a41f9b71e0cdd0 --depth=1 https://github.com/rdb/panda3d-thirdparty.git thirdparty
|
||||
cd thirdparty
|
||||
cmake -B build \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake \
|
||||
-DCMAKE_ANDROID_ARCH_ABI=${{ matrix.android-abi }} \
|
||||
-DCMAKE_ANDROID_ARCH=${{ matrix.android-arch }} \
|
||||
-DCMAKE_SYSTEM_VERSION=21 \
|
||||
-DANDROID_ABI=${{ matrix.android-abi }} \
|
||||
-DANDROID_PLATFORM=android-21 \
|
||||
-DBUILD_FCOLLADA=OFF \
|
||||
-DBUILD_OPENSSL=OFF \
|
||||
-DBUILD_VRPN=OFF \
|
||||
-DBUILD_ARTOOLKIT=OFF
|
||||
cmake --build build --config Release -j4
|
||||
rm -rf build
|
||||
|
||||
- name: Save thirdparty build cache
|
||||
id: cache-android-thirdparty-save
|
||||
if: steps.cache-android-thirdparty-restore.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ./thirdparty
|
||||
key: ${{ steps.cache-android-thirdparty-restore.outputs.cache-primary-key }}
|
||||
|
||||
- name: Build for Android
|
||||
shell: bash
|
||||
run: |
|
||||
python makepanda/makepanda.py --git-commit=${{github.sha}} --target android-21 --python-incdir=~/python-prefix/include --python-libdir=~/python-prefix/lib --arch ${{ matrix.android-arch }} --everything --no-openssl --no-tinydisplay --no-pandatool --verbose --threads=4
|
||||
|
||||
- name: Install test dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip install -t ~/python-prefix/lib/python3.13/site-packages -r requirements-test.txt
|
||||
|
||||
- name: Enable KVM group perms
|
||||
if: startsWith(matrix.runner, '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
|
||||
|
||||
- name: Setup Android Emulator and Run Tests
|
||||
if: startsWith(matrix.android-abi, 'x86')
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
with:
|
||||
api-level: 27
|
||||
arch: ${{ matrix.android-abi }}
|
||||
target: default
|
||||
profile: pixel_6
|
||||
script: |
|
||||
adb shell "rm -rf /data/local/tmp/panda3d-tests"
|
||||
adb push built/bin/run_tests /data/local/tmp/panda3d-tests/run_tests
|
||||
adb shell "mkdir /data/local/tmp/panda3d-tests/lib"
|
||||
adb push built/lib/*.so /data/local/tmp/panda3d-tests/lib
|
||||
adb push ~/python-prefix/lib/*.so /data/local/tmp/panda3d-tests/lib
|
||||
adb push ~/python-prefix/lib/python3.13 /data/local/tmp/panda3d-tests/lib/python3.13
|
||||
adb push built/panda3d /data/local/tmp/panda3d-tests/lib/python3.13/site-packages/
|
||||
adb push built/direct /data/local/tmp/panda3d-tests/lib/python3.13/site-packages/
|
||||
adb push built/models /data/local/tmp/panda3d-tests/models
|
||||
adb push built/etc /data/local/tmp/panda3d-tests/etc
|
||||
adb push tests /data/local/tmp/panda3d-tests/tests
|
||||
adb shell "cd /data/local/tmp/panda3d-tests && LD_LIBRARY_PATH=/data/local/tmp/panda3d-tests/lib PYTHONPATH=/data/local/tmp/panda3d-tests/lib/python3.13/site-packages ./run_tests -v tests"
|
||||
|
|
|
|||
Loading…
Reference in New Issue