gradle,ci: Sign CI APKs for Android release builds

Co-authored-by: Rylie Pavlik <rylie.pavlik@collabora.com>
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2209>
This commit is contained in:
Korcan Hussein 2024-05-15 11:45:06 +01:00 committed by Rylie Pavlik
parent 68beca75d4
commit 1e047b5b6d
5 changed files with 55 additions and 0 deletions

View file

@ -367,6 +367,7 @@ debian:cmake:
extends: extends:
- .monado.packaging.conditions - .monado.packaging.conditions
- .monado.image.debian:bookworm - .monado.image.debian:bookworm
before_script: before_script:
- pushd doc/changes - pushd doc/changes
- proclamation build vNEXT - proclamation build vNEXT
@ -385,6 +386,7 @@ debian:cmake-no-opencv:
stage: build stage: build
extends: extends:
- .monado.image.debian:bookworm - .monado.image.debian:bookworm
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
@ -395,6 +397,7 @@ debian:cmake-no-sdl2:
stage: build stage: build
extends: extends:
- .monado.image.debian:bookworm - .monado.image.debian:bookworm
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
@ -405,6 +408,7 @@ debian:cmake-no-service:
stage: build stage: build
extends: extends:
- .monado.image.debian:bookworm - .monado.image.debian:bookworm
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
@ -415,6 +419,7 @@ debian:cmake:32bit:
stage: build stage: build
extends: extends:
- .monado.image.debian:bookworm - .monado.image.debian:bookworm
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
@ -425,6 +430,7 @@ debian:bullseye:cmake:
stage: build stage: build
extends: extends:
- .monado.image.debian:bullseye - .monado.image.debian:bullseye
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
@ -435,6 +441,7 @@ ndk:armeabi-v7a:
stage: build stage: build
extends: extends:
- .monado.image.debian:bookworm-ndk - .monado.image.debian:bookworm-ndk
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
@ -444,6 +451,7 @@ ndk:arm64-v8a:
stage: build stage: build
extends: extends:
- .monado.image.debian:bookworm-ndk - .monado.image.debian:bookworm-ndk
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
@ -453,6 +461,7 @@ android:spotlessCheck:
stage: build stage: build
extends: extends:
- .monado.image.debian:bookworm-ndk - .monado.image.debian:bookworm-ndk
before_script: before_script:
# For caching gradle stuff # For caching gradle stuff
- export GRADLE_USER_HOME=`pwd`/.gradlehome - export GRADLE_USER_HOME=`pwd`/.gradlehome
@ -473,6 +482,7 @@ android:outOfProcessDebug:
stage: build stage: build
extends: extends:
- .monado.image.debian:bookworm-ndk - .monado.image.debian:bookworm-ndk
before_script: before_script:
# For caching gradle stuff # For caching gradle stuff
- export GRADLE_USER_HOME=`pwd`/.gradlehome - export GRADLE_USER_HOME=`pwd`/.gradlehome
@ -496,6 +506,7 @@ android:inProcessDebug:
stage: build stage: build
extends: extends:
- .monado.image.debian:bookworm-ndk - .monado.image.debian:bookworm-ndk
before_script: before_script:
# For caching gradle stuff # For caching gradle stuff
- export GRADLE_USER_HOME=`pwd`/.gradlehome - export GRADLE_USER_HOME=`pwd`/.gradlehome
@ -519,6 +530,8 @@ android:outOfProcessRelease:
stage: build stage: build
extends: extends:
- .monado.image.debian:bookworm-ndk - .monado.image.debian:bookworm-ndk
- .monado.packaging.conditions
before_script: before_script:
# For caching gradle stuff # For caching gradle stuff
- export GRADLE_USER_HOME=`pwd`/.gradlehome - export GRADLE_USER_HOME=`pwd`/.gradlehome
@ -533,6 +546,7 @@ android:outOfProcessRelease:
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
- base64 --decode ${MONADO_ANDROID_KEYSTORE} > monado-release.jks
- .gitlab-ci/ci-gradle-build.sh assembleOutOfProcessRelease - .gitlab-ci/ci-gradle-build.sh assembleOutOfProcessRelease
artifacts: artifacts:
paths: paths:
@ -542,6 +556,8 @@ android:inProcessRelease:
stage: build stage: build
extends: extends:
- .monado.image.debian:bookworm-ndk - .monado.image.debian:bookworm-ndk
- .monado.packaging.conditions
before_script: before_script:
# For caching gradle stuff # For caching gradle stuff
- export GRADLE_USER_HOME=`pwd`/.gradlehome - export GRADLE_USER_HOME=`pwd`/.gradlehome
@ -556,6 +572,7 @@ android:inProcessRelease:
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
- base64 --decode ${MONADO_ANDROID_KEYSTORE} > monado-release.jks
- .gitlab-ci/ci-gradle-build.sh assembleInProcessRelease - .gitlab-ci/ci-gradle-build.sh assembleInProcessRelease
artifacts: artifacts:
paths: paths:
@ -565,6 +582,7 @@ ubuntu:focal:cmake:
stage: build stage: build
extends: extends:
- .monado.image.ubuntu:focal - .monado.image.ubuntu:focal
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
@ -575,6 +593,7 @@ ubuntu:jammy:cmake:
stage: build stage: build
extends: extends:
- .monado.image.ubuntu:jammy - .monado.image.ubuntu:jammy
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
@ -585,6 +604,7 @@ ubuntu:noble:cmake:
stage: build stage: build
extends: extends:
- .monado.image.ubuntu:noble - .monado.image.ubuntu:noble
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
@ -595,6 +615,7 @@ arch:cmake:
stage: build stage: build
extends: extends:
- .monado.image.arch - .monado.image.arch
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
@ -605,6 +626,7 @@ arch:cmake:clang:
stage: build stage: build
extends: extends:
- .monado.image.arch - .monado.image.arch
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh
@ -615,6 +637,7 @@ alpine:cmake:
stage: build stage: build
extends: extends:
- .monado.image.alpine - .monado.image.alpine
script: script:
- .gitlab-ci/prebuild.sh - .gitlab-ci/prebuild.sh

