fbpx
Home / Continuous Integration / Master Continuous Integration and Delivery as Android Developer

Master Continuous Integration and Delivery as Android Developer

Introduction

Hi my friends and welcome to new article about continuous integration and delivery for android development. In this article I am going to talk about continuous Integration and delivery form Android Development Perspective so what is Continuous Integration and Delivery?

“Continuous Integration(CI) is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily – leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.” Martin Fowler

So in a simple way CI is a software practice helps the team to build high quality software through merging their changes into a solid , clean  tested and robust codebase.When team follows this approach we can guarantee that  we have codebase that does not break our predefined rules and standard in coding because before every merge to master branch for example the full cycle of CI must be done successfully.So what about Continuous Delivery or CD?

“Continuous Delivery is a software development discipline where you build software in such a way that the software can be released to production at any time.”  Martin Fowler

Let’s explain some important point here and this is the key difference between continuous delivery and continuous deployment so what is this difference?

well, the key point here is you may publish your code to production and you may not do that so this step is manual action but in continuous deployment(CP) you do not need to do this because the process is automatic.

Why Do we need to learn CI/CD  for Android Development?

well, let’s discuss this from three different perspectives

  • Personal Perspective : if you are a person who does not like to do many things especially if those tasks are repetitive and tedious and you are so lazy like me so this CI/CD will helps you a lot
  • Developer perspective : if want to maximize and evaluate your time to be more productive in work so you need to learn how to build your CI/CD from now . let me tell you small story ,ok let’s imagine your normal day as android developer and you are now working on a task or bug or whatever and your team lead comes to you and tells you “hi  man , I need a new  APK right now to test some critical bugs in production” so how you will manage this situation although you are focusing on your work . so if you have CI/CD now it will save your life from this big interruption because you just need to trigger your CI server to send build form production to your team and you still working.
  • Business perspective: the main goal for business team is the reduction for the cost and money and maximize the revenue so in most time money is not the big deal ,you need to ship fast so if you convinced them to invest in this CI/CD pipeline they will get their goal

Jenkins, Circle CI,Gitlab CI ,bla…bla…bla which One  should I use?

well, there is no direct answer for this question, for example let’s assume for example that your backend team use Travis CI for example and the mobile team needs to builds their own CI/CD pipeline so in this situation you may choose to go with Travis because your company already invested money in this service and it can be used for Mobile too. In Other situation for example you need to build you own customization for your Devops and you have already your server so Jenkins may be good choice for you because it is open source and have big community and you can host it by your server

 

Android CI/CD

here, I will show you the use case  for CI/CD for android project based on kotlin. This CI/CD pipeline will use some tools like

  • Gitlab CI as CI server
  • Fastlane for Continuous Delivery
  • Detekt for static code analysis for Kotlin language
  • Fabric Beta from crachlatics
  • Google play
image: unitedclassifiedsapps/gitlab-ci-android-fastlane

cache:
paths:
- .m2/
- .gradle/

variables:
ANDROID_COMPILE_SDK: "28"
ANDROID_BUILD_TOOLS: "28.0.2"
ANDROID_SDK_TOOLS: "4333796"


before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew

stages:
- build
- test
- static_analysis
- fabric
- prod


build:
stage: build
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/


unitTests:
stage: test
script:
- ./gradlew test


static_analysis:
stage: static_analysis
script:
- ./gradlew lint
- ./gradlew detekt
artifacts:
paths:
- app/build/reports/


fabricBeta:
stage: fabric
script:
- fastlane beta
only:
- master


playstore:
stage: prod
script:
- fastlane deploy
only:
- master


Now if you want to learn more about CI/CD for android development, I published course on Udemy that will help you to master and build your CI/CD from scratch step by step so you can use this
9.9$ coupon

About admin

2 comments

  1. Informative article.

  2. You should be a part of a contest for one of the greatest blogs online. I am going to recommend this site!

Leave a Reply

Your email address will not be published. Required fields are marked *