Fix script #58
Workflow file for this run
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: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
build: | |
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 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
- name: Install command line tools | |
run: | | |
sudo mkdir -p $ANDROID_HOME/cmdline-tools | |
sudo wget "https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip" -O commandlinetools.zip | |
sudo unzip commandlinetools.zip -d $ANDROID_HOME/cmdline-tools | |
sudo mv $ANDROID_HOME/cmdline-tools/cmdline-tools $ANDROID_HOME/cmdline-tools/latest | |
rm commandlinetools.zip | |
- 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 "tools" | |
./sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" | |
./sdkmanager "platforms;android-${TARGET_VERSION}" | |
./sdkmanager "system-images;android-30;google_apis;arm64-v8a" | |
- 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;arm64-v8a" --force | |
- name: Start ADB Server | |
run: adb start-server | |
- name: Start Emulator | |
run: | | |
echo "Starting emulator..." | |
export PATH=$PATH:$ANDROID_HOME/emulator | |
emulator -avd test -no-audio -no-window -no-boot-anim -no-metrics & | |
# Wait for the emulator to start up | |
sleep 120 | |
- name: Check ADB Devices | |
run: adb devices | |
- name: Check Emulator Version | |
run: adb shell getprop ro.build.version.sdk | |
- name: Check Emulator Status | |
run: adb shell getprop sys.boot_completed | |
- 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 |