Fix github action #91
Workflow file for this run
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: Android Workflow | |
| on: [push, pull_request] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| env: | |
| TARGET_VERSION: 30 | |
| ANDROID_BUILD_TOOLS_VERSION: 30.0.2 | |
| ANDROID_HOME: /usr/local/android-sdk | |
| MALLOC_ARENA_MAX: 2 | |
| ADB_INSTALL_TIMEOUT: 20 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v2 | |
| - name: Install Android SDK components | |
| run: | | |
| cd $ANDROID_HOME/cmdline-tools/latest/bin | |
| ./sdkmanager "platform-tools" | |
| ./sdkmanager "emulator" | |
| ./sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" | |
| ./sdkmanager "platforms;android-${TARGET_VERSION}" | |
| ./sdkmanager "system-images;android-30;google_apis;x86_64" | |
| - name: Enable KVM (safe for CI even if no hardware accel) | |
| 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: Create AVD | |
| run: | | |
| cd $ANDROID_HOME/cmdline-tools/latest/bin | |
| echo no | ./avdmanager create avd -n test -k "system-images;android-30;google_apis;x86_64" --force | |
| - name: Start ADB Server | |
| run: adb start-server | |
| - name: Start Emulator | |
| run: | | |
| echo "Starting emulator..." | |
| export PATH=$PATH:$ANDROID_HOME/emulator | |
| nohup emulator -avd test -no-audio -no-window -no-boot-anim -no-metrics -accel off > /tmp/emulator.log 2>&1 & | |
| echo "Waiting for emulator device..." | |
| adb wait-for-device | |
| echo "Waiting for emulator to boot..." | |
| boot_completed="" | |
| until [[ "$boot_completed" == "1" ]]; do | |
| sleep 5 | |
| boot_completed=$(adb shell getprop sys.boot_completed 2>/dev/null | tr -d '\r') | |
| done | |
| adb shell input keyevent 82 | |
| echo "Emulator is fully booted." | |
| - name: Verify emulator is running | |
| run: adb devices | |
| - name: Export CLOUDINARY_URL | |
| run: | | |
| export CLOUDINARY_URL=$(bash tools/get_test_cloud.sh) | |
| echo "CLOUDINARY_URL=$CLOUDINARY_URL" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: ./gradlew clean connectedCheck --stacktrace | |
| - name: Dump emulator log on failure | |
| if: failure() | |
| run: cat /tmp/emulator.log |