ci: enable split apks & build only for arm64-v8a (#20683)

In this commit:
- we set `ANDROID_ABI_SPLIT` to `true`
- we set `ANDROID_ABI_INCLUDE` to `arm64-v8a` for debug & PR android builds
- release builds would still contain `armeabi-v7a;arm64-v8a` and there is no change for E2E android builds
- we point to relevant changes in `status-jenkins-lib` which also introduces a size check for this `apk`.
The agreed threshold is 100 MB.
This commit is contained in:
Siddarth Kumar 2024-07-27 00:02:44 +05:30 committed by GitHub
parent 73777e052e
commit c6a1db6334
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 22 additions and 28 deletions

View File

@ -215,15 +215,13 @@ build-fdroid: ##@build Build release for F-Droid
build-android: export BUILD_ENV ?= prod build-android: export BUILD_ENV ?= prod
build-android: export BUILD_TYPE ?= nightly build-android: export BUILD_TYPE ?= nightly
build-android: export ORG_GRADLE_PROJECT_versionCode ?= $(TMP_BUILD_NUMBER) build-android: export ORG_GRADLE_PROJECT_versionCode ?= $(TMP_BUILD_NUMBER)
build-android: export ANDROID_ABI_SPLIT ?= false
build-android: export ANDROID_ABI_INCLUDE ?= armeabi-v7a;arm64-v8a;x86
build-android: ##@build Build unsigned Android APK build-android: ##@build Build unsigned Android APK
@scripts/build-android.sh @scripts/build-android.sh
release-android: export TARGET := keytool release-android: export TARGET := keytool
release-android: export KEYSTORE_PATH ?= $(HOME)/.gradle/status-im.keystore release-android: export KEYSTORE_PATH ?= $(HOME)/.gradle/status-im.keystore
release-android: keystore build-android ##@build Build signed Android APK release-android: keystore build-android ##@build Build signed Android APK
@scripts/sign-android.sh result/app-release-unsigned.apk @scripts/sign-android.sh result/app-arm64-v8a-release-unsigned.apk
release-ios: export TARGET := ios release-ios: export TARGET := ios
release-ios: export IOS_STATUS_GO_TARGETS := ios/arm64 release-ios: export IOS_STATUS_GO_TARGETS := ios/arm64

View File

@ -211,7 +211,7 @@ android {
reset() reset()
enable getEnvOrConfig('ANDROID_ABI_SPLIT').toBoolean() enable getEnvOrConfig('ANDROID_ABI_SPLIT').toBoolean()
include getEnvOrConfig('ANDROID_ABI_INCLUDE').split(";") include getEnvOrConfig('ANDROID_ABI_INCLUDE').split(";")
universalApk true universalApk false
} }
} }
signingConfigs { signingConfigs {

View File

@ -38,10 +38,10 @@ KEYSTORE_PASSWORD=password
KEYSTORE_ALIAS=status KEYSTORE_ALIAS=status
KEYSTORE_KEY_PASSWORD=password KEYSTORE_KEY_PASSWORD=password
# By default we build a mostly universal APK # Splitting by CPU Architecture produces smaller APKs.
ANDROID_ABI_SPLIT=false ANDROID_ABI_SPLIT=true
# Some platforms are excluded though # By default its better to only build apk for most recent devices.
ANDROID_ABI_INCLUDE=armeabi-v7a;arm64-v8a;x86;x86_64 ANDROID_ABI_INCLUDE=arm64-v8a
org.gradle.jvmargs=-Xmx8704M -XX:+UseParallelGC org.gradle.jvmargs=-Xmx8704M -XX:+UseParallelGC

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.1' library 'status-jenkins-lib@v1.9.3'
/* Options section can't access functions in objects. */ /* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild() def isPRBuild = utils.isPRBuild()
@ -72,11 +72,7 @@ pipeline {
stage('Upload') { stage('Upload') {
steps { script { steps { script {
def urls = apks.collect { s5cmd.upload(it) } def urls = apks.collect { s5cmd.upload(it) }
if (urls.size() > 1) { /* Return only the universal APK. */
env.PKG_URL = urls.find { it.contains('universal') }
} else { /* If no universal is available pick first. */
env.PKG_URL = urls.first() env.PKG_URL = urls.first()
}
jenkins.setBuildDesc(APK: env.PKG_URL) jenkins.setBuildDesc(APK: env.PKG_URL)
} } } }
} }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.1' library 'status-jenkins-lib@v1.9.3'
import groovy.json.JsonBuilder import groovy.json.JsonBuilder

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.1' library 'status-jenkins-lib@v1.9.3'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.1' library 'status-jenkins-lib@v1.9.3'
/* Options section can't access functions in objects. */ /* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild() def isPRBuild = utils.isPRBuild()

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.1' library 'status-jenkins-lib@v1.9.3'
/* Options section can't access functions in objects. */ /* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild() def isPRBuild = utils.isPRBuild()

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.1' library 'status-jenkins-lib@v1.9.3'
pipeline { pipeline {

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.1' library 'status-jenkins-lib@v1.9.3'
pipeline { pipeline {

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.1' library 'status-jenkins-lib@v1.9.3'
pipeline { pipeline {

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.1' library 'status-jenkins-lib@v1.9.3'
pipeline { pipeline {
agent { label 'macos' } agent { label 'macos' }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.1' library 'status-jenkins-lib@v1.9.3'
pipeline { pipeline {
agent { label params.AGENT_LABEL } agent { label params.AGENT_LABEL }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.1' library 'status-jenkins-lib@v1.9.3'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.1' library 'status-jenkins-lib@v1.9.3'
pipeline { pipeline {
agent { agent {

View File

@ -18,10 +18,10 @@
buildUrl ? lib.getEnvWithDefault "ORG_GRADLE_PROJECT_buildUrl" null, buildUrl ? lib.getEnvWithDefault "ORG_GRADLE_PROJECT_buildUrl" null,
statusGoSrcOverride ? lib.getEnvWithDefault "STATUS_GO_SRC_OVERRIDE" null, statusGoSrcOverride ? lib.getEnvWithDefault "STATUS_GO_SRC_OVERRIDE" null,
# If APKs should be split based on architectures # If APKs should be split based on architectures
androidAbiSplit ? lib.getEnvWithDefault "ANDROID_ABI_SPLIT" "false", androidAbiSplit ? lib.getEnvWithDefault "ANDROID_ABI_SPLIT" "true",
# Android architectures to build for # Android architectures to build for
# Used to detect end-to-end builds # Used to detect end-to-end builds
androidAbiInclude ? lib.getEnvWithDefault "ANDROID_ABI_INCLUDE" "armeabi-v7a;arm64-v8a;x86", androidAbiInclude ? lib.getEnvWithDefault "ANDROID_ABI_INCLUDE" "arm64-v8a",
}: }:
let let

View File

@ -13,7 +13,7 @@ export BUILD_TYPE=debug
# Install the APK on running emulator or android device. # Install the APK on running emulator or android device.
installAndLaunchApp() { installAndLaunchApp() {
adb install -r ./result/app-debug.apk > "${ADB_INSTALL_LOG_FILE}" 2>&1 adb install -r ./result/app-arm64-v8a-debug.apk > "${ADB_INSTALL_LOG_FILE}" 2>&1
"${GIT_ROOT}/scripts/wait-for-metro-port.sh" 2>&1 "${GIT_ROOT}/scripts/wait-for-metro-port.sh" 2>&1
# connected android devices need this port to be exposed for metro # connected android devices need this port to be exposed for metro
adb reverse "tcp:${RCT_METRO_PORT}" "tcp:${RCT_METRO_PORT}" adb reverse "tcp:${RCT_METRO_PORT}" "tcp:${RCT_METRO_PORT}"