ReactiveCircus / android-emulator-runner

A GitHub Action for installing, configuring and running hardware-accelerated Android Emulators on macOS virtual machines.
Apache License 2.0
945 stars 186 forks source link

GitHub Classroom Support #93

Closed Alqueraf closed 3 years ago

Alqueraf commented 3 years ago

I would like to use this action along with the Github Classroom Autograding action.

My issue is that the test command/script needs to be run through the Autograding action, so I need to use this emulator-runner action just to launch the emulator device and keep it open until the workflow finishes, without using the script config.

Would that be possible?

ychescale9 commented 3 years ago

Unfortunately this isn't possible right now as the emulator instance can't survive beyond the step that runs this action.

If you can run the classroom auto grading action on a macos VM you should still be able to run an emulator but you'll have to add the script that create the avd and starts the emulator instance yourself.

Alqueraf commented 3 years ago

Thanks for the answer, I have the option to run a setup command for the auto-grading action, so will try to get some script together. Any tips on how to approach it?

ychescale9 commented 3 years ago

You can probably find plenty of examples for doing this which people traditionally do with other CI providers.

You basically need 3 steps:

  1. downloads all the SDK tools, and system images (depends on the API level, CPU arch you need and whether you need play services installed in the image). Most of the SDK tools are already installed on the macOS VMs so you probably just need to use the sdkmanager binary to download the system images you need.
  2. creates a new AVD using one of the system images downloaded
  3. starts a new emulator instance from the AVD created in a background process

Some scripts I've used in the past:

https://github.com/ReactiveCircus/cirrusci-android-templates#running-instrumented-tests https://github.com/ychescale9/bitrise-ui-tests-workflow/blob/main/start_emulator.sh

You could also look at the source code of this action, specifically the sdk-installer.ts and emulator-manager.ts.

Alqueraf commented 3 years ago

Thanks for your explanation and resources 🙏 will give it a try!

Alqueraf commented 3 years ago

Hi again 👋 I followed your recommendations and modified your bash file, it worked great! Thanks for your help. Sharing the template here in case anyone else has the same issue: https://github.com/Alqueraf/classroom-autograding-android

ychescale9 commented 3 years ago

Looks great! Thanks for sharing😄