palttuk / ios-ci-jenkins-example

This is a CI example with an iOS application using xctool, CocoaPods, AFNetworking, OCMockito, OCHamcrest, gcovr, oclint, cloc, PMD and Jenkins.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Continuous Integration on iOS with Jenkins

Description:

This is a continuous integration example with an iOS application using xctool as the build system, CocoaPods as the dependency manager, AFNetworking for asynchronous networking inside the iOS app, OCMockito for mock and stub unit testing, OCHamcrest for unit testing matchers, gcovr for test coverage reporting, oclint for static analysis reporting, cloc for software lines of code count reporting, PMD for duplicate code reporting and Jenkins as the continuous integration server. You can find the detail setup and explanations for all these in my blog.

Building:

In order to build the application, clone this repo:

$ git clone git@github.com:Ruenzuo/ios-ci-jenkins-example.git

Then set up the dependencies and open the workspace and you're ready to go:

$ cd ios-ci-jenkins-example && pod install && open WeatherApp.xcworkspace

screenshot-1  screenshot-2 screenshot-3

Jenkins Dashboard:

The main objective here is to have a quality metrics dashboard on Jenkins:

test_results

code_coverage

static_analysis

sloc_count

duplicate_code

You only need to add an Execute shell step on you Jenkins job like this:

./Scripts/Pods.sh
./Scripts/Coverage.sh
./Scripts/StaticAnalysis.sh
./Scripts/PMD.sh
./Scripts/Sloccount.sh
./Scripts/TestResults.sh

For more information on how to get started with each tool/framework, go to:
xctool
CocoaPods
AFNetworking
OCMockito
OCHamcrest
gcovr
oclint
cloc
PMD
Jenkins

The following Jenkins plugins have been used for the dashboard:
Test results: Regular Jenkins JUnit test result report plugin
Code coverage
Static analysis
Sloc count
Duplicate code

If you examine closely the scripts, this helpers tools have been used:
reattach-to-user-namespace
Objective-C-CPD-Language
xsltproc

To-Do

  • [✓] Make it public.
  • [✓] Write the blog post. It's here.
  • [ ] Continuous delivery setup: app signing and Testflight integration.
  • [ ] Currently, I'm executing the unit tests twice, because I'm using two different reporters each time. I think this could be improved.

License

The MIT License (MIT)

Copyright (c) 2014 Renzo Crisóstomo

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

This is a CI example with an iOS application using xctool, CocoaPods, AFNetworking, OCMockito, OCHamcrest, gcovr, oclint, cloc, PMD and Jenkins.

License:MIT License


Languages

Language:Objective-C 96.9%Language:Shell 2.8%Language:Ruby 0.4%