taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

commit e661b12891b68d275c5607df6f4361bc92b26ce0
parent eb41c615a64751d10554e2a28b99ec31172b1064
Author: Iván Ávalos <avalos@disroot.org>
Date:   Tue,  4 Feb 2025 15:52:13 +0100

[ci] add CI for donau-verificator

Diffstat:
Acontrib/ci/jobs/4-donau-verificator-deploy/config.ini | 7+++++++
Acontrib/ci/jobs/4-donau-verificator-deploy/deploy.sh | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontrib/ci/jobs/4-donau-verificator-deploy/job.sh | 6++++++
Mdonau-verificator/build.gradle | 30+++++++++++++++++++++++++++++-
4 files changed, 124 insertions(+), 1 deletion(-)

diff --git a/contrib/ci/jobs/4-donau-verificator-deploy/config.ini b/contrib/ci/jobs/4-donau-verificator-deploy/config.ini @@ -0,0 +1,6 @@ +[build] +HALT_ON_FAILURE = False +WARN_ON_FAILURE = True +CONTAINER_BUILD = True +CONTAINER_NAME = localhost/taler-android +CONTAINER_ARCH = amd64 +\ No newline at end of file diff --git a/contrib/ci/jobs/4-donau-verificator-deploy/deploy.sh b/contrib/ci/jobs/4-donau-verificator-deploy/deploy.sh @@ -0,0 +1,82 @@ +#!/bin/bash +set -exuo pipefail + +ARTIFACT_PATH="/artifacts/taler-android/${CI_COMMIT_REF}/donau-verificator" +APK_PATH="donau-verificator/build/outputs/apk/nightly/release/donau-verificator-nightly-release-unsigned.apk" +LINT_PATH="donau-verificator/build/reports/lint-results-fdroidDebug.html" + + +function build_apk { + [[ ! -f "${NIGHTLY_KEYSTORE_PATH}" ]] && return 1 + echo "Building APK ..." + + # Test and build the APK + ./gradlew :donau-verificator:check :donau-verificator:assembleNightlyRelease + + # Sign the APK + apksigner sign \ + --ks "${NIGHTLY_KEYSTORE_PATH}" \ + --ks-key-alias "${NIGHTLY_KEYSTORE_ALIAS}" \ + --ks-pass env:NIGHTLY_KEYSTORE_PASS \ + "${APK_PATH}" + + # Copy the APK and lint report to artifacts folder + mkdir -p "${ARTIFACT_PATH}" + cp "${APK_PATH}" "${ARTIFACT_PATH}"/donau-verificator-nightly-debug.apk + cp "${LINT_PATH}" "${ARTIFACT_PATH}" +} + + +function deploy_apk { + [[ ! -f "${SCP_SSH_KEY}" ]] && return 0 + echo "Deploying APK to taler.net/files ..." + + apk_dest="${SCP_SSH_PATH}"/donau-verificator/donau-verificator-nightly-debug-$(date -u +%s).apk + latest_dest="${SCP_SSH_PATH}"/donau-verificator/donau-verificator-nightly-debug-latest.apk + + # Deploy APK to taler.net/files/donau-verificator + scp -i "${SCP_SSH_KEY}" \ + -o StrictHostKeyChecking=no \ + -o UserKnownHostsFile=/dev/null \ + "${APK_PATH}" \ + "${SCP_SSH_HOST}":"${apk_dest}" + + # Create symbolic link to the latest version + ssh -i "${SCP_SSH_KEY}" \ + -o StrictHostKeyChecking=no \ + -o UserKnownHostsFile=/dev/null \ + "${SCP_SSH_HOST}" \ + ln -sfr "${apk_dest}" "${latest_dest}" +} + + +function deploy_fdroid { + [[ ! -f "${FDROID_REPO_KEY}" ]] && return 0 + echo "Deploying APK to F-droid nightly ..." + + # Copy keystore where SDK can find it + cp "${NIGHTLY_KEYSTORE_PATH}" /root/.android/debug.keystore + + # Rename APK, so fdroid nightly accepts it (looks for *-debug.apk) + cp "${APK_PATH}"/*.apk donau-verificator-debug.apk + + fdroid --version + + set +x + export DEBUG_KEYSTORE=$(cat "$FDROID_REPO_KEY") + set -x + + # Deploy APK to nightly repository + export CI= + export CI_PROJECT_URL="https://gitlab.com/gnu-taler/fdroid-repo" + export CI_PROJECT_PATH="gnu-taler/fdroid-repo" + export GITLAB_USER_NAME="$(git log -1 --pretty=format:'%an')" + export GITLAB_USER_EMAIL="$(git log -1 --pretty=format:'%ae')" + + fdroid nightly -v --archive-older 6 +} + + +build_apk +deploy_apk +# deploy_fdroid diff --git a/contrib/ci/jobs/4-donau-verificator-deploy/job.sh b/contrib/ci/jobs/4-donau-verificator-deploy/job.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -exuo pipefail + +job_dir=$(dirname "${BASH_SOURCE[0]}") + +"${job_dir}"/deploy.sh diff --git a/donau-verificator/build.gradle b/donau-verificator/build.gradle @@ -2,6 +2,19 @@ plugins { id 'com.android.application' } +static def versionCodeEpoch() { + return (new Date().getTime() / 1000).toInteger() +} + +def gitCommit = { -> + def stdout = new ByteArrayOutputStream() + exec { + commandLine 'git', 'rev-parse', '--short=7', 'HEAD' + standardOutput = stdout + } + return stdout.toString().trim() +} + android { namespace 'net.taler.donauverificator' compileSdk 34 @@ -13,7 +26,7 @@ android { versionCode 1 versionName "1.0" - archivesBaseName = "Donau-Verifcation" + archivesBaseName = "donau-verificator" externalNativeBuild { cmake { cppFlags '' @@ -28,6 +41,21 @@ android { } } + flavorDimensions = ["distributionChannel"] + productFlavors { + fdroid { + dimension "distributionChannel" + applicationIdSuffix ".fdroid" + } + + nightly { + dimension "distributionChannel" + applicationIdSuffix ".nightly" + versionCode versionCodeEpoch() + versionNameSuffix " ($gitCommit)" + } + } + compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17