Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(actions): Android emulator action #3514

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 8 additions & 40 deletions .github/composite_actions/launch_android_emulator/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,17 @@ name: Launch Android emulator
description: Launches an Android emulator and caches it for further action runs
inputs:
api-level:
description: The Android API level
description: "API level of the platform and system image - e.g. 23 for Android Marshmallow, 29 for Android 10"
default: "33"
target:
description: The Android image type
description: "target of the system image - default, google_apis, google_apis_playstore, aosp_atd, google_atd, android-wear, android-wear-cn, android-tv or google-tv"
default: google_apis
arch:
description: The CPU architecture
default: x86_64
abi:
description: "ABI of the Android system image - x86, x86_64 or arm64-v8a. Defaults to the host architecture."
# TODO(dnys1): Can this be removed so we can use a separate step?
script:
description: The script to run once the emulator is booted
required: true

description: The script to run once the emulator is booted.
runs:
using: "composite"
steps:
- name: Cache AVD
id: avd-cache
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # 3.0.11
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ inputs.api-level }}-${{ inputs.arch }}-${{ inputs.target }}

- name: Create AVD and generate snapshot
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@50986b1464923454c95e261820bc626f38490ec0 # 2.27.0
with:
api-level: ${{ inputs.api-level }}
target: ${{ inputs.target }}
arch: ${{ inputs.arch }}
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -logcat '*:e *:s'
script: echo "Generated AVD snapshot for caching."

- name: Launch AVD
uses: reactivecircus/android-emulator-runner@50986b1464923454c95e261820bc626f38490ec0 # 2.27.0
with:
api-level: ${{ inputs.api-level }}
target: ${{ inputs.target }}
arch: ${{ inputs.arch }}
# -no-snapshot-save + default options: https://github.com/reactivecircus/android-emulator-runner#configurations
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -logcat '*:e *:s'
# set screen timeout to 1 hour
script: |
adb shell settings put system screen_off_timeout 3600000
${{ inputs.script }}
using: "node16"
main: "dist/index.mjs"
Loading
Loading