Skip to content

Make Bitrise work as well - 70 #2

Make Bitrise work as well - 70

Make Bitrise work as well - 70 #2

name: Android CI
on:
push:
branches:
- "*"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
sudo adduser $USER kvm
- name: Clear SDK Repository Cache
run: |
rm -rf $HOME/.android/cache
- name: Setup JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: "zulu"
- name: Setup Android SDK
uses: android-actions/setup-android@v2
with:
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: Enable KVM
if: runner.os == 'Linux'
run: |
sudo apt-get install -y qemu-kvm
sudo adduser $USER kvm
sudo chmod 666 /dev/kvm
- name: Create and Start Emulators
run: |
sdkmanager --install "emulator" "system-images;android-30;google_apis;x86_64"
export PATH=$ANDROID_HOME/emulator:$PATH
echo "kaankaankaan1"
for i in {1..4}
do
echo "Creating AVD testAVD$i..."
echo "no" | avdmanager create avd -n "testAVD$i" -k "system-images;android-30;google_apis;x86_64" --force
echo "Starting emulator for testAVD$i..."
nohup emulator -avd "testAVD$i" -no-audio -no-window -no-boot-anim -no-snapshot-load -no-snapshot-save -wipe-data > /dev/null 2>&1 &
done
echo "kaankaankaan2"
for i in {5554..5558..2} # Loop from 5554 to 5558 stepping by 2 each time
do
until adb -s emulator-$i shell 'getprop sys.boot_completed' | grep -m 1 '1'; do
echo "Waiting for emulator-$i to fully boot..."
sleep 10
done
done
echo "All emulators are ready."
- name: Display Emulators (Debugging)
if: always()
run: |
mkdir -p /home/runner/.maestro && touch /home/runner/.maestro/sessions
echo "The devices are: $(adb devices)"
- name: Execute Control Script
run: |
bash main.sh
- name: Cleanup Emulators
if: always()
run: |
adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done