Android continuous integration and delivery
Android Continuous Integration and Deliveryโ
This document outlines the Continuous Integration (CI) and Continuous Delivery (CD) processes for the Android project. We use GitHub Actions as our CI/CD platform, with multiple workflows configured to ensure code quality, automate builds, and streamline deployments.
Overviewโ
The main goals of our CI/CD process are:
- โ Validate that everything is working as expected.
- ๐จ Notify relevant people if something breaks.
- ๐ Enable fully automated continuous delivery of applications.
- ๐ Avoid duplication by extracting common code into reusable local actions under
.github/actions
.
Versioningโ
We follow the same versioning convention as the core project, using CalVer (Calendar Versioning). This ensures consistency across all releases.
Workflowsโ
On pull requestโ
When a pull request (PR) is opened or updated, the pr.yml
workflow is triggered. Its goals are:
- ๐งน Validate code compliance with our linters.
- ๐จ Ensure the code builds successfully.
- โ Run all tests to verify correctness.
- ๐ฆ Persist generated APKs in the GitHub Actions tab for review.
If any step fails:
- The CI notifies the PR owner.
- The PR is blocked from being merged until the issues are resolved.
- Fixes must be committed, which automatically restarts the workflow.
Only one workflow runs at a time for a given PR. If multiple commits are pushed in quick succession, the CI cancels ongoing builds and processes only the latest commit.
Debug buildsโ
To build the application in debug on CI, we use a mock Google services file located at /.github/mock-google-services.json
.
On push to main
โ
When a commit is pushed to the main
branch, the onPush.yml
workflow is triggered. Its goals are:
- ๐ Download translations from Lokalise.
- ๐ Generate release notes.
- ๐ง Build release variants of all applications.
- ๐ค Deploy applications to Firebase.
- ๐ Deploy to the internal track of the Play Store.
- ๐ฆ Persist generated APKs in the GitHub Actions tab.
- ๐ Inject secrets and files required for publishing.
We use Fastlane to simplify deployment to different stores. All Fastlane configurations can be found in the fastlane
folder.
This workflow can also be manually triggered with the beta
flag to promote a build to the beta track on the stores.
Weekly buildsโ
Every Sunday at 4:00 AM UTC, the weekly.yml
workflow is triggered automatically. Its goals are:
- ๐ Create a weekly GitHub pre-release.
- ๐ Invoke the
onPush.yml
workflow with thebeta
flag set totrue
.
This ensures that a new version of the applications is pushed to the beta track on the Play Store every week.
Monthly version tagsโ
On the first day of every month, the monthly.yml
workflow runs to create an initial version tag in the format YYYY.MM.0
. This aligns with our CalVer versioning strategy.
Releasesโ
The release.yml
workflow is triggered manually to promote the latest beta build to production. This ensures that only stable and tested builds are released to end users.
Release on F-Droidโ
The F-Droid store builds the applications themselves when we push a GitHub release. This process uses metadata.
They use the version_code.txt
file, which is created on every release from the main
branch, for the app's versioning.
We do not guarantee when the applications will be available on F-Droid after a release. You can find the app here.
Summary of workflowsโ
Workflow | Trigger | Goals |
---|---|---|
pr.yml | On PR open or update | Lint, build, test, and persist APKs. |
onPush.yml | On push to main | Build, deploy, and publish to Firebase and the Play Store. |
weekly.yml | Every Sunday at 4:00 AM | Create a pre-release and push the beta build to the Play Store. |
monthly.yml | First day of the month | Create an initial version tag (YYYY.MM.0 ). |
release.yml | Manual trigger | Promote the beta build to production. |
Notes and best practicesโ
- ๐ Extract common code into reusable actions under
.github/actions
to avoid duplication. - ๐ Be mindful of workflow triggers to avoid unnecessary resource usage.
- ๐ Ensure secrets and sensitive files are properly managed and injected during workflows.