Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version code #941

Merged
merged 3 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/maestro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ jobs:
- uses: mobile-dev-inc/[email protected]
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app/build/outputs/apk/debug/app-universal-debug.apk
# Doc says (https://github.com/mobile-dev-inc/action-maestro-cloud#android):
# app-file should point to an x86 compatible APK file, so upload the x86_64 one (much smaller than the universal APK).
app-file: app/build/outputs/apk/debug/app-x86_64-debug.apk
env: |
USERNAME=maestroelement
PASSWORD=${{ secrets.MATRIX_MAESTRO_ACCOUNT_PASSWORD }}
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and release nightly APK
name: Build and release nightly application

on:
workflow_dispatch:
Expand All @@ -12,7 +12,7 @@ env:

jobs:
nightly:
name: Build and publish nightly APK to Firebase
name: Build and publish nightly bundle to Firebase
runs-on: ubuntu-latest
if: ${{ github.repository == 'vector-im/element-x-android' }}
steps:
Expand All @@ -31,9 +31,9 @@ jobs:
sed 's/CHANGES\.md/CHANGES_NIGHTLY\.md/' towncrier.toml.bak > towncrier.toml
rm towncrier.toml.bak
yes n | towncrier build --version nightly
- name: Build and upload Nightly APK
- name: Build and upload Nightly bundle
run: |
./gradlew assembleNightly appDistributionUploadNightly $CI_GRADLE_ARG_PROPERTIES
./gradlew bundleNightly appDistributionUploadNightly $CI_GRADLE_ARG_PROPERTIES
env:
ELEMENT_ANDROID_MAPTILER_API_KEY: ${{ secrets.MAPTILER_KEY }}
ELEMENT_ANDROID_MAPTILER_LIGHT_MAP_ID: ${{ secrets.MAPTILER_LIGHT_MAP_ID }}
Expand All @@ -44,7 +44,9 @@ jobs:
FIREBASE_TOKEN: ${{ secrets.ELEMENT_ANDROID_NIGHTLY_FIREBASE_TOKEN }}
- name: Additionally upload Nightly APK to browserstack for testing
continue-on-error: true # don't block anything by this upload failing (for now)
run: curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_PASSWORD" -X POST "https://api-cloud.browserstack.com/app-automate/upload" -F "file=@app/build/outputs/apk/nightly/app-universal-nightly.apk" -F "custom_id=element-x-android-nightly"
run: |
./gradlew assembleNightly $CI_GRADLE_ARG_PROPERTIES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I guess we'll need the ELEMENT_ANDROID_MAPTILER_* env vars in this task if we're now building here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, good point, added.

curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_PASSWORD" -X POST "https://api-cloud.browserstack.com/app-automate/upload" -F "file=@app/build/outputs/apk/nightly/app-universal-nightly.apk" -F "custom_id=element-x-android-nightly"
env:
BROWSERSTACK_USERNAME: ${{ secrets.ELEMENT_ANDROID_BROWSERSTACK_USERNAME }}
BROWSERSTACK_PASSWORD: ${{ secrets.ELEMENT_ANDROID_BROWSERSTACK_ACCESS_KEY }}
7 changes: 2 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,8 @@ android {
}

firebaseAppDistribution {
artifactType = "APK"
// We upload the universal APK to fix this error:
// "App Distribution found more than 1 output file for this variant.
// Please contact [email protected] for help using APK splits with App Distribution."
artifactPath = "$rootDir/app/build/outputs/apk/nightly/app-universal-nightly.apk"
artifactType = "AAB"
artifactPath = "$rootDir/app/build/outputs/bundle/nightly/app-nightly.aab"
// This file will be generated by the GitHub action
releaseNotesFile = "CHANGES_NIGHTLY.md"
groups = "external-testers"
Expand Down
29 changes: 28 additions & 1 deletion plugins/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,33 @@
import org.gradle.api.JavaVersion
import org.gradle.jvm.toolchain.JavaLanguageVersion

/**
* Version codes are quite sensitive, because there is a mix between bundle and APKs, and we have to take into
* account the future upgrade of Element Android.
* Max versionCode allowed by the PlayStore (for information):
* 2_100_000_000
* Current version code of EAx on the PlayStore, for the first uploaded beta (we cannot go below):
* ----1_001_000
* Current version code of EAx on the nightly:
* ----1_001_000
* Current version of Element Android (at some point EAx will replace this app) (v1.6.3)
* ----40_106_03a where a stands for the architecture: 1, 2, 3, 4 and 0 for the universal APK
* Current version of EAx distributed with Firebase app distribution:
* ----1_002_000
* Latest version of EAx distributed with Firebase app distribution (downgrading, so that's a problem)
* -------10_200
* Version when running the current debug build
* -------10_200
*
* So adding 4_000_000 to the current version Code computed here should be fine, we will have:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention the "multiply by 10 and add a number for the abi" logic somewhere here? It just looks like the maths is wrong at the minute 😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right! Done.

* Release version:
* ---40_001_020
* Nightly version:
* ---40_001_020
* Debug version:
* ---40_010_200
*/

// Note: 2 digits max for each value
private const val versionMajor = 0
private const val versionMinor = 1
Expand All @@ -27,7 +54,7 @@ private const val versionMinor = 1
private const val versionPatch = 2

object Versions {
val versionCode = (versionMajor * 1_00_00 + versionMinor * 1_00 + versionPatch) * 10
val versionCode = 4_000_000 + versionMajor * 1_00_00 + versionMinor * 1_00 + versionPatch
val versionName = "$versionMajor.$versionMinor.$versionPatch"
const val compileSdk = 33
const val targetSdk = 33
Expand Down