Update Android CI workflow #37
This file contains 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 CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
connectedTests: | |
name: Run Android Instrumented Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: gradle | |
- name: Set up Android SDK | |
uses: android-actions/setup-android@v2 | |
with: | |
api-level: 31 | |
build-tools: '31.0.0' | |
ndk: '21.4.7075529' | |
- name: Accept Licenses | |
run: | | |
yes | sdkmanager --licenses | |
- name: Install System Image | |
run: | | |
sdkmanager "system-images;android-30;google_apis;x86" | |
- name: Install Emulator | |
run: sdkmanager "emulator" | |
- name: Add Emulator to PATH | |
run: echo "${ANDROID_HOME}/emulator" >> $GITHUB_PATH | |
- name: Create and Start Emulator | |
run: | | |
avdmanager create avd -n test -k "system-images;android-30;google_apis;x86" --device "pixel" | |
nohup emulator -avd test -no-snapshot -gpu swiftshader_indirect -accel off -no-window -no-audio -no-boot-anim & | |
timeout 10m adb wait-for-device || (echo "Emulator did not start in time" && exit 1) | |
adb shell input keyevent 82 | |
env: | |
DISPLAY: ":0" | |
- name: Run Instrumented Tests | |
run: ./gradlew connectedAndroidTest |