Giter Site home page Giter Site logo

demojenkins's Introduction

Outline

This article explains the set up of a Continuous Integration (CI) environment for Xcode projects that use Kiwi to implement unit tests, Calabash with Cucumber for acceptance tests and finally archive IPA file for distribution.
This is the instruction with my own experience

1. Run unit tests with Kiwi

You can read this article for more details how to run Kiwi tests for project.
http://9elements.com/io/index.php/continuous-integration-of-ios-projects-using-jenkins-cocoapods-and-kiwi/
However, I want to mention that you should modify the build script in unit tests target to increase timeout for ios-sim launching simulator. By default it's 30 seconds timeout, but it often makes build fail because of Session timeout error. You can see my demo project for details.
Here is my build execute shell in Jenkins for build project and run unit tests with Kiwi
 #!/usr/bin/env bash
 cd DemoJenkins
 source ~/.bash_profile
 bundle install
 bundle exec pod repo update
 bundle exec pod install
 kill_simulator()
{
     if [[ $(ps axo pid,command | grep "[i]Phone Simulator") ]]; then
          killall "iPhone Simulator"
     fi
}
kill_simulator
xcodebuild -sdk iphonesimulator -workspace DemoJenkins.xcworkspace -scheme CommandLineUnitTests -configuration Debug RUN_APPLICATION_TESTS_WITH_IOS_SIM=YES ONLY_ACTIVE_ARCH=NO clean build 2>&1

2. Run Acceptance tests with Calabash and Cucumber

You can read this article for more details how to run acceptance tests with Calabash and Cucumber
http://blog.watchlaterapp.com//blog/2013/03-Calabash-iOS-Jenkins.html
But for me, I use config.yml to puts cucumber settings(see AcceptanceTests folder in demo project).
After using these code to build .app file for target *-cal
  #!/usr/bin/env bash
  cd DemoJenkins
  source ~/.bash_profile

  bundle install
  bundle exec pod repo update
  bundle exec pod install
  DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
  xcodebuild clean build -workspace DemoJenkins.xcworkspace -scheme DemoJenkins-cal -configuration Debug -sdk iphonesimulator DEPLOYMENT_LOCATION=YES DSTROOT=build TARGETED_DEVICE_FAMILY=1 ONLY_ACTIVE_ARCH=NO CONFIGURATION_BUILD_DIR="$WORKSPACE/build"

and then run acceptance test by command lines:

  #!/usr/bin/env bash
  source ~/.bash_profile
  cd AcceptanceTests
  cucumber -p ios features/*.feature

That's all for acceptance tests. You can use cucumber report plugin for reporting test result.

3. Archive IPA file for distribution

Finally, we can build IPA file for distribution. I found gem named "shenzhen" for packaging project. It's very easy to use.
https://github.com/nomad/shenzhen
After installing shenzen successfully, you can use this command to export ipa file and distribute to some host like testflight, amazon, etc... by this command
  ipa build -s DemoJenkins -c Release

demojenkins's People

Contributors

quangpc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.