Skip to content

Fix workflow files

Fix workflow files #49

Workflow file for this run

name: Android
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
BUILD_TYPE: Release
defaults:
run:
shell: bash
jobs:
build:
timeout-minutes: 30
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-13]
abi: [x86_64, x86, arm64-v8a, armeabi-v7a]
runs-on: ${{matrix.os}}
steps:
- name: Set up on Windows
if: runner.os == 'Windows'
run: echo ANDROID_NDK="$(cygpath -u $ANDROID_NDK)" >> "$GITHUB_ENV"
- name: Install ninja
run: |
map_Windows="win" ; map_Linux="linux" ; map_macOS="mac"
suffix="$(eval echo '$'map_$RUNNER_OS)"
mkdir -p "$HOME/bin"
curl -L -o ninja.zip \
"https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-$suffix.zip"
unzip ninja.zip -d "$HOME/bin"
- uses: actions/checkout@v3
with:
submodules: true
lfs: true
- name: Configure ${{matrix.abi}}
run: |
sh android.sh build configure ${{matrix.abi}} \
-G Ninja -DCMAKE_MAKE_PROGRAM="$HOME/bin/ninja" \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX:PATH="$HOME/android/${{matrix.abi}}"
- name: Build ${{matrix.abi}}
run: cmake --build build/${{matrix.abi}} -v
- name: Install ${{matrix.abi}}
run: cmake --install build/${{matrix.abi}}
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: android-${{matrix.os}}-${{matrix.abi}}
path: ~/android/
test:
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest, macos-13]
abi: [x86_64]
runs-on: ${{matrix.os}}
steps:
# https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
# https://github.blog/2024-01-17-github-hosted-runners-double-the-power-for-open-source/
- name: Enable KVM group perms
id: enable_kvm
if: runner.os == 'Linux'
continue-on-error: true
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: actions/checkout@v4
with:
submodules: true
lfs: true
- name: Configure ${{matrix.abi}}
run: sh android.sh build configure ${{matrix.abi}} -DCMAKE_BUILD_TYPE=$BUILD_TYPE
- name: Build ${{matrix.abi}}
run: cmake --build build/${{matrix.abi}} -v
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: hostos-${{matrix.os}}-api-21-abi-${{matrix.abi}}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
emulator-options: -no-window -gpu swiftshader_indirect -no-audio -no-boot-anim -camera-back none
api-level: 21
arch: ${{matrix.abi}}
ndk: 25.2.9519653
force-avd-creation: false
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -no-audio -no-boot-anim -camera-back none
api-level: 21
arch: ${{matrix.abi}}
ndk: 25.2.9519653
force-avd-creation: false
disable-animations: true
script: sh android.sh build test ${{matrix.abi}}
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: android-testsuite-${{matrix.os}}-${{matrix.abi}}
path: build/${{matrix.abi}}/testsuite/log.txt