Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android CI with Atlassian Bamboo

Does anyone have any good resources for setting up Bamboo to do CI with Android projects? I have mine setup to pull source and compile it with ant. But I would love to know how to setup JUnit tests, where the tests are in a separate project.

Thanks

like image 287
bhawkins Avatar asked Sep 12 '14 02:09

bhawkins


1 Answers

I have figured out how to do it using Bamboo CI and new Android Studio projects with gradle. Bamboo does not have nice drop in tasks yet but you can leverage the script runner to do it. We setup our basic build tasks as follows:

Source Code Checkout. Script task:

  • Script Location: Inline
  • Script Body: gradlew.bat assembleDebug test (our Bamboo server is Windows so we use the bat file, linux use the ./gradlew assembleDebug test command)

Then we add a final task of JUnit parser, and we use the result directory line of: **/test-results/debug/*.xml

As for testing we use Robolectric Gradle tests, which generate JUnit test results.

I hope this helps anyone else who is looking into how to setup Bamboo with Android, hopefully they will add support one day like they do for .NET where its just a single task that builds and tests. The script command feels kind of a hack.

If someone is looking for Ant style tests, I can share that too but hopefully by now everyone has moved to Android Studio from eclipse. I will say the steps required for Ant and Instrumentation take a lot more time to setup and I had to use an emulator running on the server to do the tests.

like image 53
bhawkins Avatar answered Sep 25 '22 17:09

bhawkins