Building CI_CD for Mobile Development.pptx

GurzuInc
Building CI/CD for Mobile
Development
● Nihal Shrestha
Gurzu Confidential
2
CI/CD
Continuous integration (CI) and continuous delivery
(CD) embody a culture, set of operating principles,
and collection of practices that enable application
development teams to deliver code changes more
frequently and reliably.
Gurzu Confidential
3
Mobile Tech Stack
React Native
React Native is a JavaScript framework
for writing real, natively rendering
mobile applications for iOS and
Android.
Two ways we can start building mobile
apps using React Native:
● Expo [Previously Used]
● Core React Native [Currently using]
Gurzu Confidential
Expo is a set of tools built and a wrapper around React Native.
● No need to setup tedious environment setup like Android Studio and Xcode.
● No need to have Mac for iOS development.
● Able to start building apps within a couple of minutes.
● Provides their own servers for building both Android and iOS apps. [Pipeline]
Limitations (Why we needed to shift to Core RN):
● Less control over both platforms.
● Limited number of native features inbuilt within expo. [like bluetooth services]
● Similarly, integrating with third parties native libraries that are not yet
supported by expo. [Esewa SDK, Khalti SDK]
● Larger build sizes.
4
Expo
Journey from Expo to Core RN
Fig 1: Expo
Fig 2: React Native
Gurzu Confidential
Expo provided us their own build server, where we used to build our apps
[Android & iOS]. The process of building and deploying was fairly easy and
faster.
But,
As we shifted to Core RN, each build became dependent upon dev’s local
machine. So, as the project moved ahead, developer had to build and
deploy every new release from their own system and, also the whole
development team became dependent upon it.
5
So, Why we didn’t need CI/CD previously and Why do
we need it now?
Gurzu Confidential
One key point to be noted before diving into the detailed
explanation of CI/CD:
● iOS apps can only be build on macOS system. i.e, We
somehow needed to make our CI system around a macOS
computer.
○ Meaning, We will be using an iMac as a build server for both Android and iOS.
6
Gurzu Confidential
7
General Flow Diagram
Gurzu Confidential
● Fastlane:
○ Fastlane is the easiest way to automate deployments and releases for your iOS and
Android apps. It handles all tedious tasks, like dealing with code signing, and releasing
your application.
○ All we have to do is configure a Fastfile that defines the steps needed to build and deploy
your mobile application.
○ Fastfile is written in ruby.
● Gitlab Runner:
○ GitLab Runner is an application that works with GitLab CI/CD
to run jobs in a pipeline.
○ A GitLab runner clones the project, reads the gitlab-ci.yml file
and do what it is instructed to do.
○ In our case, Gitlab runner is installed and used in
macOS(iMac).
[Supported OS: Linux, Windows, macOS]
8
Gurzu Confidential
● Firebase App Distribution:
Firebase App Distribution makes distributing your apps to trusted testers and teammates
painless. By getting your apps onto testers' devices quickly, you can get feedback early and
often.
Steps:
- Upload your latest pre-release build
- Invite testers
- Get feedback
- Release new beta builds
Firebase app distribution is fully supported with Fastlane. So, all of the task can be
automated using Fastlane ( from uploading the build files to sending an invitations ).
● Detailed Architectural Diagram for each platform:
9
Gurzu Confidential
10
Gurzu Confidential
● Main Steps to follow for Android (One time setup):
○ Fastfile configuration. Set of instructions for running build.
○ Certificate generation. (Keystore using keytool)
■ Key store password
■ Key alias
■ Key password
○ Generating firebase token.
All of these keys needs to be configured as an ENV variable in Gitlab CI which will be
used during build process.
11
Gurzu Confidential
12
Gurzu Confidential
● Main Steps to follow for iOS (One time setup):
○ Fastfile configuration. Set of instructions for running build.
○ Certificate generation using MATCH.
■ Type
■ App identifier
■ Keychain password
■ Team id
■ Profile name
○ Generating firebase token.
All of these keys needs to be configured as an ENV variable in Gitlab CI which will be
used during build process.
13
Gurzu Confidential
14
Results
We are currently achieving the following build time(avg):
1. Android: ~ 8 min
2. iOS: ~ 20 min
Note: Build time may vary according to the project requirements.
Gurzu Confidential
15
Different Mobile CI available in the market
1. Android: ~ 8 min [Gurzu]
2. iOS: ~ 20 min [Gurzu]
Gurzu Confidential
16
Thank You
1 of 16

