This project uses GitHub Actions to automate the build, test, and deployment process. Automation has been implemented as a top priority to ensure code quality and facilitate continuous development.
- File:
.github/workflows/android-ci.yml
- Purpose: Automatically build the application on each push or pull request.
- Features:
- Automatic setup of the development environment (JDK, Android SDK, NDK)
- Dependency caching to speed up builds
- Execution of the custom
autoBuild
task - Publication of build artifacts
- File:
.github/workflows/android-test.yml
- Purpose: Run unit and instrumented tests.
- Features:
- Execution of unit tests with JUnit
- Execution of instrumented tests on an Android emulator
- Publication of test results
- File:
.github/workflows/android-release.yml
- Purpose: Generate and publish application versions.
- Features:
- Triggered when creating a tag with the format
v*
(e.g., v1.0.0) - Automatic APK signing
- Creation of a new GitHub release with the signed APK
- Triggered when creating a tag with the format
A custom Gradle task called autoBuild
has been implemented that:
- Verifies the development environment configuration
- Cleans the project
- Builds the debug version
- Runs unit tests
- Handles errors robustly
- Make your changes in a separate branch
- Create a Pull Request to
main
- The automation will run the build and tests
- Once approved and merged, the changes will go to
main
- Make sure all changes are in the
main
branch - Create a new tag with the format
v1.x.x
:git tag v1.0.0 git push origin v1.0.0
- The release workflow will be triggered automatically
- A new release will be created on GitHub with the signed APK
If you already have a keystore file (like BearOwner.jks
), you can use the provided PowerShell script to prepare it for GitHub Actions:
# Run from the project root directory
.\scripts\prepare-keystore.ps1 -KeystorePath "C:\path\to\your\keystore.jks" -KeyAlias "your_key_alias" -KeystorePassword "your_keystore_password" -KeyPassword "your_key_password"
This script will encode your keystore file to base64 and provide instructions for setting up GitHub secrets.
For the automatic signing process to work, you must configure the following secrets in your GitHub repository:
SIGNING_KEY
: The signing key in Base64 formatKEY_ALIAS
: The key aliasKEY_STORE_PASSWORD
: The keystore passwordKEY_PASSWORD
: The key password
For local development, you can place your keystore file in the keystore
directory and update the signingConfigs
section in app/build.gradle.kts
with your keystore details.
Note: Never commit your actual keystore files or passwords to the repository. The .gitignore
file is configured to exclude .keystore
and .jks
files from version control.
If you encounter issues with the automation:
- Check the execution logs in the "Actions" tab of GitHub
- Make sure all necessary environment variables are configured
- Verify that the APK signing secrets are correctly configured
With this implementation, the build, test, and deployment process is fully automated, allowing for faster and more reliable development.