A guide to CI/CD for Android using GitHub Actions: a reasonable pipeline
Most Android teams know they should automate releases. What often gets missed is drawing a clear line between “is this code good?” and “can testers install it?”
This guide walks through a real GitHub Actions setup on an Android app: three workflows that work together, fast pull-request checks, AI-assisted code review, and slower release automation (visual tests, emulator, signing, Google Play upload, and team notifications).
You do not need to know the app or its internals. The patterns apply to most Gradle-based Android projects.
Reading time: about 15–20 minutes.
The mental map: two doors
Think of two doors, with an extra reviewer at the first one:
- Quality gate, Can we merge? (build, tests, style, lint, AI review, human review)
- Shipping dock, Can testers install it? (deeper tests, signed bundle, Play internal track)
CI (main.yml) |
AI review (ai-code-review.yml) |
Release (release.yml) |
|
|---|---|---|---|
| Runs on | Every PR + every push to main |
Every PR (open / update / reopen) | Every push to main |
| Typical duration | A few minutes | ~1–2 minutes | ~30 minutes |
| Blocks merge? | Yes (required checks) | No (advisory comment) | N/A (post-merge) |
| Emulator? | No | No | Yes |
| Publishes to Play? | No | No | Yes (internal track) |
Splitting mechanical checks from release keeps pull requests snappy. The AI review runs in parallel with CI, nobody waits for an emulator because they fixed a typo, and authors get a second opinion on the diff while Gradle compiles.
Merging should be fast and mechanical. Release should be slow, signed, and repeatable.
Before CI: how work enters
Automation does not start at “push.” It starts earlier, with how the team structures work.
Branching and merge flow
When we pick up an issue, we branch from main. If the issue is large, we split it into sub-issues, each sub-issue gets its own branch, but branched from the parent feature branch, not from main directly. Sub-issue pull requests merge back into the parent branch as they complete. Only when every sub-issue is integrated and the feature is ready do we merge the parent branch into main, and that merge triggers a new release candidate.
Why this shape:
- Sub-issues stay isolated. Each small PR runs CI and AI review without touching
mainuntil its slice is done. - The parent branch integrates incrementally. You assemble the full feature on the parent branch before exposing it to the release pipeline.
- One release per feature landing. Merging to
mainis the only gate that kicks off screenshot tests, emulator, signing, and the Play upload.
Large features are tracked as sub-issues so progress stays visible in reviewable chunks:
Pull requests carry context too: goals, non-goals, and a testing checklist the author fills in before asking for review:
Why this matters for CI: clear scope reduces surprise failures. When lint or tests fail, you know which slice of the feature broke, not an entire multi-week epic.
AI review on pull requests
When a PR opens or receives new commits, ai-code-review.yml runs in parallel with CI, not inside it. Both workflows share the same trigger; neither waits for the other.
How the AI workflow works:
- GitHub Actions checks out the PR diff (base commit vs. head).
- A Python script (
ai_review.py) sends the diff and PR title to an LLM via the Gemini API. - The workflow posts the model’s response as a comment on the PR, issues found, things done well, and whether earlier feedback was addressed.
The workflow skips bot-authored PRs (Dependabot, Renovate) and cancels in-flight reviews when new commits land, so the comment always reflects the latest diff.
What you need to set up: a repository secret GEMINI_API_KEY and pull-requests: write permission so the bot can comment. The built-in GITHUB_TOKEN is enough for repo access.
What it is good for: catching logic bugs, Android-specific mistakes, and readability problems before a human opens the file, especially on smaller teams with limited review bandwidth.
What it is not: a replacement for human review or a required check. CI can be green while the AI flags a real bug in a comment, that is working as designed.
Pipeline 1: CI, the quality gate
File: main.yml
Triggers: pull requests to main, pushes to main, manual runs
When you open a PR, GitHub Actions starts five CI jobs in parallel (with one dependency chain at the end). At the same time, the AI review workflow leaves a comment on the PR.
Draft PRs skip the heavier jobs, unit tests, Android Lint, and the release build check, so work in progress does not burn CI minutes.
What each job does (and why)
- Build app, compiles a debug APK and uploads it as an artifact.
- Unit tests, JVM tests and Robolectric-based Compose UI tests.
- Kt lint check, Kotlin style rules.
- Android lint check, Android’s static analyzer on the debug variant.
- Make sure release build work, decodes the keystore from encrypted secrets and compiles a release bundle without publishing anything.
What we deliberately skip in CI
- Emulator / instrumented tests
- Screenshot regression tests
- Google Play uploads
- Version tagging
Those live in the release pipeline. Keeping them out of every PR is a choice, not a gap.
Pipeline 2: release, the shipping dock
File: release.yml
Triggers: pushes to main, manual runs
Merge day is when deeper validation starts. The release workflow has three top-level jobs:
Job A: Screenshot tests
Compose previews are rendered and compared pixel-by-pixel against reference images checked into the repo.
If references do not exist yet, the pipeline generates them, commits them back, and skips validation that run, a one-time bootstrap.
On normal runs, any visual drift fails the build and uploads a diff report you can download from the Actions artifacts tab.
Benefit: catches “we changed a color and did not notice” regressions. Typography, spacing, and layout stay honest without manual screenshot sessions on every change.
Why only here? Screenshot infrastructure is heavier than unit tests. We run it when we are preparing something shippable, not on every keystroke.
Job B: Integration tests
Here we boot a real Android emulator on the runner (API 30, optimized test image) and run instrumented tests end-to-end.
Benefit: exercises the real framework, lifecycle, SQLite, permissions, navigation, in ways the JVM cannot fully replicate.
Reports are always uploaded, pass or fail, so debugging does not require reproducing the emulator locally.
Job C: Build release AAB, the main event
Once visual and integration tests pass, the Build release AAB job takes over. In a recent run it took about six and a half minutes end to end:
What happens inside, in order:
1. Compute version, we do not hand-edit the build file on release day. The pipeline reads rc-* git tags and increments automatically:
- Tag:
rc-1.0.1 - Version name:
1.0.1 - Version code:
10005(formula: major×10000 + minor×100 + patch)
2. Prepare and verify signing, the upload keystore never lives in git. It is stored as an encrypted secret, decoded on the runner, and verified with standard Java tooling before Gradle runs.
3. Build and publish, one Gradle invocation
A single command builds the signed Android App Bundle and uploads it to Play:
bundleRelease + publishReleaseBundle
Publishing uses the Gradle Play Publisher plugin (Triple-T), targeting the internal track. No “download AAB, open Play Console, click upload.” Repeatable, logged, and boring, the best kind of release.
4. Job summary, artifact, and git tag
The workflow writes a readable table to the Actions summary, uploads the .aab as an artifact, and pushes an rc-* tag (unless the commit was already tagged, safe for re-runs).
5. Team notification
In this example we use Discord; the same pattern fits Slack, email, or any channel. Success or failure posts an embed with version, tag, and links to the CI run and Play Console releases (as a workflow variable, not in the repo).
How it fits together
- Plan, break features into sub-issues; document goals and test plan in the PR.
- Open PR, CI (required) and AI review (advisory) in parallel; both feed human review.
- Merge, CI runs again on `main` and the release pipeline starts.
- Release OK, signed build on the internal track; team notified via Discord (or another channel).
- Promote when ready, production remains a deliberate human decision.
That last step is intentional. Automation removes repetition; you still control what real users receive.
What goes in secrets (and what does not)
Never publish keystores, service account JSON, webhook URLs, passwords, or credentials in an article or in the repository.
In the repo we store only categories of secrets in GitHub Actions:
| Category | Purpose |
|---|---|
| LLM API key | Power the AI code review workflow |
| Signing keystore (Base64) | Reconstruct the upload key on the runner |
| Keystore passwords & alias | Sign release binaries |
| Play Publisher credentials | Authenticate the Gradle Play Publisher plugin |
| Notification webhook | Post Discord embeds (or another channel) |
If anything leaks, rotate it immediately. Secrets must stay secret: no log should print them.
What I learned building this
AI under human judgment
The model catches what lint misses; people decide product and architecture. In parallel, without blocking.
Fast vs slow
On the PR, minutes. Release confidence still goes up because the heavy work runs after merge.
Release on the PR
Compiling release on the PR costs little and avoids surprises: the app does not only compile in debug.
- Tag-driven versioning, fewer Monday-morning arguments; history lives in git.
- Bundle + publish in one Gradle step, fewer invocations, fewer signing surprises.
- Notify in the channel people read, a green check in Actions helps; the team needs to know which version is on the internal track.
- Manual production promotion, you control what reaches real users.
Conclusion
Layers of trust, not one giant workflow
Good CI/CD is not a single YAML that does everything. It is a sequence: structured issues, documented PRs, automated style and tests, AI-assisted review, human approval, emulator and visual validation, signed artifacts, and a nudge to the team when something ships to the internal track.
Three workflow files. Zero manual uploads. Every PR gets mechanical checks and an AI first pass; every merge delivers a signed build to the internal track, and the team always knows which version it is.
Screenshots come from a real GitHub Actions setup. If you want help reviewing or building your pipeline, see Android app development or book 30 minutes. You can also read the original article on Medium.
Frequently asked questions
Does the AI review block merging?
Why not run the emulator on every PR?
How many workflows do we need?
Related articles
- Insomnia, AI agents, and the 8-hour 'simple feature'
A language switcher with AI that was supposed to take two hours turned into an all-nighter. Acceptance criteria, automated review, and three lessons.
- Technical interviews in the AI era: perhaps we assess the wrong things
Technical interviews still measure what AI already does. What companies should evaluate when hiring developers, and what a useful process looks like today.
- Beyond "Vibe Coding": A Manifesto for Sustainable AI Engineering
Five principles for using AI in engineering without chaos: trust, specification, rigor, humans in charge, and sustainable cost. A manifesto in English.