Classy Data

Regular clean builds flush out integration bugs
Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Martin Fowler - Thoughtworks

Various open source and commercial Continuous Integration (CI) tools are available, but the good news is that Maven is both widely supported and easy to set up regardless of what tool is selected. Classy Data is proven on Jenkins which is a popular open source CI server. Some guidelines for setting up Classy Data on Jenkins follows. However, the details here are generally applicable for any CI server. Note that key Jekins plugins required are Maven Project Plugin and Git Plugin.

Environment

You will need to:

  1. Set the Android environment parameter. On Jenkins this means configuring the node which performs the build (see box below).
  2. Ensure the user under which the CI Server runs has access to Git or whatever source control system you are using.
  3. Configure the location and scope of the Maven repository for each project (Jenkins has options)
  4. Make provision for both snapshot and release builds

Creating a Maven project for Classy Data is easy with Jenkins as it extracts most of the build details from the Maven configuration. It creates a workspace location where the build takes place. When setting up a build environment for Maven projects, consider how to deal with Maven artifacts. Having a Maven repository dedicated to the project is recommended to achieve isolation from other projects. Setting up a local Maven repository server, such as Artifactory, is also helpful so build artifacts are generally available for users and CI projects.

Set the Android environment parameter

The default Jenkins node is named "master".

Go to: Jekins -> nodes -> master -> configure.

Under "Node Properties", click "Add" and set a key-value pair as name = "ANDROID_HOME" and value = <Android-home-location> eg. "/usr/local/adt/sdk".

Click "Save" to finish.

Pre Steps

Pre-build steps adapt a build designed to run in a development environment to instead, run on the CI Server. Examples are:

  • Run a shell command to delete build artifacts from the Maven repository located in the project workspace - rm -r .repository/au
  • Run a Maven build to change the project version for release. The version value can be passed by setting up a parameterized build

Build

The build goals are "clean deploy". Note that Jenkins provides a plugin for configuring a Maven settings.xml file to be shared by all projects. This provides a convient way to configure server credentials for deployment and repository details. Jenkins provides a good summary of the build on completion, including changes, links to each module and web pages with test results.

Post Steps

Post steps can be set to run only if the build succeeds. On use of Post Steps is to tag the source control system with the project version.

Screen shot from Jenkins project

jenkins