Part 3[CI GitHub Actions and Bitrise] Android Automation Testing with Gradle Managed Devices using Firebase TestLab devices
5 min readSep 25
--
How to configure Firebase test lab Gradle managed devices to run on GitHub Actions and Bitrise.
In the previous posts run GMD from Android Studio and run GMD using Firebase test lab devices from Android Studio we configure how to run GMD locally, in this tutorial we are going to configure GMD to run on our CI pipelines. We are going to focus on setting up Gradle Managed Devices, to run on continuous integration pipelines using Github Actions and Bitrise using FTL devices.
Goal
Setup Github Actions and Bitrise to run GMD tasks.
1. Github Actions
Prerequisites
- Push Android project code to Github.
- Firebase Test Lab account.
- Use the latest Android Studio (at this time Hedgehog canary version)
- Use the latest Gradle managed devices is table in AGP (Android Gradle Plugin) 8.0.+
- Configure GitHub Actions: Add GitHub actions to Android project [follow this tutorial: GitHub Actions Android — Tutorial how to build Android app using GitHub Actions as CI]. After your project is configure to use Github Actions continue the steps below.
Steps
- Add your Firebase Test lab project service account credential to your Android Studio project. Go to Google cloud to get service account credential JSON file. Add the file to your repo. Example: (../app/AccountCredentials.json). Note it’s not recommded to push secrets to a public Github repo, to secure your credentials I recommend storing them on Github secret. The tutorial https://medium.com/@andresand/android-development-how-to-secure-service-account-credentials-json-file-bccd71ab17ed shows how to uses Github secrets so you don’t need to push your credentials to Github.
- Edit the file “build.gradle”(app module)
Configure the Firebase Test Lab Gradle managed device.
firebaseTestLab {
serviceAccountCredentials.set(file("service-account.json"))
managedDevices {
create("myFtlDevice") {
device = "panther" // Pixel 7
apiLevel = 33
}
}
}