Material 3 #225
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: Ui Test | |
on: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
ui-tests: | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
env: | |
androidApiVersion: 34 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'corretto' | |
java-version: '17' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
gradle-version: wrapper | |
cache-read-only: true | |
- name: Fetch AVD Cache | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: ${{ runner.os }}-avd-${{ env.androidApiVersion }} | |
- name: Enable KVM group permissions for emulator hardware acceleration | |
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: 📱 Create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ env.androidApiVersion }} | |
target: aosp_atd | |
channel: stable | |
arch: x86_64 | |
ram-size: 4096M | |
disk-size: 2048M | |
force-avd-creation: false | |
disable-animations: true | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
script: echo "Generated AVD snapshot for caching." | |
- name: 🤖 Run Ui Tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ env.androidApiVersion }} | |
target: aosp_atd | |
channel: stable | |
arch: x86_64 | |
ram-size: 4096M | |
disk-size: 2048M | |
force-avd-creation: false | |
disable-animations: true | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
script: | | |
echo "Uninstalling debug and test apks" | |
adb uninstall com.yasinkacmaz.jetflix.debug.test || true | |
adb uninstall com.yasinkacmaz.jetflix.debug || true | |
echo "Successfully uninstalled debug and test apks" | |
./gradlew connectedCheck | |
- name: Publish Ui Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
check_name: Ui Test Results | |
junit_files: '**/androidTest-results/**/*.xml' |