Skip to content
New issue

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

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

Already on GitHub? # to your account

Add Travis CI builds for PRs? #207

Closed
barbeau opened this issue Sep 24, 2015 · 14 comments
Closed

Add Travis CI builds for PRs? #207

barbeau opened this issue Sep 24, 2015 · 14 comments

Comments

@barbeau
Copy link
Collaborator

barbeau commented Sep 24, 2015

IMHO adding Travis CI support to this project would be helpful - it would help reveal issues like #187 immediately, rather than having to track down their cause later.

@broady @markmcd Thoughts?

If you're willing to turn on Travis support for this project in the Travis CI console, I'd be willing to try configure the .travis.yml script. I've done this on many Android apps, but never on a library before, and its always good to learn new things :).

@markmcd
Copy link
Contributor

markmcd commented Sep 29, 2015

I've started on this in #203 but there's a test that's failing only in Travis that I haven't had a chance to look at. If you're keen to look at that then we'd be set :D

You can also fork the repo and enable Travis for your fork while you develop, which is what I did.

@barbeau
Copy link
Collaborator Author

barbeau commented Sep 29, 2015

@markmcd Thanks, didn't know you could enable Travis on forks. I'll see if I can take a look.

barbeau added a commit to barbeau/android-maps-utils that referenced this issue Sep 29, 2015
barbeau added a commit to barbeau/android-maps-utils that referenced this issue Oct 1, 2015
@barbeau
Copy link
Collaborator Author

barbeau commented Oct 1, 2015

So I think the issue is that you need to run the Google APIs emulator image on Travis to access Google Play Services. The names of these images also changed earlier this year - see my post on SO here:
http://stackoverflow.com/questions/28751111/invalid-abi-armeabi-v7a-for-the-selected-target-with-google-apis-21/28751112#28751112

I just pushed an attempt to fix this in this branch:
https://github.com/barbeau/android-maps-utils/tree/travis2

We'll see what happens...

barbeau added a commit to barbeau/android-maps-utils that referenced this issue Oct 1, 2015
@barbeau
Copy link
Collaborator Author

barbeau commented Oct 1, 2015

Well, no luck this time - the emulator startup is timing out. This should be close, though. I'll see if I can do trial-and-error a bit more...

@barbeau
Copy link
Collaborator Author

barbeau commented Oct 1, 2015

So I have a working version of API 21 with the Google API emulator here:
https://github.com/OneBusAway/onebusaway-android/blob/master/.travis.yml

I'm going to see if I can get a version of this working with API 23.

@barbeau
Copy link
Collaborator Author

barbeau commented Oct 1, 2015

Here's the latest branch I'm working on:
https://github.com/barbeau/android-maps-utils/tree/travis3

This has the Google API emulator starting and the build executing - see this Travis build. However, it fails with:

:library:connectedDebugAndroidTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':library:connectedDebugAndroidTest'.
> com.android.builder.testing.api.TestException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.ShellCommandUnresponsiveException

Usually this means ADB timed out:
http://stackoverflow.com/a/28949723/937715

The fix for this is normally to increase ADB timeout via the Travis variable ADB_INSTALL_TIMEOUT.

However, I've bumped it up to 15 min so far and I'm still getting the same exception on Travis.

Also, not sure if its related to these issues, but I did find this open AOSP issue saying that Google Play Services is broken on the Google API emulator starting with API Level 22. It's been triaged but is still open, so the same issue may exist on API Level 23 emulator.

@barbeau
Copy link
Collaborator Author

barbeau commented Oct 1, 2015

I'm starting to wonder if this is an emulator issue - I spun up the Google APIs ARM (armeabi-v7a) emulator on my work machine, and it took > 10 min. And, I got the same com.android.ddmlib.ShellCommandUnresponsiveException when trying to run the tests from the command line, even after the emulator had fully booted.

When I ran the tests from Android Studio, they were very slow (240s total) - I also saw this while they were running:

image

However, given enough time, the tests did eventually pass when run from Android Studio. If it takes this long on my work machine, Travis is going to be far longer than that, so the slowness is certainly contributing to the problem. I wonder if the API Level 23 Google API emulator takes longer to boot than the past versions.

There still seems to be something else going on, though - I then went back and tried to run the tests from the command line again - and again I got com.android.ddmlib.ShellCommandUnresponsiveException.

@markmcd @broady Do you know if anything changed with API Level 23 Google API emulator that would prevent Gradle from installing/running from the command-line with ./gradlew connectedDebugAndroidTest?

@broady
Copy link
Contributor

