From 6572f85d784495a7365e0da4bfa59cd7194beaa8 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 17 May 2026 18:14:01 +0000 Subject: [PATCH 1/9] fix(release): require committed versionName for tag builds --- .github/workflows/build.yml | 14 ++++++++------ README.md | 7 ++++++- mobile/build.gradle | 5 ++--- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d735f8d5..769253a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,13 +190,16 @@ jobs: run: | test -e mobile/src/main/jniLibs/x86_64/libaw_server.so - - name: Set versionName + - name: Verify versionName matches tag if: startsWith(github.ref, 'refs/tags/v') # only on runs triggered from tag run: | - # Sets versionName, tail used to skip "v" at start of tag name - SHORT_VERSION=$(echo "${{ github.ref_name }}" | tail -c +2 -) - sed -i "s/versionName \".*\"/versionName \"$SHORT_VERSION\"/g" \ - mobile/build.gradle + SHORT_VERSION="${GITHUB_REF_NAME#v}" + COMMITTED_VERSION=$(sed -n 's/^[[:space:]]*versionName "\(.*\)"/\1/p' mobile/build.gradle) + if [ "$COMMITTED_VERSION" != "$SHORT_VERSION" ]; then + echo "mobile/build.gradle versionName must match the release tag." + echo "tag=$SHORT_VERSION committed=$COMMITTED_VERSION" + exit 1 + fi - name: Set versionCode run: | @@ -581,4 +584,3 @@ jobs: dist/*.apk dist/*.aab # body_path: dist/release_notes/release_notes.md - diff --git a/README.md b/README.md index bbb62012..6b19f9b4 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,12 @@ Once both aw-server-rust and aw-webui is built, you can build the Android app as ### Making a release -To make a release, make a signed tag and push it to GitHub: +Before tagging, update `mobile/build.gradle` so `versionName` matches the +release you are about to cut. The release workflow verifies the committed +`versionName` instead of patching it after checkout, which keeps tagged source, +GitHub release builds, and F-Droid builds on the same version. + +Then make a signed tag and push it to GitHub: ```sh git tag -s v0.1.0 diff --git a/mobile/build.gradle b/mobile/build.gradle index 8476d85c..3c8cbd2d 100644 --- a/mobile/build.gradle +++ b/mobile/build.gradle @@ -10,9 +10,8 @@ android { minSdkVersion 24 targetSdkVersion 34 - // Set in CI on tagged commit - // FIXME: should be set before tagging, so that F-droid picks it up correctly - // https://gitlab.com/fdroid/fdroiddata/-/merge_requests/11786?commit_id=d2cedcbe3d26db59378d582a8cf952af16b6407f#note_1966750559 + // Keep versionName committed in source so tagged builds and F-Droid agree. + // Tag workflows verify it matches refs/tags/v* instead of rewriting the checkout. versionName "0.12.1" // Set in CI by `bundle exec fastlane update_version` From 5dec05a01610368db9f9cabe6b53a958989f4623 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 17 May 2026 18:28:43 +0000 Subject: [PATCH 2/9] fix(ci): stabilize PR validation workflow --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 769253a9..ef8652c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,8 @@ jobs: # Rust - name: Set up Rust id: toolchain - uses: dtolnay/rust-toolchain@stable + # aw-server-rust@dc70318 predates its Rust 1.80+ dependency refresh. + uses: dtolnay/rust-toolchain@1.79.0 if: steps.cache-jniLibs.outputs.cache-hit != 'true' - name: Set up Rust toolchain for Android NDK @@ -108,7 +109,9 @@ jobs: # Needed for `fastlane update_version` - uses: adnsio/setup-age-action@v1.2.0 + if: github.event_name != 'pull_request' - name: Load Fastlane secrets + if: github.event_name != 'pull_request' env: KEY_FASTLANE_API: ${{ secrets.KEY_FASTLANE_API }} run: | @@ -121,6 +124,7 @@ jobs: # Retry this, in case there are concurrent jobs, which may lead to the error: # "Google Api Error: Invalid request - This Edit has been deleted." - name: Update versionCode + if: github.event_name != 'pull_request' uses: Wandalen/wretry.action@master with: command: bundle exec fastlane update_version From 8cc41fad77038a05cfb794514052d51a559a6ada Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 17 May 2026 18:34:39 +0000 Subject: [PATCH 3/9] fix(ci): harden versionName parsing --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef8652c4..24374622 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -198,7 +198,11 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') # only on runs triggered from tag run: | SHORT_VERSION="${GITHUB_REF_NAME#v}" - COMMITTED_VERSION=$(sed -n 's/^[[:space:]]*versionName "\(.*\)"/\1/p' mobile/build.gradle) + COMMITTED_VERSION=$(sed -n -E "s/^[[:space:]]*versionName[[:space:]]+['\"]([^'\"]+)['\"].*/\\1/p" mobile/build.gradle) + if [ -z "$COMMITTED_VERSION" ]; then + echo "Failed to parse versionName from mobile/build.gradle." + exit 1 + fi if [ "$COMMITTED_VERSION" != "$SHORT_VERSION" ]; then echo "mobile/build.gradle versionName must match the release tag." echo "tag=$SHORT_VERSION committed=$COMMITTED_VERSION" From b97c8d797f3bc739ce3e4c307630a07924051df3 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 17 May 2026 18:45:43 +0000 Subject: [PATCH 4/9] fix(ci): migrate artifact actions to v4 --- .github/workflows/build.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 24374622..da3ff9cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -233,9 +233,9 @@ jobs: make dist/aw-android.${{ matrix.type }} - name: Upload - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: aw-android + name: aw-android-${{ matrix.type }} path: dist/aw-android*.${{ matrix.type }} test: @@ -468,7 +468,7 @@ jobs: - name: Upload logcat if: ${{ success() || steps.test.conclusion == 'failure'}} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: logcat # mobile\build\outputs\connected_android_test_additional_output\debugAndroidTest\connected\Pixel_XL_API_32(AVD) - 12\ScreenshotTest_saveDeviceScreenBitmap.png @@ -484,7 +484,7 @@ jobs: # path: ./*.mov # out.mov - name: Upload screenshots - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ success() || steps.test.conclusion == 'failure'}} with: name: screenshots @@ -511,9 +511,10 @@ jobs: - uses: actions/checkout@v3 - name: Download APK & AAB - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: aw-android + pattern: aw-android-* + merge-multiple: true path: dist - name: Display structure of downloaded files @@ -567,9 +568,10 @@ jobs: # Will download all artifacts to path - name: Download release APK & AAB - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: aw-android + pattern: aw-android-* + merge-multiple: true path: dist - name: Display structure of downloaded files From b701a9215438f1523c2baa554ed547b13cb72226 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 17 May 2026 19:08:18 +0000 Subject: [PATCH 5/9] fix(ci): use current Android cmdline tools for E2E --- .github/workflows/build.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da3ff9cd..16b7a631 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -342,12 +342,21 @@ jobs: # # # Below code is majorly from https://github.com/actions/runner-images/issues/6152#issuecomment-1243718140 - name: Create Android emulator run: | + SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" + AVDMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager" + if [ ! -x "$SDKMANAGER" ]; then + SDKMANAGER="$(command -v sdkmanager)" + fi + if [ ! -x "$AVDMANAGER" ]; then + AVDMANAGER="$(command -v avdmanager)" + fi + # Install AVD files - echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-'$MATRIX_E_SDK';default;x86_64' - echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --licenses + echo "y" | "$SDKMANAGER" --install 'system-images;android-'$MATRIX_E_SDK';default;x86_64' + echo "y" | "$SDKMANAGER" --licenses # Create emulator - $ANDROID_HOME/tools/bin/avdmanager create avd -n $MATRIX_AVD -d pixel --package 'system-images;android-'$MATRIX_E_SDK';default;x86_64' + "$AVDMANAGER" create avd -n $MATRIX_AVD -d pixel --package 'system-images;android-'$MATRIX_E_SDK';default;x86_64' $ANDROID_HOME/emulator/emulator -list-avds if false; then emulator_config=~/.android/avd/$MATRIX_AVD.avd/config.ini From 5093d4013e98fc612ab8820e9155eeaa82638f10 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 17 May 2026 19:48:08 +0000 Subject: [PATCH 6/9] fix(ci): install and locate emulator for E2E --- .github/workflows/build.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16b7a631..cb6ae792 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -344,20 +344,26 @@ jobs: run: | SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" AVDMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager" + EMULATOR="$ANDROID_HOME/emulator/emulator" if [ ! -x "$SDKMANAGER" ]; then SDKMANAGER="$(command -v sdkmanager)" fi if [ ! -x "$AVDMANAGER" ]; then AVDMANAGER="$(command -v avdmanager)" fi + if [ ! -x "$EMULATOR" ]; then + EMULATOR="$(command -v emulator)" + fi # Install AVD files - echo "y" | "$SDKMANAGER" --install 'system-images;android-'$MATRIX_E_SDK';default;x86_64' + echo "y" | "$SDKMANAGER" --install \ + emulator \ + 'system-images;android-'$MATRIX_E_SDK';default;x86_64' echo "y" | "$SDKMANAGER" --licenses # Create emulator "$AVDMANAGER" create avd -n $MATRIX_AVD -d pixel --package 'system-images;android-'$MATRIX_E_SDK';default;x86_64' - $ANDROID_HOME/emulator/emulator -list-avds + "$EMULATOR" -list-avds if false; then emulator_config=~/.android/avd/$MATRIX_AVD.avd/config.ini # The following madness is to support empty OR populated config.ini files, @@ -387,10 +393,14 @@ jobs: SUFFIX: ${{ matrix.android_avd }}-eAPI-${{ matrix.android_emu_version }} HOMEBREW_NO_INSTALL_CLEANUP: 1 run: | + EMULATOR="$ANDROID_HOME/emulator/emulator" + if [ ! -x "$EMULATOR" ]; then + EMULATOR="$(command -v emulator)" + fi echo "Starting emulator and waiting for boot to complete...." ls -la $ANDROID_HOME/emulator - $ANDROID_HOME/tools/emulator --accel-check # check for hardware acceleration - nohup $ANDROID_HOME/tools/emulator -avd $MATRIX_AVD -gpu host -no-audio -no-boot-anim -camera-back none -camera-front none -qemu -m 2048 2>&1 & + "$EMULATOR" --accel-check # check for hardware acceleration + nohup "$EMULATOR" -avd $MATRIX_AVD -gpu host -no-audio -no-boot-anim -camera-back none -camera-front none -qemu -m 2048 2>&1 & $ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do echo "wait..."; sleep 1; done; input keyevent 82' echo "Emulator has finished booting" $ANDROID_HOME/platform-tools/adb devices From 12c757c7f69dfa6886f10fb92517f51341297429 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 17 May 2026 20:10:31 +0000 Subject: [PATCH 7/9] fix(ci): bootstrap Android tools in E2E --- .github/workflows/build.yml | 62 ++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb6ae792..b2e23e64 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -339,21 +339,33 @@ jobs: if: runner.os == 'macOS' run: brew install intel-haxm + - name: Set up Android SDK + uses: android-actions/setup-android@v2 + # # # Below code is majorly from https://github.com/actions/runner-images/issues/6152#issuecomment-1243718140 - name: Create Android emulator run: | - SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" - AVDMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager" - EMULATOR="$ANDROID_HOME/emulator/emulator" - if [ ! -x "$SDKMANAGER" ]; then - SDKMANAGER="$(command -v sdkmanager)" - fi - if [ ! -x "$AVDMANAGER" ]; then - AVDMANAGER="$(command -v avdmanager)" - fi - if [ ! -x "$EMULATOR" ]; then - EMULATOR="$(command -v emulator)" - fi + find_android_tool() { + local tool_path="$1" + local tool_name="$2" + + if [ -x "$tool_path" ]; then + printf '%s\n' "$tool_path" + return 0 + fi + + if command -v "$tool_name" >/dev/null 2>&1; then + command -v "$tool_name" + return 0 + fi + + echo "Missing required Android tool: $tool_name" >&2 + return 1 + } + + SDKMANAGER="$(find_android_tool "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" sdkmanager)" + AVDMANAGER="$(find_android_tool "$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager" avdmanager)" + EMULATOR="$(find_android_tool "$ANDROID_HOME/emulator/emulator" emulator)" # Install AVD files echo "y" | "$SDKMANAGER" --install \ @@ -395,19 +407,33 @@ jobs: run: | EMULATOR="$ANDROID_HOME/emulator/emulator" if [ ! -x "$EMULATOR" ]; then - EMULATOR="$(command -v emulator)" + EMULATOR="$(command -v emulator || true)" + fi + if [ -z "$EMULATOR" ]; then + echo "Missing required Android tool: emulator" >&2 + exit 1 + fi + ADB="$ANDROID_HOME/platform-tools/adb" + if [ ! -x "$ADB" ]; then + ADB="$(command -v adb || true)" + fi + if [ -z "$ADB" ]; then + echo "Missing required Android tool: adb" >&2 + exit 1 fi echo "Starting emulator and waiting for boot to complete...." - ls -la $ANDROID_HOME/emulator + ls -la "${EMULATOR%/*}" "$EMULATOR" --accel-check # check for hardware acceleration nohup "$EMULATOR" -avd $MATRIX_AVD -gpu host -no-audio -no-boot-anim -camera-back none -camera-front none -qemu -m 2048 2>&1 & - $ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do echo "wait..."; sleep 1; done; input keyevent 82' + "$ADB" wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do echo "wait..."; sleep 1; done; input keyevent 82' echo "Emulator has finished booting" - $ANDROID_HOME/platform-tools/adb devices + "$ADB" devices sleep 30 mkdir -p screenshots - screencapture screenshots/screenshot-$SUFFIX.jpg - $ANDROID_HOME/platform-tools/adb exec-out screencap -p > screenshots/emulator-$SUFFIX.png + if command -v screencapture >/dev/null 2>&1; then + screencapture screenshots/screenshot-$SUFFIX.jpg + fi + "$ADB" exec-out screencap -p > screenshots/emulator-$SUFFIX.png # # # Have to re-setup everything since we need to run emulator for faster performance on masOS ? Other os'es emulator will not startup ? # TODO: Optimize the steps taking into consideration all software present by default on macOS runner image From 814df080452e06e8baee24206929819c2bd16cec Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 17 May 2026 20:20:46 +0000 Subject: [PATCH 8/9] fix(ci): repair emulator bootstrap for E2E --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b2e23e64..3f7cb9da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -365,7 +365,6 @@ jobs: SDKMANAGER="$(find_android_tool "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" sdkmanager)" AVDMANAGER="$(find_android_tool "$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager" avdmanager)" - EMULATOR="$(find_android_tool "$ANDROID_HOME/emulator/emulator" emulator)" # Install AVD files echo "y" | "$SDKMANAGER" --install \ @@ -373,6 +372,9 @@ jobs: 'system-images;android-'$MATRIX_E_SDK';default;x86_64' echo "y" | "$SDKMANAGER" --licenses + # Resolve emulator path after installing the package. + EMULATOR="$(find_android_tool "$ANDROID_HOME/emulator/emulator" emulator)" + # Create emulator "$AVDMANAGER" create avd -n $MATRIX_AVD -d pixel --package 'system-images;android-'$MATRIX_E_SDK';default;x86_64' "$EMULATOR" -list-avds @@ -423,7 +425,7 @@ jobs: fi echo "Starting emulator and waiting for boot to complete...." ls -la "${EMULATOR%/*}" - "$EMULATOR" --accel-check # check for hardware acceleration + "$EMULATOR" -accel-check # check for hardware acceleration nohup "$EMULATOR" -avd $MATRIX_AVD -gpu host -no-audio -no-boot-anim -camera-back none -camera-front none -qemu -m 2048 2>&1 & "$ADB" wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do echo "wait..."; sleep 1; done; input keyevent 82' echo "Emulator has finished booting" From b74ade32d7e9a41cc922055f913fee7d3b8b69d4 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 17 May 2026 20:24:43 +0000 Subject: [PATCH 9/9] fix(ci): treat emulator accel check as advisory --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f7cb9da..a36e95a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -425,7 +425,9 @@ jobs: fi echo "Starting emulator and waiting for boot to complete...." ls -la "${EMULATOR%/*}" - "$EMULATOR" -accel-check # check for hardware acceleration + if ! "$EMULATOR" -accel-check; then + echo "Hardware acceleration unavailable; continuing with emulator default acceleration mode." + fi nohup "$EMULATOR" -avd $MATRIX_AVD -gpu host -no-audio -no-boot-anim -camera-back none -camera-front none -qemu -m 2048 2>&1 & "$ADB" wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do echo "wait..."; sleep 1; done; input keyevent 82' echo "Emulator has finished booting"