Loading...
Home
  • Tech Blogs
  • Videos
  • Conferences
    • Droidcon News
    • Upcoming Conferences
    • Become a Partner
    • Past Events
    • Keep Me Informed
    • Diversity Scholarships
  • Community
    • droidcon Team
    • How to Hold a Droidcon
  • Android Careers
Sign In

Global CSS

 

Make CI pipeline faster for Android with modular checks on Github Actions

 

 
Yasin Kaçmaz
I value ideas that can touch and simplify daily lives. I am passionate about mobile technologies, UI and UX trends.
Published: Marh 22, 2021
Tweet
Share
 
 

Image from Unsplash

 

Imagine having a modular Android app. Different teams working on different modules without even touching another module. We will make the CI pipeline faster for those team members. In the below images, you are seeing a modular app structure and relations between modules.

 

 

 

feature1 and feature2 modules are the main modules and they won't affect each other when a change happens inside them. This means we can run checks for only changed modules and if they can build, our app can build too without breaking the existing code.

But when util or common module changed we don't know sure whether it will break feature1 or feature2 because those modules used in multiple modules. It is not safe to run modular checks on common modules. Because you can build them safely but you can break the dependent module functionality.

Enough with talking! In this section, we will detect changed modules and run modular checks with Github Actions. Here is an example workflow file:

 

 

At the Check changed modules step we are using a beautiful action from dorny: paths-filter. It uses picomatch library under the hood. Here is our file_filter_config:

 

 

In this config, we are telling picomatch: If anything changed inside the feature1 folder mark them as feature1 and same as feature2. If anything changed inside a folder rather than feature1 and feature2 mark them as common.

Then based on changed files dorny/paths_filter action will give us an output like this [feature1,feature2,common]. Then we set an environment variable named changed_modules with stringifying that output.

Now we know which modules changed. We will create a Powershell script with some if-else logic to determine which gradle task to run. Here is our script:

 

 

This script will give us an output named gradleTask. It can be equal to feature1:lintDebug, feature2:lintDebug or for common just lintDebug.

Now we know which modular gradle task to run. We will run the task with: ./gradlew ${{steps.gradle_task_name.outputs.gradleTask}} — — continue

This is a generic step and you can run different modular checks by changing env: taskvariable at the start of the workflow. For example, you can have modular ktlint, detekt, unitTest, lint tasks.

In our CI pipeline, the longest task was Android Lint which was taking around 16–17 minutes.
With modular checks, we reduced lint duration for feature1 module to 11–12 minutes and feature2 module to 4–5 minutes.
We still run the usual lint task when you change a common module or multiple modules, but this was the case before.

Thanks for reading. Stay safe, and have a nice day!

 

 

 

 

Tags: Android, Github Actions, Ci Cd Pipeline, Android App Development, AndroidDev

 

View original article at: 


 

Originally published: March 08, 2021

Android News
Getting… your BottomSheetScaffold working on Jetpack Compose Beta 03
Getting… your BottomSheetScaffold working on Jetpack Compose Beta 03

By Carlos Mota

It’s Monday, no releases this week, and… there’s a new version of Jetpack Compose — beta 03—available. What a perfect time to just increment 02 to 03 and see what’s new. The API is (almost) final so after updating from alpha to beta there weren’t any big changes to do. However, and remember that’s still in development, there’s always something that I need to update. 

By ProAndroidDev -
Android News
Noisy Code 🗣 With Kotlin Scopes
Noisy Code 🗣 With Kotlin Scopes

By Chetan Gupta

Scopes make your code more readable? think again... You are going to encounter these scope functions namely let, run, apply, also, within every Kotlin codebase, along with all the mischievous ways developers exploit their usage from the way they were intended for. Let see how popular opinion on those ends up just as a code noise.

By ProAndroidDev -
Android News
Improving Android DataBinding with Bindables library
Improving Android DataBinding with Bindables library

By Jaewoong Eum

DataBinding is one of the most important factors for MVVM architecture. The basic concept of DataBinding is to link the view and view model via observer patterns, properties, event callbacks, etc. Linking and automating communication between the view via the bound properties or something in the view model has a lot of benefits in the MVVM architecture concept.

By ProAndroidDev -
Android News
KMM QuickStart Guide
KMM QuickStart Guide

By Mayank Kharbanda

Kotlin Multiplatform (KMP) is a code-sharing technology that allows us to use the same code for different platforms whether it’s JVM, Android, iOS, watchOS, tvOS, Web, Desktop, or WebAssembly. In this article, we will use Kotlin Multiplatform Mobile (KMM) which is a subset of KMP with the focus on providing better tooling and support for sharing code on mobile platforms i.e. Android and iOS.

By ProAndroidDev -
droidcon News

Tech Showcases,

Developer Resources &

Partners

/portal/rest/jcr/repository/collaboration/Groups/spaces/droidcon_hq/Documents/public/home-details/EmployerBrandingHeader
EmployerBrandingHeader
https://jobs.droidcon.com/
/portal/rest/jcr/repository/collaboration/Groups/spaces/droidcon_hq/Documents/public/employerbranding/jobs-droidcon/jobs.droidcon.com
jobs.droidcon.com

Latest Android Jobs

http://www.kotlinweekly.net/
/portal/rest/jcr/repository/collaboration/Groups/spaces/droidcon_hq/Documents/public/employerbranding/kotlin-weekly/Kotlin Weekly
Kotlin Weekly

Your weekly dose of Kotlin

https://proandroiddev.com/
/portal/rest/jcr/repository/collaboration/Groups/spaces/droidcon_hq/Documents/public/employerbranding/pad/ProAndroidDev
ProAndroidDev

Android Tech Blogs, Case Studies and Step-by-Step Coding

/detail?content-id=/repository/collaboration/Groups/spaces/droidcon_hq/Documents/public/employerbranding/Zalando/Zalando
/portal/rest/jcr/repository/collaboration/Groups/spaces/droidcon_hq/Documents/public/employerbranding/Zalando/Zalando
Zalando

Meet one of Berlin's top employers

/detail?content-id=/repository/collaboration/Groups/spaces/droidcon_hq/Documents/public/employerbranding/Academy for App Success/Academy for App Success
/portal/rest/jcr/repository/collaboration/Groups/spaces/droidcon_hq/Documents/public/employerbranding/Academy for App Success/Academy for App Success
Academy for App Success

Google Play resources tailored for the global droidcon community

Follow us

Team droidcon

Get in touch with us

Write us an Email

 

 

Quicklinks

> Code of Conduct

> Terms and Conditions

> How to hold a conference

> FAQs

> Imprint

Droidcon is a registered trademark of Mobile Seasons GmbH Copyright © 2020. All rights reserved.

powered by Breakpoint One