Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

wcandillon
Copy link
Contributor

Lately the Android Github action has been extremely flaky and it seems like many open source projects are affected by the same issue (see mockito/mockito#2903).
More specifically, the issue if that once we finished to build the app, the emulator is not responsive anymore.

While there doesn't seem to be any great solution for this yet, I was wondering if we should build the app before starting the emulator. One possible cause of this problem is that the github image is so constraint in resources that it may crash the emulator. Overall I think it is good to build the app first anyways, if the CI fails because of a build error, we will get the error much faster.

Another suggestion was to downgrade the Android API version.

@wcandillon wcandillon requested a review from chrfalch March 31, 2023 06:59
@wcandillon wcandillon self-assigned this Mar 31, 2023

- name: Build Android app
working-directory: example/android
run: ./gradlew assembleDebug

Choose a reason for hiding this comment

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

If this takes 20 minutes, I would build in a separate job, publish the APK as artifact and then download the artifact separately, or use Gradle cache to make sure the whole building running FROM-CACHE.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes a lot of sense

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the latest version now omits starting the Emulator - but wouldn't we need another build file / step that starts and runs the emulator? Or I'm I misunderstanding that we already have this...? (🫣)

run: ./gradlew assembleDebug

- name: SKDs - download required images
run: $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "system-images;android-30;default;x86_64"

Choose a reason for hiding this comment

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

According to docs the emulator startup time can be greatly reduced by caching, see reactivecircus/android-emulator-runner

Any reason doing this manually?

uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
script: ./gradlew connectedCheck

Choose a reason for hiding this comment

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

This will still do a full build before deploying the APK and running tests. But I'll leave it up to the team to figure out what you want :)

@wcandillon
Copy link
Contributor Author

@chrfalch This is finally ready for review. It splits the Android build and test into two jobs. That way, if the emulator crashes, which seems to happen on Github actions, we can just restart the testing job without rebuilding the apk.

Copy link
Contributor

@chrfalch chrfalch left a comment

Choose a reason for hiding this comment

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

Nice!

@chrfalch chrfalch merged commit b3fc322 into main Apr 13, 2023
@chrfalch chrfalch deleted the wcandillon-patch-4 branch April 13, 2023 09:00
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.

3 participants