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

Add extra warning text if Step fails on an ARM (Apple Silicon/M1) machine #41

Conversation

hisaac
Copy link
Contributor

@hisaac hisaac commented Jul 15, 2022

Note: A matching PR to the wait-for-android-emulator Step can be found here: bitrise-steplib/steps-wait-for-android-emulator#29

Checklist

  • I've read and followed the Contribution Guidelines
  • step.yml and README.md is updated with the changes (if needed)

Version

Requires a PATCH version update

Context

Running this Step on Apple Silicon machines is not officially supported. This change adds some additional warning text to help make that clear to users if the step fails and they don't expect it.

Changes

  • Adds warning text to the step.yml and README.md.
  • Updates the go-utils version to v2.0.0-alpha.8 to get access to the new CPU functions.
  • Adds a check within the failf method to display the additional warning text if the Step fails on an ARM-based machine.

Screenshots

Failure on Intel machine:

avd-manager-intel

Failure on Apple Silicon machine:

avd-manager-arm

@@ -81,6 +82,14 @@ func runningDeviceInfos(androidHome string) (map[string]string, error) {

func failf(msg string, args ...interface{}) {
log.Errorf(msg, args...)

cpuIsARM, err := system.CPU.IsARM()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use runtime.GOARCH? https://pkg.go.dev/runtime#pkg-constants

Copy link
Contributor Author

@hisaac hisaac Jul 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. That was my initial thought as well, but GOARCH is actually recorded at compile time, and may not be exactly accurate at runtime.

From that documentation:

GOARCH, GOOS, and GOROOT are recorded at compile time and made available by constants or functions in this package, but they do not influence the execution of the run-time system.

It's an edge case that this would even matter, but I opted to be accurate. The new code to do this is using an official Go lib, which essentially is calling uname -m from what I gather. https://github.com/bitrise-io/go-utils/blob/b7cacea4faebb77a89cc6ebdb50165188ff5e3aa/system/cpu.go#L14-L29

@@ -9,6 +9,8 @@ Create and boot an Android emulator used for device testing

Run instrumented and UI tests on a virtual Android device. Once some basic inputs are set, the Step checks the requirements, downloads the selected system image before creating and starting the emulator.

**Warning:** This Step is not yet supported on Apple Silicon (M1) machines. If you cannot find a solution to this error, try running this Workflow on an Intel-based machine type.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to just panic or fail if this is true in the step?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wanted to still allow people to run the Step for development and testing, but just add an extra warning if it does fail. It is possible to run these Steps on Apple Silicon in certain circumstances, it's just not yet officially supported.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see this below - is it possible to do this deeper into the system? perhaps at the yml validation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So like throw a warning before it runs? We'd probably have to generalize it then, and add a flag to the step.yml file or something to say is_not_compatible_with_apple_silicon: true or something, and then update the check Step to check that. That seems like more work than it's worth, being these are the only 2 Steps that we don't support on Apple Silicon.

Copy link
Contributor

@ofalvai ofalvai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@hisaac hisaac merged commit f6ddcd9 into master Jul 18, 2022
@hisaac hisaac deleted the STEP-2015-update-the-avd-manager-and-the-wait-for-android-emulator-step-description-m-1-not-supported branch July 18, 2022 14:11
@ErickMaeda
Copy link

Hello,

Is it going to supported anytime soon?

@hisaac
Copy link
Contributor Author

hisaac commented Sep 26, 2023

Hi @ErickMaeda, I don't work on this project any longer. Maybe @ofalvai knows?

@ofalvai
Copy link
Contributor

ofalvai commented Sep 26, 2023

@ErickMaeda Android emulator requires nested virtualization, and sadly this feature is not yet available in the underlying framework on Apple Silicon. We are just as excited about running emulators on Apple Silicon and will support this as soon as Apple adds the required support for it!

@ErickMaeda
Copy link

Got it! So far I can still use the emulators on linux stack's while it's not available yet, Thanks for the explanation! @ofalvai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants