The Android app powering the people's weather network.
We use Github Flow as our branching model and Clean Architecture.
All contributors must import our code style settings for Android Studio: android-studio-settings.zip
Steps to import them:
- File
- Manage IDE Settings
- Import Settings
To build the app from source, you need to pass the following environment variables, through gradle
command line arguments, or by creating a production.env
properties file in the root directory,
according to the
template file,
that will be automatically read into env variables by the build script.
You would also need the google-services.json
which can be downloaded from Firebase.
If you want to release on production, you would also need the correct keystore.
We have 5 different app flavors (consider flavors as different “build variants”, read
more here). For each flavor a
different {flavor}.env
file can be created for different environment variables such as API_URL
.
The 5 different app flavors are:
- Local Mock: We use this to mock responses from the API using some local JSON files that
can be found in
root/app/src/local/assets/mock_files/*
in order to test some edge cases and/or user reported bugs. - Remote Mock: This flavor communicates with our remote mock API.
Powered by
remotemock.env
. Currently only for internal use. - Remote Dev: This flavor communicates with our dev API.
Powered by
development.env
. Currently only for internal use. - Remote Staging: Initially used for communicating with our staging API.
Powered by
staging.env
. Not currently used. - Remote Prod: This flavor communicates with our production API, found
on
app.weatherxm.com
. Powered byproduction.env
. TheAPI_URL
on that environment file should be https://api.weatherxm.com
One thing that needs to be mentioned is that for every flavor a different build type can be used,
either a Debug
or a Release
build type.
We use these code style settings on Android Studio: android-studio-settings.zip
We use Detekt as a code analysis tool for finding potential code
optimizations. Our config file for Detekt can be found in detekt.yml
.
We have 4 different GitHub Actions:
- Code Analysis: An action that runs on every Pull Request, building the app and
running
./gradlew :app:detekt
in order to find potential code optimizations. - Build Development and Distribute on Firebase: An action that runs on every push on
main
, building the app, and running./gradlew :app:assembleDevDebugRelease :app:appDistributionUploadDevDebugRelease
in order to distribute Dev Debug versions of the app through Firebase App Distribution in the Firebase Channels. Currently used for internal testing. - Build Production & Google Play Internal Channel Distribution: An action that runs on every tag pushed, building the
app, and running
./gradlew bundleRemoteProdRelease -PSKIP_PRODUCTION_ENV
anduses: r0adkll/upload-google-play@v1.1.3
in order to distribute a Remote Prod version of the app bundled as AAB through in the Google Play Internal Testing Channel. - Build QA Release and Distribute on Firebase: An action that gets
manually triggered
and takes as input the
environment
, thebuild type
and creates a release and distributes it through Firebase App Distribution in the QA Firebase Channels. Currently used for internal testing.
When merging a feature/
PR on Git, we do squash merge
with an explanatory and human-friendly
commit message.
For releases to the tech team or to the QA team we are utilizing Firebase and more
specifically Firebase App Distribution (can be
found under the Release & Monitor tab in Firebase Console). All different Remote
flavors are
supported.
In order to upload a version up for testing, two different ways can be used:
- Locally build an APK/AAB, upload it in Firebase Console → Release & Monitor → App Distribution ( mind the current flavor which can be changed at the top of the page) and distribute it to the testers you prefer.
- Using a GitHub Action to automatically build, upload and distribute an AAB/APK through Firebase.
In order to create a new public beta release (called Open Testing release on Play Console) some mandatory steps should be followed that we will explain below:
- Create and push a new tag in
main
which will be the version we want to release. - Create a new GitHub release out of main
with the title being the version name (
X.X.X
). The same applies for the tag (use the tag you created in the previous step). On the description clickAuto-generate release notes
and format the text accordingly to remove authors and commit urls, and have just a human-readable list of release notes. - The Android App Bundle has been created automatically and deployed to "Internal Testing" in Google Play.
When the deployment is completed, download the
AAB
file from App Bundle Explorer in Google Play Console" and attach it to that GitHub Release and then clickPublish Release
. - In Google Play Internal Testing release, edit the release notes and make them even more generic
and human-friendly. For example, we don't want to mention 5 different UI fixes but just write "
Numerous UI Fixes and Improvements". Also, the title of the release should contain the
-internal
suffix. - Send the new release for review by Google (we use Google Play Managed Publishing).
Usually, after some days if everything is OK, we move this internal release from Internal Testing → Open Testing on Play Console (using console’s “Promote Release” @ Internal Testing → Releases → Find your release → Promote Release) and we execute the steps 1-2 at the below guide “Public Beta Releases (How To)”.
In order to create a new public beta release (called Open Testing release on Play Console) some mandatory steps should be followed after we have promoted our release from internal testing:
- Send the new release for review by Google (we use Google Play Managed Publishing).
- After the release passes Google’s review and you publish the app to the public, use this template, and after filling the correct date, app version and release notes, publish it on Discord's #announcements channel or have a community manager publish it.
Usually, after some days, we move this beta release from Open Testing → Production on Play Console (using console’s “Promote Release” @ Open Testing → Releases → Find your release → Promote Release) and we execute the steps 1-3 at the below guide “Production Releases (How To)”.
In order to create a new production release some mandatory steps should be followed after we have promoted our release from open testing:
- Send the new release for review by Google (we use Google Play Managed Publishing).
- After the release passes Google’s review and you publish the app to the public, use this template, and after filling the correct date, app version and release notes, publish it on Discord's #announcements channel or have a community manager publish it.
- At Firebase's Console, go to remote config and edit the
android_app_changelog
,android_app_minimum_code
,android_app_version_code
as needed.