Testing Github Actions workflows for Android regionally with Docker | by Lukasz Kalnik | Dec, 2022

Once you edit your Github Actions workflows it could be good to have a chance to check them regionally to have a fast suggestions loop if one thing is damaged. In any other case you need to look forward to Github Actions to run the motion (which in case of dash builds or Play Retailer launch builds might not occur for weeks) solely to later understand that the modified workflow has an error and doesn’t run when it’s most wanted.

That is doable utilizing Docker and an area motion runner referred to as act.

The information beneath is particularly meant for testing workflows of Android apps on a Mac, however must be straightforward sufficient to regulate to different platforms.

  1. Obtain and set up Docker Desktop
  2. Set up act:
brew set up act

Act runs your workflows by default from the .github/workflows listing. Which means you’ll want to run act out of your undertaking root listing.

Nonetheless, act doesn’t know something about your project-specific Github atmosphere variables, undertaking secrets and techniques or Android SDK you’re utilizing to construct your undertaking. So you need to first put together your undertaking.

Setup Android SDK

Because the act Docker picture doesn’t include an Android SDK preinstalled, you may work round this by quickly including the setup-android motion to your workflow .yml file.

Simply add the 2 traces to your workflow (ensure you don’t commit them as your Github Actions runners most likely have already got the Android SDK preinstalled):

- identify: Setup Android SDK
makes use of: android-actions/[email protected]


Sadly the setup-android motion doesn’t set the ANDROID_HOME atmosphere variable mechanically.

To do it your self, you may create an .env file in your undertaking root folder which is able to comprise your atmosphere variables.

The file ought to comprise the next line:


Bear in mind so as to add the .env file to your .gitignore, because it’s solely wanted regionally.

Setup undertaking secrets and techniques

Github Actions workflows usually require the GITHUB_TOKEN and different undertaking associated secrets and techniques (e.g. PACKAGES_READ_TOKEN, totally different API keys your app makes use of and so forth.).

You’ll be able to setup all of your undertaking secrets and techniques inside a .secrets and techniques file in your undertaking root folder.

IMPORTANT: make sure that so as to add the .secrets and techniques file to .gitignore, as your secrets and techniques ought to by no means be dedicated and pushed to Github!

To generate aGITHUB_TOKEN or PACKAGES_READ_TOKEN you need to go to your Github Developer Settings, generate a brand new Private Entry Token, copy it and ensure you have licensed the token to entry the related group your repository lives in (if required).

Then contained in the .secrets and techniques file you may add your secrets and techniques like this:


NOTE: should you outline in your undertaking any string variables, that are then transformed in your construct.gradle.kts information into BuildConfig fields, you’ll want to put them in inside escaped quotes " after which once more in exterior quotes " like this:


That is due to the best way BuildConfig discipline technology works for strings.

To run the actions, first open the terminal and alter the present listing to your undertaking’s root listing.

In case you don’t specify in any other case, act will dispatch the push occasion to set off your workflows. You may as well dispatch different occasions — see extra choices.

Operating utilizing artifact server

If you’re utilizing actions/upload-artifact or actions/download-artifact in your workflow, you’ll want to create an area listing in your pc, which shall be used for a simulated artifact server:

mkdir /tmp/artifacts

after which move this listing to behave utilizing the parameter --artifact-server-path :

act --artifact-server-path /tmp/artifacts

This can run the workflows in your undertaking and output all artifacts to the required listing, the place you may later examine them.

Operating with out an artifact server

Merely go to your undertaking and run


That’s it! Glad testing your workflows!

Related Articles


Please enter your comment!
Please enter your name here

Latest Articles