CI and CD are very popular words when we talk about modern development practises.
CI stands for Continuous Integration, it is engineering practise of frequently integrating isolated changes to a large code & test them simultaneously.
CD means Continuous Development or Continuous Delivery in which build software is always in a state of production or deploy.
Benefit of Continuous Integration/ Continuous Development/ Continuous Delivery
- Less bugs are passed to production as mostly are captured during automated testing.
- Generating a build is easy than earlier.
- Developer will get to know about any bug in building stage & can work on fixing then before moving it to another stage.
- QA team will get more time to improve the product quality instead of only testing the product.
- It is easy to make small changes & encourage team to finish it fast.
- Released builds are less risky & can be easily fixed.
- Customer can notice continuous improvement & quality of product on everyday basis.
Implement CI/CD in iOS using Fastlane
# Using RubyGems
sudo gem install fastlane -NV
# Alternatively using Homebrew
brew cask install fastlane
Setup fastlane in project directory
This command will create 2 text file in your project: Appfile & Fastfile
Appfile: It store very important information which are used by fastlane tool like Bundle In, Apple ID, iTunes Connect Team Id, Developer Team Id to build & deploy your app to App store or in TestFlight.
#The bundle identifier of your app
# Your Apple email address
# You can uncomment the lines below and add your own
# team selection in case you're in multiple teams
# To select a team for App Store Connect use
itc_team_name "Company Name"
Here are process which we do for beta or App store realese
lane :beta do
lane :release do
We have define 2 lanes for beta & app store release.
In terminal, inside your project root directory. Run this command to release your build on iTune connects.
fastlane release #release is the lane which we created in fastfile
Inside Lanes we define actions which we want to perform. If any step fails in lane then process will stop there.
In beta lane, we are increasing the build number, building IPA file and uploading to test flight.
In release lane, we are generating screenshots, building IPA file and uploading to iTune Connects.
Generating Provisioning Profile & Code Signing Certificate
Now, I will create a new lane named codeSign.
produce: This command will create App ID on developer accounts & App Account on iTune Connects.
cert: It will generate iPhone Developer & Distribution certificate for your app.
sigh: It will generate provisioning profile for app store.
lane :codeSign do
If you already have metadata & screenshots on iTune Connect then run this command on terminal to get the same.
fastlane deliver init -username firstname.lastname@example.org --team_id 12345678
deliver: This will help you to update your existing metadata & screenshots on iTune Connects.
fastlane is the easiest way to automate beta deployments and releases for your iOS and Android apps. It handles all tedious tasks, like
- Generating screenshots & metadata
- Dealing with code signing & provisioning profile
- Build your app
- Releasing your application
Advantage of Using Fastlane
- Save hours every time you push a new release to the store or beta testing service
- Supports iOS, Mac, and Android apps
- 100% open source
- Easy setup assistant to get started in a few minutes
- Never remember any commands any more, just fastlane
- Extend and customise fastlane to fit your needs, you’re not dependent on anyone
I hope you enjoyed this CI/CD with fastlane tutorial, and I look forward to seeing how you use fastlane in your deployment pipeline. If you have any questions or comments, please discussion below!
Stay connected to Codewave for more such insights and feel free to reach us at email@example.com or +91 8971824910. If comfortable you may drop by at 1st Floor, Shree Chambers, #307, Outer Ring Rd, Banashankari 3rd Stage, Bengaluru, Karnataka 560085. Thanks for taking out time to read this article. We hope it enriched your existing knowledge. Do let us know your views, by sending an email to firstname.lastname@example.org.