Single headless emulator - 41 #56
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 CI | |
on: | |
push: | |
branches: | |
- "*" | |
env: | |
NUMBER_OF_SHARDS: 4 # Default number of shards/emulators | |
jobs: | |
setup-emulators: | |
# runs-on: macos-latest # Nothing on macos-latest works ??? wtf | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
api-level: [30] # 34 | |
target: [google_atd] # google_apis_playstore, google_apis, | |
arch: [x86_64] # arm64-v8a, x86 | |
shard: [1, 2, 3, 4] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- 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: checkout | |
uses: actions/checkout@v4 | |
- name: Enable KVM (not applicable on macOS) | |
if: runner.os == 'Linux' | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Enable KVM | |
run: | | |
sudo apt-get update | |
sudo apt-get install qemu-kvm | |
sudo adduser $USER kvm | |
sudo chmod 666 /dev/kvm | |
- name: Install System Image and Create AVD | |
run: | | |
sdkmanager --install "system-images;android-${{ matrix.api-level }};${{ matrix.target }};${{ matrix.arch }}" | |
echo "no" | avdmanager create avd -n "testAVD${{ matrix.shard }}" -k "system-images;android-${{ matrix.api-level }};${{ matrix.target }};${{ matrix.arch }}" --force | |
- name: Start Emulators | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: ${{ matrix.target }} | |
arch: ${{ matrix.arch }} | |
avd-name: "testAVD${{ matrix.shard }}" | |
force-avd-creation: true | |
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim | |
disable-animations: true | |
emulator-boot-timeout: 250 | |
cores: 2 | |
disk-size: 6000M | |
heap-size: 600M | |
script: echo "Emulator started" | |
# script: bash main.sh # echo "hello" && sleep 30 && echo "\n\n\n\n.\n\n\n\n\n OK !! We are done" | |
env: | |
JAVA_HOME: /opt/hostedtoolcache/Java_Zulu_jdk/17.0.11-9/x64 | |
JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Zulu_jdk/17.0.11-9/x64 | |
# GRADLE_BUILD_ACTION_SETUP_COMPLETED: true | |
# GRADLE_BUILD_ACTION_CACHE_RESTORED: true | |
control-flow: | |
needs: setup-emulators | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Execute Control Script | |
run: bash main.sh |