Skip to content

10g for daemon

10g for daemon #757

Workflow file for this run

name: Android Emulator tests
on:
pull_request:
workflow_dispatch:
inputs:
project:
description: 'Project (Gradle module) to run tests for'
required: false
type: string
video:
description: 'Record video'
required: false
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
env:
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 120
jobs:
build:
uses: ./.github/workflows/setup_linux.yaml
with:
gradleTask: bundleLibRuntimeToJarDebug
project: ${{ inputs.project }}
projectBlacklist: hud
test:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
api-level: [24, 35]
project: ${{ fromJSON(needs.build.outputs.projects) }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup tools and cache for workspace
uses: ./.github/workflows/setup_tools_linux/
- name: Enable KVM group perms
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: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd.v12-${{ matrix.api-level }}
- 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: ${{ matrix.api-level }}
target: google_apis
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
arch: x86_64
disk-size: 3G
ram-size: 3G
heap-size: 1500M
profile: 3.4in WQVGA
channel: canary
cores: 6
script: ./script/check_emulator.sh
- name: install ffmpeg
if: inputs.video
uses: FedericoCarboni/setup-ffmpeg@v3
- name: pregenerate test package
if: inputs.video
run: ./gradlew :${{ matrix.project }}:packageDebugAndroidTest
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: google_apis
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot-save -noaudio -no-boot-anim -camera-back none
disable-animations: true
arch: x86_64
disk-size: 3G
ram-size: 3G
heap-size: 1500M
profile: 3.4in WQVGA
channel: canary
cores: 6
script: |
./script/check_emulator.sh
./gradlew ${{ inputs.video && 'recordAndroid' }} :${{ matrix.project }}:connectedDebugAndroidTest
- name: Upload test reports on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: "Android UI tests for ${{ matrix.project }}"
path: "${{ matrix.project }}/build/reports/androidTests/connected/debug/**"
- name: rename video
if: always() && inputs.video
run: mv build/video.mp4 recording-${{ matrix.project }}-${{ matrix.api-level }}.mp4
- name: upload video
if: always() && inputs.video
continue-on-error: true
uses: actions/upload-artifact@master
with:
name: recording-${{ matrix.project }}-${{ matrix.api-level }}
path: recording-${{ matrix.project }}-${{ matrix.api-level }}.mp4