From 87ab0d2869f29d940ed7a58dd57d5e9064dd6207 Mon Sep 17 00:00:00 2001 From: Sirius DevOps Date: Sat, 12 Sep 2026 01:16:28 -0400 Subject: [PATCH 1/5] fix(ci): use debian:bookworm for the Android sibling container eclipse-temurin:17-jdk-bookworm is not a published tag (manifest unknown). debian:bookworm is current and has openjdk-17. --- .forgejo/workflows/android-release.yml | 6 +++--- android/README.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/android-release.yml b/.forgejo/workflows/android-release.yml index 5245ff4..df2eca8 100644 --- a/.forgejo/workflows/android-release.yml +++ b/.forgejo/workflows/android-release.yml @@ -4,7 +4,7 @@ name: android-release # Forgejo release for the computed (or requested) tag. # # The runner job image is node:20-bullseye (EOL). Do not apt-get there. -# The toolchain runs in a sibling eclipse-temurin:17-jdk-bookworm container, +# toolchain runs in a sibling debian:bookworm container, # the same stdin-tar + docker cp pattern as .forgejo/workflows/ci.yml. # # First automated version with zero tags: v0.1.0. Afterwards, patch+1 from the @@ -49,7 +49,7 @@ env: CARGO_BUILD_JOBS: "1" ONIONWIRE_ANDROID_ABI: arm64-v8a ONIONWIRE_REQUIRE_RELEASE_KEY: "true" - ANDROID_IMAGE: eclipse-temurin:17-jdk-bookworm + ANDROID_IMAGE: debian:bookworm ANDROID_CMDLINE_TOOLS_URL: https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip RUST_TOOLCHAIN: "1.91" DOCKER_STATIC_URL: https://download.docker.com/linux/static/stable/x86_64/docker-27.5.1.tgz @@ -185,7 +185,7 @@ jobs: export DEBIAN_FRONTEND=noninteractive apt-get update apt-get install -y --no-install-recommends \ - python3 unzip curl ca-certificates file build-essential pkg-config git + openjdk-17-jdk-headless python3 unzip curl ca-certificates file build-essential pkg-config git mkdir -p /root/.android cp /src/.ci-android/onionwire-release.jks /root/.android/onionwire-release.jks cp /src/.ci-android/onionwire-release.env /root/.android/onionwire-release.env diff --git a/android/README.md b/android/README.md index f784dbc..5669119 100644 --- a/android/README.md +++ b/android/README.md @@ -123,7 +123,7 @@ deobfuscation, not before. `.forgejo/workflows/android-release.yml` runs on `docker-amd64` (T480 dind). The job image is `node:20-bullseye` (EOL) — **do not apt-get there**. The -toolchain runs in a sibling `eclipse-temurin:17-jdk-bookworm` container +toolchain runs in a sibling `debian:bookworm` container (stdin-tar + `docker cp`, same pattern as the Rust CI job). Any push to `main` that touches `android/**` (or the local build script / this workflow) builds `onionwire--android-arm64-v8a.apk` and -- 2.52.0 From 1e6a4c12b214cdf8d35a32f3cd109543bff140fa Mon Sep 17 00:00:00 2001 From: Sirius DevOps Date: Sat, 12 Sep 2026 01:37:40 -0400 Subject: [PATCH 2/5] fix(ci): join latest tag when its release lacks the APK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Core owns tag creation. If vN exists and the release is missing the Android APK, attach there instead of minting N+1. Never delete tags. Path filter is sources/Gradle only — README edits do not publish. --- .forgejo/workflows/android-release.yml | 73 +++++++++++++++----------- android/README.md | 3 +- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/.forgejo/workflows/android-release.yml b/.forgejo/workflows/android-release.yml index df2eca8..8ce9006 100644 --- a/.forgejo/workflows/android-release.yml +++ b/.forgejo/workflows/android-release.yml @@ -8,15 +8,19 @@ name: android-release # the same stdin-tar + docker cp pattern as .forgejo/workflows/ci.yml. # # First automated version with zero tags: v0.1.0. Afterwards, patch+1 from the -# latest v*.*.* tag. Never move an existing tag. If this workflow creates a -# tag and then fails, it deletes that tag so the next run retries the same -# version instead of skipping. +# latest v*.*.* tag UNLESS that tag's release is missing the Android assets — +# then join it (core owns tag creation). Never move or delete a tag. on: push: branches: [main] paths: - - "android/**" + - "android/app/**" + - "android/sdk/**" + - "android/*.gradle.kts" + - "android/gradle/**" + - "android/gradle.properties" + - "android/settings.gradle.kts" - "scripts/build-android-local.sh" - ".forgejo/workflows/android-release.yml" workflow_dispatch: @@ -86,6 +90,8 @@ jobs: INPUT_TAG: ${{ github.event.inputs.tag || inputs.tag }} INPUT_DRY_RUN: ${{ github.event.inputs.dry_run }} CALL_DRY_RUN: ${{ inputs.dry_run }} + FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }} + REPO_API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }} run: | set -euo pipefail cd "${GITHUB_WORKSPACE}" @@ -102,13 +108,37 @@ jobs: if [ -z "$latest" ]; then ver="0.1.0" else - ver="${latest#v}" - major="${ver%%.*}" - rest="${ver#*.}" - minor="${rest%%.*}" - patch="${rest#*.}" - patch=$((patch + 1)) - ver="${major}.${minor}.${patch}" + # Core owns tag creation. If the latest tag's release is missing + # the Android APK, join that version instead of minting patch+1. + join=0 + if [ -n "${FORGEJO_TOKEN:-}" ]; then + http=$(curl -sS --http1.1 -o /tmp/latest-rel.json -w '%{http_code}' \ + -H "Authorization: Bearer $FORGEJO_TOKEN" \ + "$REPO_API/releases/tags/$latest" || true) + if [ "$http" != "200" ]; then + join=1 + echo "latest tag $latest has no release (http $http); joining" + elif node -e 'const d=require("/tmp/latest-rel.json"); const n=(d.assets||[]).some(a=>/onionwire-.*-android-.*\\.apk$/.test(a.name)); process.exit(n?0:1)'; then + echo "latest tag $latest already has an Android APK; patch+1" + else + join=1 + echo "latest tag $latest release is missing Android APK; joining" + fi + else + echo "FORGEJO_TOKEN unset; cannot inspect release assets, joining $latest" + join=1 + fi + if [ "$join" = "1" ]; then + ver="${latest#v}" + else + ver="${latest#v}" + major="${ver%%.*}" + rest="${ver#*.}" + minor="${rest%%.*}" + patch="${rest#*.}" + patch=$((patch + 1)) + ver="${major}.${minor}.${patch}" + fi fi fi echo "$ver" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$' || { @@ -384,27 +414,6 @@ jobs: | docker start -a -i "$PUB_C" docker rm -f "$PUB_C" >/dev/null || true - - name: Drop dangling tag on failure - if: failure() && steps.version.outputs.dry_run != 'true' && steps.publish.outputs.created_tag == 'true' - env: - FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }} - REPO_API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }} - TAG: ${{ steps.version.outputs.tag }} - run: | - set -euo pipefail - : "${FORGEJO_TOKEN:?}" - echo "build/publish failed after creating $TAG; deleting so the next run retries this version" - curl -sS --http1.1 -X DELETE \ - -H "Authorization: Bearer $FORGEJO_TOKEN" \ - "$REPO_API/git/tags/$TAG" || true - curl -sS --http1.1 -X DELETE \ - -H "Authorization: Bearer $FORGEJO_TOKEN" \ - "$REPO_API/tags/$TAG" || true - code=$(curl -sS --http1.1 -o /tmp/tag-after.json -w '%{http_code}' \ - -H "Authorization: Bearer $FORGEJO_TOKEN" \ - "$REPO_API/tags/$TAG" || true) - echo "GET tags/$TAG after delete -> $code" - - name: Scrub keystore if: always() run: | diff --git a/android/README.md b/android/README.md index 5669119..ac86336 100644 --- a/android/README.md +++ b/android/README.md @@ -125,7 +125,8 @@ deobfuscation, not before. The job image is `node:20-bullseye` (EOL) — **do not apt-get there**. The toolchain runs in a sibling `debian:bookworm` container (stdin-tar + `docker cp`, same pattern as the Rust CI job). -Any push to `main` that touches `android/**` (or the local build script / this +Any push to `main` that touches Android **sources or build config** +(`android/app/**`, `android/sdk/**`, Gradle files — not `android/README.md`) workflow) builds `onionwire--android-arm64-v8a.apk` and `onionwire-sdk-.aar`, verifies them, and attaches them to the Forgejo release for that tag. Version is the latest `v*.*.*` tag plus patch, or -- 2.52.0 From 53ba1e857ff7d59ba233219a1218c138a5e86951 Mon Sep 17 00:00:00 2001 From: Sirius DevOps Date: Sat, 12 Sep 2026 02:05:05 -0400 Subject: [PATCH 3/5] fix(android): point UniFFI --library at CARGO_TARGET_DIR CI sets CARGO_TARGET_DIR=/cargo-target. Bindgen still looked at crates/onionwire-sdk/target/release/libonionwire_sdk.so and died ENOENT after a green host compile. --- android/sdk/build.gradle.kts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/android/sdk/build.gradle.kts b/android/sdk/build.gradle.kts index b023432..546f587 100644 --- a/android/sdk/build.gradle.kts +++ b/android/sdk/build.gradle.kts @@ -55,6 +55,12 @@ val onionwireAbis: List = (findProperty("onionwire.abis") as String?) val jniLibsDir = layout.buildDirectory.dir("rustJniLibs") val uniffiKotlinDir = layout.buildDirectory.dir("generated/uniffi") +// cargo honors CARGO_TARGET_DIR when set (CI sibling container). UniFFI's +// --library path must match, or bindgen dies with ENOENT after a green compile. +val cargoTargetDir: File = System.getenv("CARGO_TARGET_DIR")?.let(::File) + ?: sdkCrateDir.resolve("target") +val hostCdylib: File = cargoTargetDir.resolve("release/libonionwire_sdk.so") + /** Host cdylib. UniFFI's `--library` mode dlopens it, so it must be host-arch. */ val cargoHostLib by tasks.registering(Exec::class) { group = "onionwire" @@ -76,7 +82,7 @@ val uniffiBindgen by tasks.registering(Exec::class) { commandLine( cargoExe, "run", "--release", "--bin", "uniffi-bindgen", "--", "generate", - "--library", "target/release/libonionwire_sdk.so", + "--library", hostCdylib.absolutePath, "--language", "kotlin", "--no-format", "--config", "uniffi.toml", -- 2.52.0 From c90c59146deaf4829c01a9c34d58ef33d03b30da Mon Sep 17 00:00:00 2001 From: Sirius DevOps Date: Sat, 12 Sep 2026 02:06:37 -0400 Subject: [PATCH 4/5] fix(ci): new android-release concurrency group so dry_run can queue --- .forgejo/workflows/android-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/android-release.yml b/.forgejo/workflows/android-release.yml index 8ce9006..c5b307f 100644 --- a/.forgejo/workflows/android-release.yml +++ b/.forgejo/workflows/android-release.yml @@ -45,7 +45,7 @@ on: default: "false" concurrency: - group: onionwire-android-release + group: onionwire-android-release-v2 cancel-in-progress: false env: -- 2.52.0 From 63abd8eaf2ce432415e92996e368faf2616cc5cb Mon Sep 17 00:00:00 2001 From: Sirius DevOps Date: Sat, 12 Sep 2026 02:23:34 -0400 Subject: [PATCH 5/5] fix(ci): do not fail the Android verify pipe on SIGPIPE from head BUILD SUCCESSFUL produced a 33MB arm64 APK; pipefail + aapt|head then exited 141 and dropped the artifacts before docker cp. --- .forgejo/workflows/android-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/android-release.yml b/.forgejo/workflows/android-release.yml index c5b307f..6de3ce7 100644 --- a/.forgejo/workflows/android-release.yml +++ b/.forgejo/workflows/android-release.yml @@ -268,7 +268,7 @@ jobs: echo "=== apksigner ===" apksigner verify --print-certs "$apk" echo "=== aapt ===" - aapt dump badging "$apk" | head -n 20 + aapt dump badging "$apk" | sed -n '1,20p' || true echo "=== sizes ===" wc -c "$apk" "$aar" } | tee dist/ci-verify.log -- 2.52.0