Skip to content

Commit

Permalink
Fix script
Browse files Browse the repository at this point in the history
  • Loading branch information
adimiz1 committed Jan 7, 2024
1 parent f8d9638 commit ea5cdb4
Showing 1 changed file with 15 additions and 78 deletions.
93 changes: 15 additions & 78 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,92 +6,29 @@ on:
- 'feature/github_actions'

jobs:
build:
runs-on: ubuntu-latest

env:
TARGET_VERSION: 30
ANDROID_BUILD_TOOLS_VERSION: 30.0.2
ANDROID_HOME: ${{ github.workspace }}/android-sdk

test:
runs-on: macos-latest
strategy:
matrix:
api-level: [21, 23, 29]
target: [default, google_apis]
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: checkout
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v2
- name: run tests
uses: reactivecircus/android-emulator-runner@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/
echo 'export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin' >> $GITHUB_ENV
source $GITHUB_ENV
- name: Accept Android Licenses
run: yes | sdkmanager --licenses

- name: Update Emulator
run: |
sdkmanager "emulator" # Install or update emulator
echo 'export PATH=$PATH:$ANDROID_HOME/emulator' >> $GITHUB_ENV
source $GITHUB_ENV
- name: Use Updated Emulator Command
run: |
$ANDROID_HOME/emulator/emulator -list-avds
$ANDROID_HOME/emulator/emulator -avd your_emulator_name -no-window -no-audio &
android-wait-for-emulator
adb devices
- name: List Available Emulators
run: |
sdkmanager --list
emulator -list-avds # Check available AVDs
- name: Install SDK components
run: |
echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "platforms;android-31" "system-images;android-31;google_apis;x86_64"
- name: Create AVD
run: echo "no" | $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd -n testRunner -d 19 -k "system-images;android-31;google_apis;x86_64"

- name: Cache Gradle Dependencies
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
profile: Nexus 6
script: ./gradlew connectedCheck

- name: Set Cloudinary URL
run: |
bash tools/get_test_cloud.sh > cloudinary_url.txt
echo "CLOUDINARY_URL=$(cat cloudinary_url.txt)" >> $GITHUB_ENV
- name: Check Emulator Command Availability
run: |
which emulator # Check if emulator command is available
echo $PATH # Check the PATH variable contents for emulator directory
- name: Start Emulator
run: |
emulator -list-avds
emulator -avd your_emulator_name -no-window -no-audio &
android-wait-for-emulator
adb devices
- name: Wait for Emulator
run: |
emulator -list-avds # Lists available emulators for reference
emulator -avd your_emulator_name -no-window -no-audio &
android-wait-for-emulator
adb devices # Check if the emulator is recognized as a connected device
- name: Build and Test
run: ./gradlew clean connectedCheck

0 comments on commit ea5cdb4

Please sign in to comment.