A comprehensive collection of GitHub Actions workflows for Android projects, providing automated building, testing, validation, and release management.
- Automated APK Building & Releases - Build signed APKs and create GitHub releases with auto-generated changelogs
- Comprehensive Testing - Run both unit tests and instrumented tests across multiple Android API levels
- Code Quality Assurance - Validate Gradle wrapper integrity and perform pre-merge checks
- Multi-Platform Support - Test builds across Ubuntu, macOS, and Windows
- Smart Release Management - Support for both stable releases and pre-releases with automatic cleanup
Workflow | File | Purpose |
---|---|---|
APK Release | apk-release.yaml |
Builds signed APK and creates GitHub releases with changelogs |
Unit Tests | unit-tests.yaml |
Runs unit tests and generates test reports |
Instrumented Tests | instrumented-tests.yaml |
Runs Android instrumented tests on emulators (API 29 & 33) |
Pre-merge Checks | pre-merge.yaml |
Cross-platform build validation before merging |
Gradle Validation | gradle-wrapper-validation.yaml |
Validates Gradle wrapper integrity |
Copy all .yaml
files to your repository's .github/workflows/
directory.
Update the branch names in all workflows to match your repository's main branch:
# If your main branch is 'main' instead of 'master'
branches:
- main # Change from 'master' to 'main' or your branch name
Update the Java version in all workflows to match your project requirements:
java-version: '19' # Change to your project's Java version
distribution: 'temurin'
Add the following secrets to your repository settings:
SIGNING_KEY
- Base64 encoded signing keyALIAS
- Key aliasKEY_STORE_PASSWORD
- Keystore passwordKEY_PASSWORD
- Key password
Ensure all commit messages follow the Conventional Commits specification for automatic changelog generation.
Examples:
feat: add new user authentication feature
fix: resolve crash on app startup
docs: update README with setup instructions
The APK release workflow supports two tag formats:
- Stable Releases:
1.2.3
(semantic versioning) - Pre-releases:
PRE-abc1234
(7-character commit SHA)
# Create stable release
git tag 1.0.0
git push origin 1.0.0
# Create pre-release
git tag PRE-$(git rev-parse --short HEAD)
git push origin PRE-$(git rev-parse --short HEAD)
Workflow | Triggers |
---|---|
APK Release | Tag push ([0-9]+.[0-9]+.[0-9]+ , PRE-[a-f0-9]{7} ), Manual dispatch |
Unit Tests | Push to main branch, PR to main branch, Manual dispatch |
Instrumented Tests | Push to main branch, PR to main branch, Manual dispatch |
Pre-merge Checks | Push to main branch, PR to any branch |
Gradle Validation | Push to main branch, PR to any branch |
Note: Replace "main branch" with your actual branch name (e.g.,
master
,main
,develop
) as configured in step 2.
- actions/checkout@v4 - Repository checkout
- actions/setup-java@v4 - Java environment setup
- actions/upload-artifact@v4 - Artifact uploads
- actions/download-artifact@v4 - Artifact downloads
- actions/cache@v4 - Dependency caching
- gradle/wrapper-validation-action@v3 - Gradle wrapper validation
- gradle/gradle-command-action@v3 - Gradle command execution
- gradle/gradle-build-action@v3 - Gradle build setup
- gradle/actions/setup-gradle@v3 - Modern Gradle setup
- r0adkll/sign-android-release@v1 - APK signing
- reactivecircus/android-emulator-runner@v2 - Android emulator management
- dorny/test-reporter@v2 - Test result reporting
- requarks/changelog-action@v1 - Automatic changelog generation
Add ci skip
to commit messages to skip pre-merge checks:
git commit -m "docs: update README [ci skip]"
Update the matrix strategy in instrumented-tests.yaml
:
strategy:
matrix:
api-level: [29, 33, 34] # Add or remove API levels
Modify excluded commit types in apk-release.yaml
:
excludeTypes: 'build,docs,other,style,refactor'