Skip to content

Refactor build scripts and workflow files #40

Refactor build scripts and workflow files

Refactor build scripts and workflow files #40

Workflow file for this run

name: Android
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
BUILD_TYPE: Release
jobs:
build:
timeout-minutes: 30
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
abi: [x86_64, x86, arm64-v8a, armeabi-v7a]
runs-on: ${{matrix.os}}
steps:
- name: Set up on Windows
if: runner.os == 'Windows'
shell: bash
run: echo ANDROID_NDK="$(cygpath -u $ANDROID_NDK)" >> "$GITHUB_ENV"
- name: Install ninja
shell: bash
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
- name: Configure ${{matrix.abi}}
shell: bash
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}}
shell: bash
run: cmake --build build/${{matrix.abi}} -v
- name: Install ${{matrix.abi}}
shell: bash
run: cmake --install build/${{matrix.abi}}
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: android-${{matrix.os}}
path: ~/android/
test:
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
abi: [x86_64]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
with:
submodules: 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@v3
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@v3
with:
name: android-testsuite-${{matrix.os}}-${{matrix.abi}}
path: build/${{matrix.abi}}/testsuite/log.txt