Eliminate sleep from android emulator doc examples #4277
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This should fix the android job back to green and has some improvements on handling the android emulator in the CI (and locally) , part of which eliminates the need for sleep hack in documentation examples.
Job reference on my fork can be found here .
Sometimes the device may be stuck in unauthorized, I don't know the reason yet and can't yet replicate it locally .Unauthorized issue
In https://github.com/ReactiveCircus/android-emulator-runner, it seems that the same issue occurs when caching is used.
I'm wondering if there's any implicit caching that I have missed in the github actionsAfter experimenting with https://github.com/vaslabs-ltd/test-android-emulator , it seems that the runner avd directory is polluted. Although I'm not sure why, deleting it (at least in test-android-emulator) fixes the unauthorized issue . I've added the same in the github action here
Improvements
Task.Command(exclusive = true)
as suggested by @lihaoyi seems to have made it very stableFixes
Note
For the wait, I initially had it in a task and used a while loop but changed my mind and having it outside of task context seems easier to control the behaviour . I can convert it into a tailrec function if you prefer that style
EDIT: changed the outcome of unauthorized after some experimentation on a clean repo