Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CI for Android: why and how to do it?

CI for Android: why and how to do it?

C4c3b17872daf877abf5f767bc399b37?s=128

Andrii Chubko

July 29, 2021
Tweet

Transcript

  1. CI for Android: why and how to do it? 1

  2. Andrii Chubko Android Developer @ Uptech 2

  3. Plan 1. What is CI (Continuous Integration) and what do

    we need it for 2. How to choose a CI solution 3. How to set up your first CI system 4. Optimizing CI 3
  4. 4 CI process Setting up CI Optimizing CI 01. WHAT

    IS CI Choosing CI
  5. 5 Evolution of building APKs Setting up CI Optimizing CI

    01. WHAT IS CI Choosing CI
  6. ▪ Endless discussions about the “right” code style ▪ “Dead”

    tests that are created but not run ▪ Manually building and sending APKs to QAs ▪ Access keys are “safely” scattered across computers and notes ▪ Manually updating info on all the services you use – Jira, Github, Play Store etc. 6 Problems that CI solves Setting up CI Optimizing CI 01. WHAT IS CI Choosing CI
  7. 7 Jira notification example Setting up CI Optimizing CI 01.

    WHAT IS CI Choosing CI
  8. 8 Slack notification example Setting up CI Optimizing CI 01.

    WHAT IS CI Choosing CI
  9. ▪ Processes automation – saving time and effort ▪ Early

    problem detection ▪ Confidence in code and product quality ▪ Easier to release and do it more frequently 9 Benefits of CI Setting up CI Optimizing CI 01. WHAT IS CI Choosing CI
  10. ▪ Setting up and supporting CI takes time ▪ Additional

    waiting time for CI checks to run 10 CI drawbacks Setting up CI Optimizing CI 01. WHAT IS CI Choosing CI
  11. ▪ Hosted vs On-premises ▪ Compatibility with the services you’re

    using ▪ Cost ▪ Support and popularity 11 Choosing a CI solution: what to consider? What is CI Setting up CI Optimizing CI 02. CHOOSING CI
  12. ✅ Flexible ✅ Large ecosystem (open source) ❌ Difficult to

    support, takes a lot of time and effort ❌ Painful to use 12 Jenkins What is CI Setting up CI Optimizing CI 02. CHOOSING CI
  13. ✅ Flexible ✅ Large ecosystem (open source) ❌ Difficult to

    support, takes a lot of time and effort ❌ Painful to use 13 Jenkins What is CI Setting up CI Optimizing CI 02. CHOOSING CI
  14. ✅ Easy to set up ✅ Lots of pricing plans,

    free ones available ❌ Dependency on the service provider 14 What is CI Setting up CI Optimizing CI 02. CHOOSING CI
  15. ▪ Fastlane – simplified release configuration (beta, public), launching tests

    and gathering results ▪ Gradle Play Publisher – publishing to Google Play 15 Additional tools What is CI Setting up CI Optimizing CI 02. CHOOSING CI
  16. CI workflow – a combination of scenarios that define the

    order of executing tasks. 16 Creating a workflow: what is it? What is CI Optimizing CI 03. Setting up CI Choosing CI
  17. ▪ Git workflow – types of branches, commit messages format

    ▪ Which tests to run and when ▪ Delivering the app for QA / release ▪ What data needs to be sent to QAs / users 17 Creating a workflow: what to consider? What is CI Optimizing CI 03. Setting up CI Choosing CI
  18. 18 Workflow, tests, services, releases ??? What is CI Optimizing

    CI 03. Setting up CI Choosing CI
  19. 19 Setting up a workflow with CircleCI What is CI

    Optimizing CI 03. Setting up CI Choosing CI
  20. 20 Configuring Android environment config.yml – YAML format What is

    CI Optimizing CI 03. Setting up CI Choosing CI
  21. 21 Configuring Android environment What is CI Optimizing CI 03.

    Setting up CI Choosing CI
  22. 22 Configuring workspace What is CI Optimizing CI 03. Setting

    up CI Choosing CI
  23. 23 Building debug APK What is CI Optimizing CI 03.

    Setting up CI Choosing CI
  24. 24 Job in our config file Job in our CI

    tool What is CI Optimizing CI 03. Setting up CI Choosing CI
  25. 25 Running tests What is CI Optimizing CI 03. Setting

    up CI Choosing CI
  26. 26 Describing a workflow What is CI Optimizing CI 03.

    Setting up CI Choosing CI
  27. 27 Workflow in a config file Workflow in our CI

    tool What is CI Optimizing CI 03. Setting up CI Choosing CI
  28. 28 CI before optimization 04. OPTIMIZING CI What is CI

    Choosing CI Setting up CI
  29. ▪ Execution time ▪ Resources used ▪ Cost 29 CI:

    what are we optimizing? 04. OPTIMIZING CI What is CI Choosing CI Setting up CI
  30. ▪ Purchasing a pricing plan with more resources ▪ Parallelization

    ▪ Optimizing memory settings in Gradle ▪ Caching ▪ Building APKs instead of bundles (for non-Google Play releases) ▪ Building specific Android build variants (for example, using buildDebugProd instead of buildDebug) 30 Examples of CI optimizations 04. OPTIMIZING CI What is CI Choosing CI Setting up CI
  31. 31 Setting up caching 04. OPTIMIZING CI What is CI

    Choosing CI Setting up CI
  32. 32 Using cache when building APK 04. OPTIMIZING CI What

    is CI Choosing CI Setting up CI
  33. 33 Using cache when running tests 04. OPTIMIZING CI What

    is CI Choosing CI Setting up CI
  34. 34 Without caching With caching 04. OPTIMIZING CI What is

    CI Choosing CI Setting up CI
  35. 35 CI after optimizations 04. OPTIMIZING CI What is CI

    Choosing CI Setting up CI
  36. ▪ Config file used in the presentation ▪ CircleCI page

    of the project used in presentation ▪ Theoretical articles from Atlassian ▪ CircleCI for Android - official docs ▪ Caching using multiple files with CircleCI ▪ Settings up Firebase Test Lab with CircleCI ▪ Advanced example of CircleCI config ▪ Overview of various Git flows and their connection to CI Additional resources 36
  37. 37 Thanks! Andrii Chubko Facebook, LinkedIn uptech.team