Skip to main content

Development

Settle newest iOS projects in Jenkins server – Part 2

Create & configure an IOS project in Jenkins

To create an iOS project in Jenkins, I recommend to get the project from a version control server, like git, gitlab, svn, etc. Here I use gitlab to clone my projects into Jenkins.

01

In the build action, Jenkins already provided an “Xcode plugin” for Xcode-use, but it’s out of date and would invite bugs later, so I use “running shells” instead. The configurations here are shown below:

  1. Add a clang-scan build action, and configure it like this:

02

  1. Add a running shell action, and copy the following codes and change the bold ones to your own project name/scheme

# generate clang reports
mkdir -p ${WORKSPACE}/../builds/${BUILD_NUMBER}/clangScanBuildReports/
cp ${WORKSPACE}/clangScanBuildReports/*/StaticAnalyzer/*/*/normal/i386/*.html ${WORKSPACE}/../builds/${BUILD_NUMBER}/clangScanBuildReports/

# generate junit test reports
xcodebuild -workspace Library.xcworkspace -scheme ‘Library‘ -configuration Debug -sdk iphonesimulator clean test 2>&1 | ocunit2junit
# generate the coverage report
cd “${WORKSPACE}”
/usr/local/bin/gcovr –root=”${WORKSPACE}” –exclude='(.*./Developer/SDKs/.*)|(.*test*\.m)’ -x > ./coverage.xml
# generate count report
sloccount –duplicates –wide –details ${WORKSPACE} > ./sloccount.sc

If your are building a 64 bit project, please replace ‘i386’ with ‘x86_64’ to generate clang reports, which means using the following codes instead of the first part above:

# generate clang reports
mkdir -p ${WORKSPACE}/../builds/${BUILD_NUMBER}/clangScanBuildReports/
cp ${WORKSPACE}/clangScanBuildReports/*/StaticAnalyzer/*/*/normal/x86_64/*.html ${WORKSPACE}/../builds/${BUILD_NUMBER}/clangScanBuildReports/

After these scripts, add some post-build actions to release codes related reports, the configuration part would be like this:

03

04

 

The full configuration would be like this:

05

06

 

07

08

09

Ok it’s time to have a cup of coffee, we are almost there, just save it and run (and with finger-cross: P).

If everything goes well, you would see a big sun shows in the projects overview page. If you see a black cloud (which means a project failed) then please do remember to check the outputs from “console output”in project settings.

10

Combine Jenkins server together

For those who already have a Jenkins server running in Windows/Linux, you’ll have to set this new Jenkins as a “slave node” for your main Jenkins.

Reference:

Pouclet, Romain,. Pro IOS Continuous Integration. 2014.

http://blog.manbolo.com/2014/04/15/automated-static-code-analysis-with-xcode-5.1-and-jenkins

http://clang-analyzer.llvm.org

http://blog.octo.com/en/jenkins-quality-dashboard-ios-development/

http://www.raywenderlich.com/22816/beginning-automated-testing-with-xcode-part-22

http://blog.octo.com/en/jenkins-quality-dashboard-ios-development/

http://www.sailmaker.co.uk/blog/2013/04/02/advanced-jenkins-for-ios-and-mac/

https://blogs.perficient.com/delivery/blog/2015/01/26/setting-up-jenkins-with-git-repository/

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories
Follow Us
TwitterLinkedinFacebookYoutubeInstagram