From a342f23ef9e141f443ea4a71d2a2fa3e068eef9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Bene=C5=A1?= Date: Mon, 9 Nov 2026 08:01:54 +0000 Subject: [PATCH] CI: an installable test APK on every push; a beta tag is a pre-release Debug builds are signed with a public test key committed as app/test-debug.keystore (standard debug passwords, .debug application id only). A runner's own debug key is new each run, so every test build used to need the one before it uninstalled -- and a sign-in with it. The version name carries GITHUB_RUN_NUMBER (1.0.0-beta.1-debug.42), and the updater compares only what is before "-debug". ci.yml uploads llembas-android-debug- with the full and fdroid debug APKs named by run and commit, and their SHA256SUMS. release.yml passes --prerelease for a tag with a suffix: beta.1's GitHub Release had to be marked by hand. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 15 +++++++++++++-- .github/workflows/release.yml | 5 ++++- .gitignore | 2 ++ CHANGELOG.md | 8 ++++++++ README.md | 7 +++++++ app/build.gradle.kts | 15 ++++++++++++++- .../java/eu/llembas/android/update/Updater.kt | 2 +- app/test-debug.keystore | Bin 0 -> 2714 bytes 8 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 app/test-debug.keystore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad38249..9fed533 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,10 +47,21 @@ jobs: run: ./gradlew --no-daemon lintFullDebug continue-on-error: true + # The test build a tester installs (Actions › this run › Artifacts): debug-signed with the + # repository's public test key, so each one installs over the last. `full` is the one to + # use; `fdroid` is the same app without the updater. + - name: Name the test builds + run: | + mkdir test-builds + short="${GITHUB_SHA::7}" + cp app/build/outputs/apk/full/debug/app-full-debug.apk "test-builds/llembas-android-debug-$GITHUB_RUN_NUMBER-$short.apk" + cp app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk "test-builds/llembas-android-debug-$GITHUB_RUN_NUMBER-$short-fdroid.apk" + (cd test-builds && sha256sum *.apk > SHA256SUMS) + - uses: actions/upload-artifact@v4 with: - name: llembas-android-debug - path: app/build/outputs/apk/*/debug/*.apk + name: llembas-android-debug-${{ github.run_number }} + path: test-builds/ if-no-files-found: error - uses: actions/upload-artifact@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a63cc63..be973ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,4 +73,7 @@ jobs: GH_TOKEN: ${{ github.token }} run: | git tag -l --format='%(contents)' "$TAG" | sed '/-----BEGIN SSH SIGNATURE-----/,$d' > notes.md - gh release create "$TAG" --verify-tag --title "LLeMbas for Android $VERSION" --notes-file notes.md dist/* + # A `-beta.N` tag is a pre-release: never "Latest", never what /releases/latest hands out. + pre="" + case "$TAG" in *-*) pre="--prerelease" ;; esac + gh release create "$TAG" --verify-tag $pre --title "LLeMbas for Android $VERSION" --notes-file notes.md dist/* diff --git a/.gitignore b/.gitignore index e2437af..e5ab679 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ local.properties # A release key never goes in the repository (CI writes it from secrets) *.jks *.keystore +# ...except the public test key debug builds are signed with (see app/build.gradle.kts) +!/app/test-debug.keystore # IDEs .idea/ *.iml diff --git a/CHANGELOG.md b/CHANGELOG.md index b89d5c6..961eabc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,16 @@ is in alpha and releases come off `main`. ## [Unreleased] +### Added + +- **Test builds for every change**: each push to `dev` leaves an installable APK on the CI run, + signed with a public test key so a newer test build installs over an older one. The version + in Settings › About carries the run's number. + ### Changed +- A beta (`vX.Y.Z-beta.N`) is published on GitHub as a pre-release by itself. + - **Pinned to LLeMbas server 2.0.0-beta.4**: the contract, the theme and the strings come from that release. Nothing a person sees changes; the server's API is the same as in beta.1. diff --git a/README.md b/README.md index 276083d..acc0dc4 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,13 @@ and check it against `SHA256SUMS`. The `full` APK updates itself from llembas.eu one does not. Android 10 or newer; the instance must run LLeMbas server 2.0 or newer (an older one is refused at sign-in, with a sentence saying so). +**Test builds.** Every push to `dev` builds a debug APK: open the newest green run under +[Actions](https://github.com/LLeMbas/LLeMbas-Android/actions/workflows/ci.yml), download the +`llembas-android-debug-N` artifact (GitHub asks you to be signed in), unzip it and install the APK that does +not end in `-fdroid`. It is a separate app ("eu.llembas.android.debug") beside a released one, +signed with a public test key kept in this repository, so each test build installs over the one +before it -- and anyone could sign one, so take test builds only from this repository's runs. + If your instance uses a certificate from your own certificate authority, install that CA on the phone first (Settings › Security › Encryption & credentials › Install a certificate › CA certificate). The app trusts CAs you installed, as the browser does. diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8c0ef29..8e08d37 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -39,6 +39,17 @@ android { } signingConfigs { + // Debug builds are signed with a *public* test key that lives in the repository, so the + // APK every CI run uploads installs over the one before it (a runner's own debug key is + // new each run, and Android refuses an update from a different signer). It signs only + // the `.debug` application id, never a release, and it is no secret: anyone can sign + // with it, so install a debug build only from this repository's CI. + getByName("debug") { + storeFile = file("test-debug.keystore") + storePassword = "android" + keyAlias = "androiddebugkey" + keyPassword = "android" + } releaseKey?.let { key -> create("release") { storeFile = file(key.getProperty("file")) @@ -58,7 +69,9 @@ android { } debug { applicationIdSuffix = ".debug" - versionNameSuffix = "-debug" + // CI's run number, so a tester can tell two test builds apart in Settings › About. + versionNameSuffix = "-debug" + (System.getenv("GITHUB_RUN_NUMBER")?.let { ".$it" } ?: "") + signingConfig = signingConfigs.getByName("debug") } } diff --git a/app/src/main/java/eu/llembas/android/update/Updater.kt b/app/src/main/java/eu/llembas/android/update/Updater.kt index 35d04eb..c1afd6f 100644 --- a/app/src/main/java/eu/llembas/android/update/Updater.kt +++ b/app/src/main/java/eu/llembas/android/update/Updater.kt @@ -37,7 +37,7 @@ class Updater(private val context: Context) { if (!it.isSuccessful) return@withContext context.getString(R.string.update_unreachable) LembasJson.decodeFromString(Latest.serializer(), it.body!!.string()) } - if (!newer(latest.version, BuildConfig.VERSION_NAME.removeSuffix("-debug"))) { + if (!newer(latest.version, BuildConfig.VERSION_NAME.substringBefore("-debug"))) { return@withContext context.getString(R.string.update_none) } if (!context.packageManager.canRequestPackageInstalls()) { diff --git a/app/test-debug.keystore b/app/test-debug.keystore new file mode 100644 index 0000000000000000000000000000000000000000..a32ba245b7ec90ce6cb3771dc32cfd303bd5311c GIT binary patch literal 2714 zcma)8XE+;-7EaOxv8maXQbO&-EwG}a9s}3>RS|wCkBt_Mx zX02+i(&BTUd!K&K{dMn;^StN0?|IM9_c?GhbuI{a367>#rGN@2XeAuc0V#o4G&KT@ zrWU)Ph2UsN_kT%{XJ9m>@q(_sC>#aNe_XWGKoAxUQN19Q;Lg7t5IVRyT>hVt7A^v2 zu^jVPG^*qK^pVwEH&csB4$3@u7X%Vy1Oa*Av=mhTz6gRs0B|k}s9k~<5P1m<6b3W) z8ZhhYPO0cQEeu%6S7yY4(O?qWoIv}*aSVssI@6BCqF~#!nJ7iiyh68VId1gOD1D!Q z;JBZ6p&=HzsaA@c6`!t+vOCA(t8`T+Byv3Uv41{>+LbAzJCKNnPq*nGw<}vSP7U8N zx7qcQ_77RB2Ya8Nyz9SQL3mn3VB~bi-d^VIR&~Z$Ozxuh60l!5?7V~{NCPadJx;3u zv_l$c)TlY$B~reKQ|?$u)i#|9gD*}|OuqgN%B`JgVJO2l3LnmfQJZ;J&IeV!wMTfI zF6;S5JF?B9l${%wW;wP_|J{Hns?bRC7i71J`9-)H?c3e5o3$7pceNz*_P&NTX`g*m zlzf5=4>t?@BgN9xQF9$sTBsP!&*$PTFkvDYzds_>C(XG9$hOhK*0`HFvg@xLZ*w7S zm8mwbc8p)aTz!+Wq)XR=COU20$UTckQPHXg)?KdD&>P5kXZXZTW=+p$&1Bn-!n#d9 zbP#ENgG3o1(BR*n? zbAUaNF5H$K3ki7o(+Thqh#}}n>u+mmT;riQz}6@rRDxW z4t}DrzD*%9A4eS=Oc#?ZAvr!7#NVJiOLgwxMQi_A1Qn~f@L-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