As a continuation of Part 5: Project Setup
How many times do you need to build your app for DEV, QA, STAGE, PREPROD, PROD, etc. environments?
So much time is wasted on building an .ipa file, uploading it to Crashlytics (HockeyApp, TestFlight, etc.), notifying the QA team about the latest build, etc.
To my mind, to be successful means spending your time on actual work, e.g. writing code. Setting up a continuous integration and delivery process has become critical nowadays, as it helps you to squash out bugs early in the development cycle and saves a lot of developer time.
Ok, blah blah blah. Let’s read some theory about CI/CD.
Continuous Integration (CI) is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.
There are a lot of tools available that can help you with continuous integration of iOS apps like fastlane, Xcode Server, Jenkins, Travis and others.
We chose fastlane + Jenkins.
Continuous Delivery (CD) is a software engineering approach in which teams produce software in short cycles, ensuring that the software can be reliably released at any time. It aims at building, testing, and releasing software faster and more frequently.
Why use Continuous Delivery?
1. Save days of preparing app submissions, uploading screenshots and releasing the app.
2. Colleague on vacation and a critical bugfix needs to be released? Don’t rely on one person releasing updates.
3. Increase software quality and reaction time with more frequent and smaller releases.
Let’s automate your builds
Your ruby version must be 2.4.0 or newer.
- Update ruby
- Install fastlane
Fastlane: Create Simple Configuration
That is, you can automate your builds just using this command.
- You have successfully added fastlane using a template.
Jenkins: Add Job
I won’t tell you how to install Jenkins. You can go to the official site for this info.
We start with Job creation.
- Create a job and add the “Execute shell” step to build section.
Jenkins job. Execute shell step in Build section.
You have the fastlane template integrated into your project. That can work without any CI tools such as Jenkins, Travis, etc. That only required fastlane gem and the correct certificates on the build machine.
Also, we integrated fastlane work as a Jenkins job. It is easier to work with the Jenkins panel instead of a terminal, is it not?
Of course, you can create your fastlane template using the command “fastlane init”, then add new steps to your fastlane lane or Jenkins job. Extended configuration will be explored in a separate series: “Continuous integration and Delivery processes”.
Remember, spend some hours on automation once and you will be happy for all the coming days/months/years you spend on the project.
This was a small guide about Build automation using fastlane and Jenkins.
Maxim Vialykh is CactusSoft iOS Tech Lead.
Programming languages: Swift, Objective-C, Java
Technologies and Platforms: iOS, Android, Windows Phone, Amazon S3, Google Cloud, Google APIs, Facebook APIs
Frameworks: PhoneGap, Xamarin
Tools: Invision, SVN, Git, PhoneGap, Titanium, Xamarin, Sketch, xCode, IntelliJ IDEA