View file

@ -177,10 +177,12 @@ distributions:
- name: android:outOfProcessRelease - name: android:outOfProcessRelease
target: assembleOutOfProcessRelease target: assembleOutOfProcessRelease
artifact_path: src/xrt/targets/openxr_android/build/outputs/apk/outOfProcess artifact_path: src/xrt/targets/openxr_android/build/outputs/apk/outOfProcess
extra_extends: .monado.packaging.conditions
- name: android:inProcessRelease - name: android:inProcessRelease
target: assembleInProcessRelease target: assembleInProcessRelease
artifact_path: src/xrt/targets/openxr_android/build/outputs/apk/inProcess artifact_path: src/xrt/targets/openxr_android/build/outputs/apk/inProcess
extra_extends: .monado.packaging.conditions
- name: ubuntu - name: ubuntu
images: images:

View file

@ -108,6 +108,9 @@ reuse:
- .monado.packaging.conditions - .monado.packaging.conditions
{% endif %} {% endif %}
- {{base_job_to_use_image(distro, image)}} - {{base_job_to_use_image(distro, image)}}
{% if job.extra_extends %}
- {{ job.extra_extends }}
{% endif %}
{%- if job.before_script or "android" in job.name %} {%- if job.before_script or "android" in job.name %}
@ -140,6 +143,9 @@ reuse:
{#- gradle builds -#} {#- gradle builds -#}
{%- elif "android" in job.name %} {%- elif "android" in job.name %}
{% if "Release" in job.name %}
- base64 --decode ${MONADO_ANDROID_KEYSTORE} > monado-release.jks
{% endif %}
- .gitlab-ci/ci-gradle-build.sh {{ job.target }} - .gitlab-ci/ci-gradle-build.sh {{ job.target }}
{%- else %} {%- else %}

View file

@ -0,0 +1 @@
Sign main branch CI-generated APKs for Android release builds.

View file

@ -49,6 +49,8 @@ def parseOpenXRVersion(def fn) {
String.join('.', components) String.join('.', components)
} }
project.ext.repoRoot = file('../../../../')
project.ext.renameLicense = { String name -> project.ext.renameLicense = { String name ->
def lowerNoExtension = name.toLowerCase().replace(".txt", "") def lowerNoExtension = name.toLowerCase().replace(".txt", "")
def result = lowerNoExtension.replaceAll(~/[\-.]/, "_") + ".txt" def result = lowerNoExtension.replaceAll(~/[\-.]/, "_") + ".txt"
@ -202,6 +204,27 @@ android {
} }
// For signing of release binaries - env var must contain an absolute path
// CI always does this.
def keystorePropertiesFilename = System.getenv("MONADO_KEYSTORE_PROPERTIES")
if (keystorePropertiesFilename) {
def keystorePropertiesFile = file("${keystorePropertiesFilename}")
if (keystorePropertiesFile.exists()) {
println("Signing release artifacts for monado")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android.signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file("${project.repoRoot}/" + keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
android.buildTypes.release.signingConfig android.signingConfigs.release
}
}
aboutLibraries { aboutLibraries {
// Full license text for license IDs mentioned here // Full license text for license IDs mentioned here
// will be included, even if no detected dependency uses them. // will be included, even if no detected dependency uses them.