More Related Content

Recently uploaded(20)

Building CI_CD for Mobile Development.pptx

  • 1. Building CI/CD for Mobile Development ● Nihal Shrestha
  • 2. Gurzu Confidential 2 CI/CD Continuous integration (CI) and continuous delivery (CD) embody a culture, set of operating principles, and collection of practices that enable application development teams to deliver code changes more frequently and reliably.
  • 3. Gurzu Confidential 3 Mobile Tech Stack React Native React Native is a JavaScript framework for writing real, natively rendering mobile applications for iOS and Android. Two ways we can start building mobile apps using React Native: ● Expo [Previously Used] ● Core React Native [Currently using]
  • 4. Gurzu Confidential Expo is a set of tools built and a wrapper around React Native. ● No need to setup tedious environment setup like Android Studio and Xcode. ● No need to have Mac for iOS development. ● Able to start building apps within a couple of minutes. ● Provides their own servers for building both Android and iOS apps. [Pipeline] Limitations (Why we needed to shift to Core RN): ● Less control over both platforms. ● Limited number of native features inbuilt within expo. [like bluetooth services] ● Similarly, integrating with third parties native libraries that are not yet supported by expo. [Esewa SDK, Khalti SDK] ● Larger build sizes. 4 Expo Journey from Expo to Core RN Fig 1: Expo Fig 2: React Native
  • 5. Gurzu Confidential Expo provided us their own build server, where we used to build our apps [Android & iOS]. The process of building and deploying was fairly easy and faster. But, As we shifted to Core RN, each build became dependent upon dev’s local machine. So, as the project moved ahead, developer had to build and deploy every new release from their own system and, also the whole development team became dependent upon it. 5 So, Why we didn’t need CI/CD previously and Why do we need it now?
  • 6. Gurzu Confidential One key point to be noted before diving into the detailed explanation of CI/CD: ● iOS apps can only be build on macOS system. i.e, We somehow needed to make our CI system around a macOS computer. ○ Meaning, We will be using an iMac as a build server for both Android and iOS. 6
  • 8. Gurzu Confidential ● Fastlane: ○ Fastlane is the easiest way to automate deployments and releases for your iOS and Android apps. It handles all tedious tasks, like dealing with code signing, and releasing your application. ○ All we have to do is configure a Fastfile that defines the steps needed to build and deploy your mobile application. ○ Fastfile is written in ruby. ● Gitlab Runner: ○ GitLab Runner is an application that works with GitLab CI/CD to run jobs in a pipeline. ○ A GitLab runner clones the project, reads the gitlab-ci.yml file and do what it is instructed to do. ○ In our case, Gitlab runner is installed and used in macOS(iMac). [Supported OS: Linux, Windows, macOS] 8
  • 9. Gurzu Confidential ● Firebase App Distribution: Firebase App Distribution makes distributing your apps to trusted testers and teammates painless. By getting your apps onto testers' devices quickly, you can get feedback early and often. Steps: - Upload your latest pre-release build - Invite testers - Get feedback - Release new beta builds Firebase app distribution is fully supported with Fastlane. So, all of the task can be automated using Fastlane ( from uploading the build files to sending an invitations ). ● Detailed Architectural Diagram for each platform: 9
  • 11. Gurzu Confidential ● Main Steps to follow for Android (One time setup): ○ Fastfile configuration. Set of instructions for running build. ○ Certificate generation. (Keystore using keytool) ■ Key store password ■ Key alias ■ Key password ○ Generating firebase token. All of these keys needs to be configured as an ENV variable in Gitlab CI which will be used during build process. 11
  • 13. Gurzu Confidential ● Main Steps to follow for iOS (One time setup): ○ Fastfile configuration. Set of instructions for running build. ○ Certificate generation using MATCH. ■ Type ■ App identifier ■ Keychain password ■ Team id ■ Profile name ○ Generating firebase token. All of these keys needs to be configured as an ENV variable in Gitlab CI which will be used during build process. 13
  • 14. Gurzu Confidential 14 Results We are currently achieving the following build time(avg): 1. Android: ~ 8 min 2. iOS: ~ 20 min Note: Build time may vary according to the project requirements.
  • 15. Gurzu Confidential 15 Different Mobile CI available in the market 1. Android: ~ 8 min [Gurzu] 2. iOS: ~ 20 min [Gurzu]