broady commented Oct 1, 2015

I'm not sure. It would be very bad if the Android team broke that.

@jfschmakeit any thoughts/knowledge?

@barbeau
Copy link
Collaborator Author

barbeau commented Oct 1, 2015

Also, looks like gradlew installDebug from command line fails for the demo app, with the same com.android.ddmlib.ShellCommandUnresponsiveException. I can, however, install/run it from Android Studio without a problem, and uninstall it via adb uninstall com.google.maps.android.utils.demo from the command line.

@barbeau
Copy link
Collaborator Author

barbeau commented Oct 2, 2015

Yeah, seems something is up with the API 23 Google API emulator image.

I finally (!) got a successful Travis build (I was missing one piece - compileSdkVersion has to be Google APIs too):
https://travis-ci.org/barbeau/android-maps-utils/builds/83234555

...but I had to revert back to API 21 Google APIs emulator image. The exact same setup on API 23 Google APIs image fails (on Travis and locally) with the com.android.ddmlib.ShellCommandUnresponsiveException error:
https://travis-ci.org/barbeau/android-maps-utils/builds/83233500

Here's the commit that's the difference between the two versions:
barbeau@a5eecd7

Unless I'm missing something, until the issue with the API 23 Google API emulator is resolved, our only option for running tests on Travis CI would be to revert the project to using compileSdkVersion "Google Inc.:Google APIs:21".

@markmcd @broady Thoughts? If that works for you I can see if I can trim down the .travis.yml a bit to match @markmcd's original work, and open a PR.

barbeau added a commit to barbeau/android-maps-utils that referenced this issue Oct 5, 2015
As discussed in googlemaps#207 (comment), requires changing to `compileSdkVersion "Google Inc.:Google APIs:21"`, because:
a) Google API emulator image is needed to run tests that require Google Play Services (see https://developers.google.com/android/guides/setup)
b) the Google API Level 23 emulator seems to have a bug that doesn't allow installing/running tests from the command line

This patch also adds a command-line option to disable pre-dexing, which is used on Travis to decrease build times (see http://tools.android.com/tech-docs/new-build-system/tips#TOC-Improving-Build-Server-performance.)
barbeau added a commit to barbeau/android-maps-utils that referenced this issue Oct 5, 2015
As discussed in googlemaps#207 (comment), requires changing to `compileSdkVersion "Google Inc.:Google APIs:21"`, because:
a) Google API emulator image is needed to run tests that require Google Play Services (see https://developers.google.com/android/guides/setup)
b) the Google API Level 23 emulator seems to have a bug that doesn't allow installing/running tests from the command line

This patch also adds a command-line option to disable pre-dexing, which is used on Travis to decrease build times (see http://tools.android.com/tech-docs/new-build-system/tips#TOC-Improving-Build-Server-performance.)
barbeau added a commit to barbeau/android-maps-utils that referenced this issue Oct 5, 2015
As discussed in googlemaps#207 (comment), requires changing to `compileSdkVersion "Google Inc.:Google APIs:21"`, because:
a) Google API emulator image is needed to run tests that require Google Play Services (see https://developers.google.com/android/guides/setup)
b) the Google API Level 23 emulator seems to have a bug that doesn't allow installing/running tests from the command line

This patch also adds a command-line option to disable pre-dexing, which is used on Travis to decrease build times (see http://tools.android.com/tech-docs/new-build-system/tips#TOC-Improving-Build-Server-performance.)
@barbeau
Copy link
Collaborator Author

barbeau commented Oct 5, 2015

I went ahead and opened a PR here for the working Travis configuration:
#209

@barbeau
Copy link
Collaborator Author

barbeau commented Oct 5, 2015

I posted an SO question here on the issues with the API Level 23 Google API emulator:
http://stackoverflow.com/questions/32952413/gradle-commands-fail-on-api-23-google-api-emulator-image-armeabi-v7a

@markmcd markmcd closed this as completed in 807f515 Oct 7, 2015
markmcd added a commit that referenced this issue Oct 7, 2015
@barbeau
Copy link
Collaborator Author

barbeau commented Oct 15, 2015

FYI - I've opened an AOSP issue here on the API 23 Google API emulator image gradle command failures:
https://code.google.com/p/android/issues/detail?id=190200

@barbeau
Copy link
Collaborator Author

barbeau commented Nov 10, 2015

For the record, looks like this hard-coded timeout value is the underlying issue of why the API 23 Google API emulator image Gradle commands are failing:
https://code.google.com/p/android/issues/detail?id=189764

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

No branches or pull requests

3 participants