Add create AVD #5
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 Build and Test | |
on: | |
push: | |
branches: | |
- feature/github_actions # Update with your branch name | |
jobs: | |
build: | |
runs-on: ubuntu-latest # You may choose another supported OS | |
env: | |
TARGET_VERSION: 30 | |
ANDROID_BUILD_TOOLS_VERSION: 30.0.2 | |
ANDROID_HOME: ${{ github.workspace }}/android-sdk | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Download and Install Android SDK | |
run: | | |
mkdir -p $ANDROID_HOME | |
wget "https://dl.google.com/android/repository/commandlinetools-linux-7302050_latest.zip" -O commandlinetools.zip | |
unzip -q commandlinetools.zip -d $ANDROID_HOME/ | |
yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager "platforms;android-${TARGET_VERSION}" --sdk_root=$ANDROID_HOME | |
yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" --sdk_root=$ANDROID_HOME | |
- name: Accept Android Licenses | |
run: yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses | |
- name: Create AVD | |
run: echo no | avdmanager create avd --force -n test -k "system-images;android-21;default;armeabi-v7a" | |
- name: Cache Gradle Dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
- name: Create and Start Emulator | |
run: | | |
echo no | android create avd --force -n test -t android-21 | |
emulator -avd test -no-audio -no-window & | |
android-wait-for-emulator | |
adb shell input keyevent 82 | |
- name: Set Cloudinary URL | |
run: export CLOUDINARY_URL=$(bash tools/get_test_cloud.sh) | |
- name: Build and Test | |
run: ./gradlew clean connectedCheck |