2020-08-11 19:28:37 -04:00
|
|
|
name: CI_Android
|
2024-10-11 19:05:20 -04:00
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-05-04 16:26:50 -04:00
|
|
|
on:
|
|
|
|
push:
|
2021-02-24 14:16:21 -05:00
|
|
|
branches: [ main ]
|
2020-05-04 16:26:50 -04:00
|
|
|
pull_request:
|
2021-02-24 14:16:21 -05:00
|
|
|
branches: [ main ]
|
2020-05-04 16:26:50 -04:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
Android:
|
2024-10-11 19:05:20 -04:00
|
|
|
runs-on: macos-latest-large
|
2020-05-04 16:26:50 -04:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: build
|
|
|
|
steps:
|
2024-01-17 18:25:32 -05:00
|
|
|
- uses: actions/checkout@v4
|
2020-05-04 16:26:50 -04:00
|
|
|
|
|
|
|
- name: Create build directory
|
|
|
|
run: mkdir -p build
|
|
|
|
working-directory: .
|
|
|
|
|
2024-10-11 19:05:20 -04:00
|
|
|
- uses: actions/setup-java@v4
|
|
|
|
with:
|
|
|
|
java-version: 8
|
|
|
|
distribution: zulu
|
|
|
|
|
|
|
|
- name: Start Emulator
|
2020-05-04 16:26:50 -04:00
|
|
|
run: |
|
|
|
|
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-24;default;x86_64'
|
|
|
|
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n xamarin_android_emulator -k 'system-images;android-24;default;x86_64' --force
|
|
|
|
$ANDROID_HOME/emulator/emulator -list-avds
|
2024-10-11 19:05:20 -04:00
|
|
|
echo "Starting emulator..."
|
|
|
|
nohup $ANDROID_HOME/emulator/emulator -no-audio -no-snapshot -avd xamarin_android_emulator &> /dev/null &
|
|
|
|
echo "Emulator starting in background"
|
2020-05-04 16:26:50 -04:00
|
|
|
|
|
|
|
- name: Configure
|
2022-09-27 20:04:21 -04:00
|
|
|
run: cmake -Werror=dev -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=16 -DANDROID_ABI=x86_64 -DCMAKE_BUILD_TYPE=Debug ..
|
2020-05-04 16:26:50 -04:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: cmake --build . --parallel
|
|
|
|
|
|
|
|
- name: Wait for emulator ready
|
2024-10-11 19:05:20 -04:00
|
|
|
timeout-minutes: 2
|
2020-05-04 16:26:50 -04:00
|
|
|
run: |
|
|
|
|
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 10; done; input keyevent 82'
|
|
|
|
$ANDROID_HOME/platform-tools/adb devices
|
|
|
|
$ANDROID_HOME/platform-tools/adb shell getprop ro.product.cpu.abi
|
|
|
|
|
|
|
|
- name: Deploy tests
|
|
|
|
run: |
|
|
|
|
adb push tests /data/local/tmp
|
|
|
|
adb shell find /data/local/tmp/tests -maxdepth 1 -exec chmod +x {} \\\;
|
|
|
|
|
|
|
|
- name: Test
|
2021-02-24 14:16:21 -05:00
|
|
|
run: adb shell find /data/local/tmp/tests -name "*_tests" -maxdepth 1 -exec {} \\\;
|