First, thank you for all the interest and feedback on our series of blogs showing how to do continuous build, test and deployment for mobile apps using Jenkins in the Cloud with the CloudBees PaaS. In the next few blogs, I plan to show you how to do continuous integration that involves both the mobile apps and the mobile backends - which is where the PaaS model really comes into its own. Before I do, though, here's a quick roundup of how to build and run iOS/Android mobile applications, with the builds controlled from the cloud but running on a local machine using the beta customer-provided executor feature. I've collected all the various build scenarios that we've looked at in various blog posts on our read-only partnerdemo account and I'll just briefly list them here and add a few notes on how to launch the Android emulator or iPhone simulator directly from the workspace on your local machine. We'll shortly be adding ClickStarts to do just this, which will make it even easier, but it's always good to know what's going on under the hood, isn't it?
As we've seen in previous blogs, there are several ways to approach continuous integration for mobile app builds and these examples are designed to show how to do this using local resources as executors: I've shown how to set these up using MacOS 'agents' and you will need a MacOS system with Xcode installed to copy this setup, but there is no need to pre-install the Android SDK, NDK and platform targets as the Jenkins builds will automatically download all the necessary resources. You can run all of these using a single configuration - just sign up for a free CloudBees account and set up an SSH key pair to secure communication between the agent and the Jenkins controller. That's easy to do on MacOS:
Change directory to your ~/.ssh folder and use the built-in ssh-keygen command to generate a public-private key pair (for example, if you specify id_rsa_cloudbees for the private key, then the public key will be generated in id_rsa_cloudbees.pub ) - you'll be prompted for a password;
Copy the public key and add it to your SSH keys for the account
Now all you have to do is download the jenkins-cli.jar file and connect the agent to Jenkins in the cloud as shown below (use the domain/account name that you chose when signing up for the CloudBees service: your Jenkins controller can be accessed at http://.ci.cloudbees.net ):
java -jar jenkins-cli.jar -s https://.ci.cloudbees.com -i ~/.ssh/id_rsa_cloudbees customer-managed-agent -fsroot ~/Jenkins -labels android -labels xcode -executors 4 -name mobile-agent
Remember that the -i flag points to the file with the SSH private key, and the -fsroot flag points to the location which Jenkins will use for build workspaces and other artifacts. The labels (android and xcode ) are used here to force the builds to run on the agents - you can use your own labels to specify the build location but make sure that the labels used for the job configurations and the agents match.
There are four examples showing different configurations for the Android builds:
Using a MacOS agent with a custom AVD emulator
Using a MacOS agent with an existing AVD emulator
Using a MacOS agent with different Android platform builds
Using a MacOS agent with Android NDK native builds
Please see the description notes accompanying the builds for more details. When the build completes, you should be able to start the Android emulator - with the AVD (Android Virtual Device) used for the build - directly from the local workspace, like this:
emulator -avd hudson_en-US_240_WVGA_android-16_armeabi-v7a &
Wait for the emulator to boot up and then launch the main Activity (in this case, .DroidFish) using the Android Debug Bridge (ADB) and the default emulator port of 5554:
adb connect localhost:5554
adb shell am start -n org.petero.droidfish/.DroidFish
You should see the DroidFish application, like this:
There are two examples showing different configurations for the iOS builds
Building an .app to run on the iOS simulator
Building an .ipa archive for tethered devices or beta distribution
Again, please see the description notes accompanying the builds for more details. In the GitHub project I am using for the Stockfish iOS build, I have included the binary for a very useful command-line utility that you can use to launch the app directly using the iOS simulator. You can find more information and instructions on how to build it for yourself here . Use the first example to build Stockfish.app and then run the iOS simulator like this:
$WORKSPACE/ios-sim launch $WORKSPACE/Applications/Stockfish.app
You should see the iOS Simulator appear, with the Stockfish app, like this:
Have fun and test your chess skills - but be warned, properly configured Stockfish plays a mean game!
~Mark Prichard, Senior Director of Product Management
Stay up to date
We'll never share your email address and you can opt out at any time, we promise.