Continuous Integration With GitHub, Fastlane & Jenkins

In this tutorial, you’ll learn how to use GitHub, Travis, Jenkins and fastlane to make Continuous Integration part of your daily workflow. By Audrey Tam.

4.7 (28) · 1 Review

Download materials
Save for later
Share
You are currently viewing page 4 of 4 of this article. Click here to view the first page.

Using fastlane With Jenkins

To use fastlane with Jenkins, you need to install it on your Mac — follow the instructions in our fastlane Tutorial: Getting Started: Enter ruby -v to check you have Ruby 2.0 and xcode-select --install to ensure you have Xcode Command Line Tools (CLT), then enter this command to install fastlane in /usr/local/bin:

sudo gem install -n /usr/local/bin fastlane --verbose

While fastlane is installing, in your Jenkins project’s Build ▸ Command field, replace the xcodebuild command with this:

fastlane scan

With fastlane installed, cd to the root directory of Numero, and enter this command:

fastlane init

When fastlane asks “What would you like to use fastlane for?”, select 4. Manual setup. This just adds Gemfile and a fastlane folder to your project. Commit and push to GitHub, to start the next build.

Note: If Jenkins says it doesn’t know where fastlane is, specify the full path in the Command field. You can find the full path in Terminal, with which fastlane.

Cleaning Up

Jenkins runs as a launch daemon so it can restart after you exit or even kill the process. To stop Jenkins, run this command in Terminal:

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

The launch daemon restarts when you restart your Mac, which you only discover when you try to expose another service on localhost:8080 and find it’s already in use! To completely uninstall Jenkins, run this command:

/Library/Application Support/Jenkins/Uninstall.command

Check that this has deleted Applications/Jenkins and /Users/Shared/Jenkins, and also the unnamed standard user in System Preferences ▸ Users & Groups — when you restart your Mac, you shouldn’t see the option to login as Jenkins.

Where to Go From Here?

You can download the final project using the link at the top or bottom of this tutorial.

In this tutorial, you got started using both Travis CI and Jenkins. Travis CI is a super-easy pathway to getting started with CI, so no more excuses! Jenkins takes more effort to set up, but there’s no additional cost for private repositories, and it’s more flexible than Travis CI.

Here are some useful references for Travis CI, Jenkins and fastlane:

There are many other CI services or products. The fastlane documentation includes a short list of those that integrate with fastlane.

Beyond CI are the CDs: Continuous Delivery, where you automate your release process so you’re always ready to deploy changes to your users, and Continuous Deployment, where you actually deploy every change automatically. You can move on to CD with a combination of Jenkins pipelines and fastlane. Or you might find Travis CI’s deploy command is sufficient — for example, to automatically deploy to Heroku.

Feel free to add comments or questions in the forum below!