Jenkins Android job setup


In this part of the documentation you can find detailed description of proper Jenkins job configuration to run Apphance Flow within Jenkins. The easies way to startup is importing project template using jenkins cli

Example jenkins project (.xml file) can be found here

To import project into Jenkins you have to:

  1. crate new free style project
  2. update it from template using jenkins cli: 
    java -jar jenkins-cli.jar -s http://127.0.0.1:8080/ update-job ameba_demo_app_Android <Android_template.xml

Creating job

When jenkins is ready you can create your first project. You should create free style project.

Version control configuration

Find Source Code Management section in job configuration site. Configure repo according to your need. On screenshot below there is example for ios_demo project that is prepared to work with Flow, so you can use it to test jour jenkins setup.



Build Triggers

The most basic configuration is Source Code Management Polling. Poling configuration use cron like syntax In case of having many jobs this approach can generate a lot request to your SCM server.



Recommended  approach is using hooks.

Configuring application build

The build step is executed after each push to repository. During build Jenkins will run Flow (gradle) tasks.

It’s the best place to put compile and test related tasks. All tasks are described in Basic build tasks section.

Recommended tasks are:
  • clean
  • cleanRelease
  • buildAll
  • copyDebugSources
  • runUnitTests
The ‘runUnitTests’ task requires some additional project setup.



Copy&Paste friendly configuration:

Cleans the builds, ota file, builds all variants

--info --stacktrace

clean
cleanRelease
buildAll
analysis
copyDebugSources
runUnitTests
checkTests

Configuring release

Flow can generate release builds. You can read more about release concept in this section.

Environment configuration

To allow the user to enter a version string (ie foo-1.1-beta) you have to add the ollowing configuration:



Copy&Paste friendly configuration:

VERSION_STRING

Release ${VERSION_STRING} - ${RELEASE_NOTES}

Enter string version name for the release. Together with numeric version code (automatically increased at release time) this version string will make a full version of the release: ${VERSION_STRING}_${VERSION_CODE}

RELEASE_NOTES

Enter short release notes here, separate lines with coma

Before release build step

During release build following task should be run before build:
  • updateVersion
  • verifyReleaseNotes


Copy&Paste friendly configuration:

Cleans "ota" and "doc" directories and updates version

--info 
--stacktrace 
-Pversion.code=${BUILD_NUMBER} 

updateVersion verifyReleaseNotes

Releasing with Apphance

This part of the documentation will be updated soon as our 1.0 version of Flow will introduce a bit different way of releasing application using Apphance.

    Releasing without Apphance

    In order to release mobile project without Apphance integration, the tasks below should be run (as part of the post-build step):
    • prepareImageMontage
    • buildSourcesZip
    • prepareMailMessage
    • sendMailMessage 



    Copy&Paste friendly configuration:

    Creates "-src" zip file, other files, sends release e-mail

    --info 
    --stacktrace

    prepareImageMontage buildSourcesZip prepareMailMessage sendMailMessage


    These steps prepare distributable files in ota directory of the project, and prepare and send mail message that can be used to install application manually by the customer.

    ENJOY! You have your first mobile project setup for Continuous Integration. 

    Comments