Jenkins iOS 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_iOS <iOS_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 Apphance 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
  • unlockKeychain
  • buildAll
  • copyDebugSources
  • runUnitTests
The ‘runUnitTests’ task requires some additional xcode project setup.


Copy&Paste friendly configuration

Cleans the builds, ota file and documentation

--info
--stacktrace

clean cleanRelease unlockKeychain buildAll

Configuring release

Apphance 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:

Release ${VERSION_STRING} - ${RELEASE_NOTES}

VERSION_STRING

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
Note! This step configures numeric version code to be taken from Jenkins build number, which is the recommended way (this way numerical version code for all releases is always incremented - as required by AppStore)



Copy&Paste friendly configuration:

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

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

updateVersion verifyReleaseNotes

Other ways of releasing
In order to release mobile project without Apphance integration, the tasks below should be run (as part of the post-build step):
  • 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.

Creates "-src" zip file, prepares and sends release e-mail

--info
--stacktrace
-Prelease.notes="${RELEASE_NOTES}"

prepareImageMontage buildSourcesZip prepareMailMessage sendMailMessage

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