From 8fc323b48ab44715a694dd78a9e7fa47b618dc55 Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 22 May 2026 10:54:54 +0000 Subject: [PATCH 1/4] ci: upgrade deprecated GitHub Actions to Node.js 24-compatible versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Actions will be forced to run with Node.js 24 starting June 2nd, 2026. Update all deprecated action versions before the deadline: - actions/checkout: v2/v3 → v4 - actions/cache: v3 → v4 - actions/cache/restore: v3 → v4 - actions/setup-java: v1 → v4 (add distribution: temurin, now required) - android-actions/setup-android: v2 → v3 - actions/upload-artifact: v3 → v4 - actions/download-artifact: v3 → v4 - Wandalen/wretry.action: @master → @v3.8.0_js_action (pin stable) --- .github/workflows/build.yml | 51 ++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d735f8d5..5e0f9b6a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: name: Build aw-server-rust runs-on: ubicloud-standard-8 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' - name: Set RELEASE @@ -26,7 +26,7 @@ jobs: echo "RELEASE=${{ startsWith(github.ref_name, 'v') }}" >> $GITHUB_ENV - name: Cache JNI libs - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-jniLibs env: cache-name: jniLibs @@ -42,7 +42,7 @@ jobs: # Android SDK & NDK - name: Set up Android SDK if: steps.cache-jniLibs.outputs.cache-hit != 'true' - uses: android-actions/setup-android@v2 + uses: android-actions/setup-android@v3 - name: Set up Android NDK if: steps.cache-jniLibs.outputs.cache-hit != 'true' run: | @@ -63,7 +63,7 @@ jobs: ./aw-server-rust/install-ndk.sh - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 if: steps.cache-jniLibs.outputs.cache-hit != 'true' env: cache-name: cargo-build-target @@ -94,7 +94,7 @@ jobs: versionCode: ${{ steps.versionCode.outputs.versionCode }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: 'recursive' @@ -121,7 +121,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 - uses: Wandalen/wretry.action@master + uses: Wandalen/wretry.action@v3.8.0_js_action with: command: bundle exec fastlane update_version attempt_limit: 3 @@ -142,7 +142,7 @@ jobs: type: ['apk', 'aab'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: 'recursive' @@ -161,13 +161,14 @@ jobs: echo "RELEASE=${{ startsWith(github.ref_name, 'v') }}" >> $GITHUB_ENV - name: Set up JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: ${{ env.JAVA_VERSION }} + distribution: temurin # Android SDK & NDK - name: Set up Android SDK - uses: android-actions/setup-android@v2 + uses: android-actions/setup-android@v3 - name: Set up Android NDK run: | sdkmanager "ndk;${{ env.NDK_VERSION }}" @@ -177,7 +178,7 @@ jobs: # Restores jniLibs from cache # `actions/cache/restore` only restores, without saving back in a post-hook - - uses: actions/cache/restore@v3 + - uses: actions/cache/restore@v4 id: cache-jniLibs env: cache-name: jniLibs @@ -222,7 +223,7 @@ jobs: make dist/aw-android.${{ matrix.type }} - name: Upload - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: aw-android path: dist/aw-android*.${{ matrix.type }} @@ -235,7 +236,7 @@ jobs: SUPPLY_TRACK: production # used by fastlane to determine track to publish to steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: 'recursive' @@ -244,13 +245,14 @@ jobs: echo "RELEASE=${{ startsWith(github.ref_name, 'v') }}" >> $GITHUB_ENV - name: Set up JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: ${{ env.JAVA_VERSION }} + distribution: temurin # Android SDK & NDK - name: Set up Android SDK - uses: android-actions/setup-android@v2 + uses: android-actions/setup-android@v3 - name: Set up Android NDK run: | sdkmanager "ndk;${{ env.NDK_VERSION }}" @@ -261,7 +263,7 @@ jobs: # Restores jniLibs from cache # `actions/cache/restore` only restores, without saving back in a post-hook - - uses: actions/cache/restore@v3 + - uses: actions/cache/restore@v4 id: cache-jniLibs env: cache-name: jniLibs @@ -301,7 +303,7 @@ jobs: # android_emu_version: 32 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: 'recursive' @@ -311,7 +313,7 @@ jobs: # Restores jniLibs from cache # `actions/cache/restore` only restores, without saving back in a post-hook - - uses: actions/cache/restore@v3 + - uses: actions/cache/restore@v4 id: cache-jniLibs env: cache-name: jniLibs @@ -417,13 +419,14 @@ jobs: # ffmpeg -f avfoundation -i 0 -t 120 out$SUFFIX.mov & - name: Set up JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: ${{ env.JAVA_VERSION }} + distribution: temurin # Android SDK & NDK - name: Set up Android SDK - uses: android-actions/setup-android@v2 + uses: android-actions/setup-android@v3 - name: Set up Android NDK run: | sdkmanager "ndk;${{ env.NDK_VERSION }}" @@ -457,7 +460,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 @@ -473,7 +476,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 @@ -497,10 +500,10 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') # only on runs triggered from tag runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Download APK & AAB - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: aw-android path: dist @@ -556,7 +559,7 @@ 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 path: dist From dd673b9270ed5de3962ed46c404f4dedfc143857 Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 22 May 2026 11:01:19 +0000 Subject: [PATCH 2/4] fix(ci): fix artifact name collision for upload-artifact@v4 matrix jobs upload-artifact@v4 no longer allows concurrent jobs to write to the same artifact name. Split the upload into aw-android-apk and aw-android-aab, then use pattern + merge-multiple on download so release jobs still receive both files in one dist/ directory. Also remove the unused NODE_VERSION env var (EOL Node 16, never referenced). --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e0f9b6a..965ebced 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,6 @@ on: env: NDK_VERSION: '25.2.9519653' - NODE_VERSION: '16' JAVA_VERSION: '17' jobs: @@ -225,7 +224,7 @@ jobs: - name: Upload uses: actions/upload-artifact@v4 with: - name: aw-android + name: aw-android-${{ matrix.type }} path: dist/aw-android*.${{ matrix.type }} test: @@ -505,8 +504,9 @@ jobs: - name: Download APK & AAB uses: actions/download-artifact@v4 with: - name: aw-android + pattern: aw-android-* path: dist + merge-multiple: true - name: Display structure of downloaded files working-directory: dist @@ -557,12 +557,12 @@ jobs: runs-on: ubuntu-latest steps: - # Will download all artifacts to path - name: Download release APK & AAB uses: actions/download-artifact@v4 with: - name: aw-android + pattern: aw-android-* path: dist + merge-multiple: true - name: Display structure of downloaded files working-directory: dist From 09a02774cfc50c51a35ef17dc7122e3e4059ebd1 Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 22 May 2026 11:13:35 +0000 Subject: [PATCH 3/4] fix(ci): restore fork-safe workflow execution --- .github/workflows/build.yml | 120 +++++++++++++++++++++++++++++------- 1 file changed, 98 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 965ebced..f11350a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,9 @@ jobs: # Rust - name: Set up Rust id: toolchain - uses: dtolnay/rust-toolchain@stable + # Pin to 1.79.0: aw-server-rust@dc70318 uses `time` crate which fails to compile + # on Rust 1.80+ due to tightened type inference (E0282 in Box<_> expressions). + uses: dtolnay/rust-toolchain@1.79.0 if: steps.cache-jniLibs.outputs.cache-hit != 'true' - name: Set up Rust toolchain for Android NDK @@ -97,17 +99,18 @@ jobs: with: submodules: 'recursive' - - # Ruby & Fastlane - # version set by .ruby-version + # Ruby & Fastlane steps only run on the main repo (not fork PRs, which lack secrets). + # Fork PRs fall through to "Output versionCode" which reads directly from build.gradle. - name: Set up Ruby and install fastlane + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository uses: ruby/setup-ruby@v1 with: bundler-cache: true - # Needed for `fastlane update_version` - uses: adnsio/setup-age-action@v1.2.0 + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository - name: Load Fastlane secrets + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository env: KEY_FASTLANE_API: ${{ secrets.KEY_FASTLANE_API }} run: | @@ -120,12 +123,16 @@ 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' || github.event.pull_request.head.repo.full_name == github.repository uses: Wandalen/wretry.action@v3.8.0_js_action with: command: bundle exec fastlane update_version attempt_limit: 3 attempt_delay: 20000 + # Always reads versionCode from build.gradle. + # On non-fork runs, fastlane has already incremented it above. + # On fork PRs, this returns the current committed value as a safe fallback. - name: Output versionCode id: versionCode run: | @@ -135,6 +142,8 @@ jobs: name: Build ${{ matrix.type }} runs-on: ubicloud-standard-4 needs: [build-rust, get-versionCode] + # Skip on fork PRs: signing secrets are not available and upload would fail anyway. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository strategy: fail-fast: true matrix: @@ -329,16 +338,45 @@ jobs: if: runner.os == 'macOS' run: brew install intel-haxm + - name: Set up Android SDK + uses: android-actions/setup-android@v3 + # # # Below code is majorly from https://github.com/actions/runner-images/issues/6152#issuecomment-1243718140 - name: Create Android emulator run: | + 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)" + # 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 \ + emulator \ + '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 - $ANDROID_HOME/tools/bin/avdmanager create avd -n $MATRIX_AVD -d pixel --package 'system-images;android-'$MATRIX_E_SDK';default;x86_64' - $ANDROID_HOME/emulator/emulator -list-avds + "$AVDMANAGER" create avd -n $MATRIX_AVD -d pixel --package 'system-images;android-'$MATRIX_E_SDK';default;x86_64' + "$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, @@ -368,17 +406,37 @@ 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 || 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 - $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 & - $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' + ls -la "${EMULATOR%/*}" + 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" - $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 @@ -442,19 +500,38 @@ jobs: - name: Output and save logcat to file if: ${{ success() || steps.test.conclusion == 'failure'}} run: | + 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 mkdir -p mobile/build - adb logcat -d > mobile/build/logcat.log - adb logcat -v color & + "$ADB" logcat -d > mobile/build/logcat.log + "$ADB" logcat -v color & - name: Screenshot if: ${{ success() || steps.test.conclusion == 'failure'}} env: SUFFIX: ${{ matrix.android_avd }}-eAPI-${{ matrix.android_emu_version }} run: | - adb shell monkey -p net.activitywatch.android.debug 1 + 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 + "$ADB" shell monkey -p net.activitywatch.android.debug 1 sleep 10 - screencapture screenshots/pscreenshot-$SUFFIX.jpg - $ANDROID_HOME/platform-tools/adb exec-out screencap -p > screenshots/pemulator-$SUFFIX.png + mkdir -p screenshots + if command -v screencapture >/dev/null 2>&1; then + screencapture screenshots/pscreenshot-$SUFFIX.jpg + fi + "$ADB" exec-out screencap -p > screenshots/pemulator-$SUFFIX.png ls -alh screenshots/ - name: Upload logcat @@ -584,4 +661,3 @@ jobs: dist/*.apk dist/*.aab # body_path: dist/release_notes/release_notes.md - From 380851e5ea300c563ecda4d66f53248a74c96f69 Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 22 May 2026 14:08:37 +0000 Subject: [PATCH 4/4] ci: bump Test job runner from retired ubuntu-20.04 to ubuntu-22.04 GitHub retired the ubuntu-20.04 hosted-runner image; the Test job was intermittently stuck forever waiting for a runner that would never appear. ubuntu-22.04 is the stable LTS replacement. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f11350a0..bce0cb8d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -238,7 +238,7 @@ jobs: test: name: Test - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: [build-rust] env: SUPPLY_TRACK: production # used by fastlane to determine track to publish to