Slide 1

Slide 1 text

The Art of Mobile DevOps : Android v2.0 Improving your team’s Android Build Performance & Productivity through Automation. @thedancercodes ~ Roger Taracha ~

Slide 2

Slide 2 text

About Me ● Software Engineer. ● Python, JS, Android ● Dance Choreographer. ● MC/ Hypeman. ● Traveling. ● Community Development. ● DIY Hobbyist. ● Learning Facilitator/ Technical Team Lead - Andela

Slide 3

Slide 3 text

We are hiring!

Slide 4

Slide 4 text

What inspired this talk? The Effective Engineer: How to Leverage Your Efforts In Software Engineering to Make a Disproportionate and Meaningful Impact.

Slide 5

Slide 5 text

What is DevOps? DevOps is derived from two words: development and operations. As the word suggests, it is a set of practices in a process of developing software and managing operations tasks. DevOps is not just a set of practices, but also a way of working in the software development industry; it’s a cultural change in the way development and operations work together. https://devops.com/metrics-devops/

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

DevOps focusses on a change in IT Culture

Slide 9

Slide 9 text

Why DevOps? ● Devops enables quick solutions in the case of a technical glitch. ● Contributes to team health, individual satisfaction. ● Time efficiency & Management. ● Devops gives us the facility & flexibility to invent & focus on actual business needs instead of taking hours/ weeks/ months of operational tasks. ● People get to focus on what they are good at and get instant feedback. ● To deploy often, you can’t break what’s already there, you have to complement it.

Slide 10

Slide 10 text

Mobile DevOps ● Main difference between DevOps and Mobile DevOps is the tooling required to achieve the process. ● There are alot of things to consider about Deployment and Feedback in Mobile App Development: ● Testing & Quality checking on a wide range of mobile devices with different hardware configurations and OS versions. ● Continuous Feedback and Continuous Development have become the most important thing in Mobile App Development. ● Example of Feedback: ○ What scenarios make the app crash on a user’s phone? ○ Which screen users spend most time on? ○ What activities users don’t perform in the app?

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Focus Areas It is impossible to speak about DevOps without mentioning the following areas: ● Continuous Integration. ● Continuous Delivery/Deployment.

Slide 13

Slide 13 text

What is CI? ● Continuous Integration is a development practice that requires developers to integrate code into a shared repository several times a day. ● Each checkin is then verified by an automated build, allowing teams to detect problems early.

Slide 14

Slide 14 text

Why CI? ● Deliver faster & higher quality. ● Your product is always ready to deploy. ● Capture institutional knowledge in tests. ● Automation hugely improves productivity. ● Multiply your impact

Slide 15

Slide 15 text

Delivery vs Deployment ● Continuous Delivery => Software can be deployed to customers at any time with the "push of a button" (i.e. by running a deployment script). ● Continuous Deployment => Software is automatically deployed to customers once it passes through the continuous integration system.

Slide 16

Slide 16 text

Case Study Converge Android - An Internal Product We needed a way to ensure that we can deploy the product quickly and have a working product at any point in our development lifecycle.

Slide 17

Slide 17 text

Team Structure & Tools ● Current Team Structure: ○ Backend ○ Frontend ○ Mobile ○ DevOps ● Getting the team balance at the beginning was a bit of a challenge. ● Lots of communication and stakeholder management was needed to make things work. Tools: ● Github Enterprise ● Code Climate ● Circle CI ● Static code analysis tools ○ PMD, Checkstyle, Findbugs, Android Lint ● Gradle - Build Scans ● Flank - a massively parallel Android and iOS test runner for Firebase Test Lab. ● Fastlane

Slide 18

Slide 18 text

CI Pipeline

Slide 19

Slide 19 text

Code Climate An open, extensible platform for automated code review for test coverage, complexity, duplication, security, style, and more.

Slide 20

Slide 20 text

Static Analysis Tools ● Improving Code Quality & Syntax of your Android Code ● Poor code quality and technical debt inevitably lead to developer productivity losses, missed deadlines, and a higher bug rate. ● Complements code reviews through peers. ● Static code analysis tools help you enforce coding standards and uncover bad coding practices and potential bugs. ● Gradle offers a wide range of standard plugins for you to pick and choose from. ● NOTE: We use pre-commit hooks with these tools.

Slide 21

Slide 21 text

