Created
November 20, 2019 14:45
-
-
Save edvinasbartkus/4c09d85ac6f2a2f9eec9d9c8deac5e61 to your computer and use it in GitHub Desktop.
Running Detox tests for Android on Github Actions Workflow
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 | |
on: [push] | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Node | |
uses: actions/setup-node@v1 | |
- name: Use specific Java version for sdkmanager to work | |
uses: joschi/setup-jdk@v1 | |
with: | |
java-version: 'openjdk8' | |
architecture: 'x64' | |
- name: Download Android Emulator Image | |
run: | | |
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install "system-images;android-29;google_apis;x86" | |
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd --force --name emu --device "Nexus 5X" -k 'system-images;android-29;google_apis;x86' | |
$ANDROID_HOME/emulator/emulator -list-avds | |
- name: Install node_modules | |
run: | | |
yarn install --frozen-lockfile | |
- name: Build for detox | |
run: | | |
yarn build-detox-android | |
- name: Android Emulator | |
timeout-minutes: 10 | |
continue-on-error: true | |
run: | | |
echo "Starting emulator" | |
nohup $ANDROID_HOME/emulator/emulator -avd emu -no-audio -no-snapshot -no-window & | |
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82' | |
$ANDROID_HOME/platform-tools/adb devices | |
echo "Emulator started" | |
- name: Android Detox | |
run: yarn start & yarn test-detox-android |
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
{ | |
"scripts": { | |
"build-detox-android": "detox build -c android.emu.debug", | |
"test-detox-android": "detox test -c android.emu.debug" | |
}, | |
"detox": { | |
"configurations": { | |
"android.emu.debug": { | |
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk", | |
"build": | |
"cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..", | |
"type": "android.emulator", | |
"name": "emu" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Complication with/Lack of KVM related deps on the Linux host drove me to just use a Mac runner for now, will try to circle back if I find a Linux path for this.
Thanks for sharing!