Gradle ● Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. ● Gradle and the Android plugin run independent of Android Studio. This means that you can build your Android apps from within Android Studio, the command line on your machine, or on machines where Android Studio is not installed (such as continuous integration servers). ● NOTE: The output of the build is the same whether you are building a project from the command line, on a remote machine, or using Android Studio.

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Output: APK Develop = Sends APK to Slack Staging and Master?!

Slide 25

Slide 25 text

Enter Continuous Delivery/ Deployment

Slide 26

Slide 26 text

Delivery vs Deployment ● Continuous Delivery => Software can be deployed to customers at any time with the "push of a button" (i.e. by running a deployment script). ● Continuous Deployment => Software is automatically deployed to customers once it passes through the continuous integration system.

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

NOTE: We use Staging to push to Alpha/ Beta Channel and Master to push to Production. Might not be ideal but works for us. :)

Slide 30

Slide 30 text

Enter Fastlane ● Fastlane is a tool that allows you to automate & optimise your development and release/ deployment process. ● Saves time automating tasks so you can spend time on the things you care about most. ● Open sourced: ○ Available on GitHub ● Fastlane helps you automate the tedious tasks: ○ Testing ○ Building ○ Signing ○ Deploying your app

Slide 31

Slide 31 text

Fastlane Beta Deployment Typical Beta Deployment: ● Version Bump ● Commit and Push ● Build ● Generate signed APK ● Upload ● Add Release Notes ● Distribute NOTE: ● Fastlane reduces all the above to just the push of a button.

Slide 32

Slide 32 text

Fastfile ● Fastfile contains all the info required to deploy your app: ○ Defines what steps run & in what order fastlane runs them. ○ A group of steps is called a lane. ○ To run it: ● $ fastlane beta ● NOTE: ○ If one of these steps fail, the whole lane fails.

Slide 33

Slide 33 text

Fastlane demo: Deploy APK to slack Click link below to view the video of the fastlane demo: ● https://youtu.be/rI1sHu1 I0WI

Slide 34

Slide 34 text

Tips to Reduce your Build Times... ● General Optimizations: ○ Using up-to-date library versions ● Build Scans: ○ A persistent record of what happened in a build. ○ A great debugging and collaboration tool. ● Modularization: ○ Process of taking a big single module app and splitting it into multiple modules.

Slide 35

Slide 35 text

General Optimizations Before getting into the specifics, let’s make sure you have the basics down: ● Latest Gradle version ● Latest AGP version ● Latest Kotlin version ● Don’t disable the Gradle Daemon ● Make sure org.gradle.caching =true in your gradle.properties file ● If possible, enable org.gradle.parallel too, especially if you have multiple modules.

Slide 36

Slide 36 text

Gradle: Build Scans ● A build scan is a shareable and centralized record of a build that provides insights into what happened and why. ● In your terminal, run this command: $ ./gradlew build --scan

Slide 37

Slide 37 text

Modularization ● Process of taking a big single module app and splitting it into multiple modules. ● Extracting rarely-changed code reduces build time. ● Decoupled code => Faster incremental compilation ● Intermodule dependencies increase build time. ○ If you have spaghetti code, where everyone is referencing everyone, incremental compilation can’t help that much.

Slide 38

Slide 38 text

“There is no silver bullet when it comes to optimizing your build performance, you have to do the work & find what works for you.” Boris Fraber (Google)

Slide 39

Slide 39 text

Reference Material: ● Gradle Performance Guide: ○ https://guides.gradle.org/performance/ ● Android Performance Guide: ○ https://developer.android.com/studio/build/optimize-your-build ● Plugin Development Guide: ○ https://guides.gradle.org/implementing-gradle-plugins/ ● Structuring build logic guide: ○ https://docs.gradle.org/current/userguide/organizing_gradle_projects.html ● DIY Gradle build optimization ○ https://proandroiddev.com/gradle-perf-9c11b640f329 ● Automating Your App's Release Process Using Fastlane ○ https://www.youtube.com/watch?v=scfOk5SgrKU

Slide 40

Slide 40 text

“The result of an optimized & reliable BUILD PERFORMANCE is FASTER feedback cycles and IMPROVED efficiency of your team.”

Slide 41

Slide 41 text

“Developers should always feel confident about investing in the right area, based on data.” Importance of backlog in Mobile DevOps

Slide 42

Slide 42 text

Thank you @thedancercodes TheDancerCodes TheDancerCodes