From 8c3c52496f9c80d129f9ebf346a65287c5752cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 8 Oct 2023 15:54:28 +0200 Subject: [PATCH 01/12] build: added bundle (.aab) building --- .github/workflows/build.yml | 17 +++++++++++----- Makefile | 40 ++++++++++++++++++++++++++----------- scripts/sign_apk.sh | 36 +++++++++++++++++++++++---------- 3 files changed, 65 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b6c50b5..2f1b1a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,7 +89,7 @@ jobs: build-apk: - name: Build APK (${{ matrix.os }}, java-${{ matrix.java_version }}) + name: Build APK & AAB (${{ matrix.os }}, java-${{ matrix.java_version }}) runs-on: ${{ matrix.os }} needs: [build-rust] env: @@ -104,12 +104,12 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' - + - uses: ActivityWatch/check-version-format-action@v2 id: version with: prefix: 'v' - + - name: Echo version run: | echo "${{ steps.version.outputs.full }} (stable: ${{ steps.version.outputs.is_stable }})" @@ -197,19 +197,26 @@ jobs: cat android.jks.age | age -d -i android.jks.key -o android.jks rm android.jks.key - - name: Assemble APK + - name: Assemble APK and AAB env: JKS_STOREPASS: ${{ secrets.KEY_ANDROID_JKS_STOREPASS }} JKS_KEYPASS: ${{ secrets.KEY_ANDROID_JKS_KEYPASS }} run: | make dist/aw-android.apk + make dist/aw-android.aab - - name: Upload release APK + - name: Upload APK uses: actions/upload-artifact@v3 with: name: aw-android path: dist/aw-android*.apk + - name: Upload AAB + uses: actions/upload-artifact@v3 + with: + name: aw-android + path: dist/aw-android*.aab + test-e2e: name: Test E2E ${{ matrix.android_avd }} #-${{ matrix.os }}-eAPI-${{ matrix.android_emu_version }}-java-${{ matrix.java_version }}-node-${{ matrix.node_version }} needs: [build-rust] diff --git a/Makefile b/Makefile index f6a972c..4764e42 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,11 @@ SHELL := /bin/bash # - https://developer.android.com/ndk/guides/android_mk RELEASE_TYPE = $(shell test -n "$$RELEASE" && $$RELEASE && echo 'release' || echo 'debug') +RELEASE_TYPE_CAPS = $(shell test -n "$$RELEASE" && $$RELEASE && echo 'Release' || echo 'Debug') HAS_SECRETS = $(shell test -n "$$JKS_KEYPASS" && echo 'true' || echo 'false') APKDIR = mobile/build/outputs/apk +AABDIR = mobile/build/outputs/bundle WEBUI_SRCDIR := aw-server-rust/aw-webui WEBUI_DISTDIR := $(WEBUI_SRCDIR)/dist @@ -16,6 +18,9 @@ WEBUI_DISTDIR := $(WEBUI_SRCDIR)/dist all: aw-server-rust build: all +# builds an app bundle, puts it in dist +build-bundle: dist/aw-android.aab + # builds a complete, signed apk, puts it in dist build-apk: dist/aw-android.apk @@ -55,32 +60,43 @@ install-apk-debug: $(APKDIR)/debug/mobile-debug.apk adb install $(APKDIR)/debug/mobile-debug-androidTest.apk # APK targets -$(APKDIR)/release/mobile-release-unsigned.apk: - TERM=xterm ./gradlew assembleRelease - tree $(APKDIR) - -$(APKDIR)/debug/mobile-debug.apk: - TERM=xterm ./gradlew assembleDebug +$(APKDIR)/$(RELEASE_TYPE)/mobile-$(RELEASE_TYPE)%.apk: + TERM=xterm ./gradlew assemble$(RELEASE_TYPE_CAPS) tree $(APKDIR) -$(APKDIR)/androidTest/debug/mobile-debug-androidTest.apk: +$(APKDIR)/androidTest/$(RELEASE_TYPE)/mobile-$(RELEASE_TYPE)-androidTest.apk: TERM=xterm ./gradlew assembleAndroidTest tree $(APKDIR) +# App bundle targets +$(AABDIR)/$(RELEASE_TYPE)/mobile-$(RELEASE_TYPE).aab: + TERM=xterm ./gradlew bundle$(RELEASE_TYPE_CAPS) + tree $(AABDIR) + +# Signed release bundle +dist/aw-android.aab: $(AABDIR)/$(RELEASE_TYPE)/mobile-$(RELEASE_TYPE).aab + mkdir -p dist + @# Only sign if we have key secrets set ($JKS_KEYPASS and $JKS_STOREPASS) +ifneq ($(HAS_SECRETS), true) + @echo "No key secrets set, not signing" + cp $< $@ +else + ./scripts/sign_apk.sh $< $@ +endif + # Signed release APK -dist/aw-android.apk: $(APKDIR)/release/mobile-release-unsigned.apk - @# TODO: Name the APK based on the version number or commit hash. +dist/aw-android.apk: $(APKDIR)/$(RELEASE_TYPE)/mobile-$(RELEASE_TYPE)-unsigned.apk mkdir -p dist @# Only sign if we have key secrets set ($JKS_KEYPASS and $JKS_STOREPASS) ifneq ($(HAS_SECRETS), true) - @echo "No key secrets set, not signing APK" + @echo "No key secrets set, not signing" cp $< $@ else ./scripts/sign_apk.sh $< $@ endif # for mobile-debug.apk and mobile-debug-androidTest.apk -dist/debug/%: $(APKDIR)/debug/% +dist/$(RELEASE_TYPE)/%: $(APKDIR)/$(RELEASE_TYPE)/% mkdir -p dist cp $< $@ @@ -103,7 +119,7 @@ TARGET_x64 := $(TARGET)/x86_64-linux-android TARGET_x86 := $(TARGET)/i686-linux-android # Build webui specifically for Android (disabled update check, different default views, etc) -export ON_ANDROID := -- --android +export ON_ANDROID := -- --android aw-server-rust: $(JNILIBS) diff --git a/scripts/sign_apk.sh b/scripts/sign_apk.sh index 6c27bbf..c0c4e17 100755 --- a/scripts/sign_apk.sh +++ b/scripts/sign_apk.sh @@ -1,5 +1,7 @@ #!/bin/bash +# Signs APKs or AABs using the android.jks keystore + set -e input=$1 @@ -22,19 +24,31 @@ if [ -z $JKS_KEYPASS ]; then fi # Zipalign -zipalign=$(find $ANDROID_HOME/build-tools -name "zipalign" -print | head -n 1) -$zipalign -v -p 4 $input $input.new -mv $input.new $input +# Not needed for AABs +if [[ $input == *.apk ]]; then + zipalign=$(find $ANDROID_HOME/build-tools -name "zipalign" -print | head -n 1) + $zipalign -v -p 4 $input $input.new + mv $input.new $input +fi # Sign -# Using apksigner instead of jarsigner since API 30+: https://stackoverflow.com/a/69473649 -apksigner=$(find $ANDROID_HOME/build-tools -name "apksigner" -print | head -n 1) -$apksigner sign --ks android.jks --ks-key-alias activitywatch \ - --ks-pass env:JKS_STOREPASS --key-pass env:JKS_KEYPASS \ - $input - -# Verify -$apksigner verify $input +# Using apksigner for APKs instead of jarsigner since API 30+: https://stackoverflow.com/a/69473649 +# Using jarsigner for AABs since apksigner doesn't support them +if [[ $input == *.apk ]]; then + apksigner=$(find $ANDROID_HOME/build-tools -name "apksigner" -print | head -n 1) + $apksigner sign --ks android.jks --ks-key-alias activitywatch \ + --ks-pass env:JKS_STOREPASS --key-pass env:JKS_KEYPASS \ + $input + + # Verify + $apksigner verify $input +fi +if [[ $input == *.aab ]]; then + jarsigner -verbose \ + -keystore android.jks activitywatch \ + -storepass $JKS_STOREPASS -keypass $JKS_KEYPASS \ + $input activitywatch +fi # Move to output destination mv $input $output From f95441d79335552c6d6496e2f2c7b0381306f5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 8 Oct 2023 16:23:06 +0200 Subject: [PATCH 02/12] fix: fixed Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4764e42..c3c5098 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ else endif # Signed release APK -dist/aw-android.apk: $(APKDIR)/$(RELEASE_TYPE)/mobile-$(RELEASE_TYPE)-unsigned.apk +dist/aw-android.apk: $(APKDIR)/$(RELEASE_TYPE)/mobile-$(RELEASE_TYPE)%.apk mkdir -p dist @# Only sign if we have key secrets set ($JKS_KEYPASS and $JKS_STOREPASS) ifneq ($(HAS_SECRETS), true) From e4047af5fa3a808e50924f3edfd4421c7869b152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 8 Oct 2023 16:23:42 +0200 Subject: [PATCH 03/12] ci: refactored test into separate job, misc simplifications --- .github/workflows/build.yml | 104 +++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2f1b1a3..9f1a19a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,15 +8,15 @@ on: pull_request: branches: [ master ] +env: + NDK_VERSION: '25.2.9519653' + NODE_VERSION: '16' + JAVA_VERSION: '17' + jobs: build-rust: - name: Build aw-server-rust (ndk-${{ matrix.ndk_version }}, node-${{ matrix.node_version }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04] - ndk_version: ['25.2.9519653'] - node_version: [16] + name: Build aw-server-rust + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 with: @@ -32,7 +32,7 @@ jobs: cache-name: jniLibs with: path: mobile/src/main/jniLibs/ - key: ${{ env.cache-name }}-release-${{ env.RELEASE }}-ndk-${{ matrix.ndk_version }}-${{ hashFiles('.git/modules/aw-server-rust/HEAD') }} + key: ${{ env.cache-name }}-release-${{ env.RELEASE }}-ndk-${{ env.NDK_VERSION }}-${{ hashFiles('.git/modules/aw-server-rust/HEAD') }} - name: Display structure of downloaded files if: steps.cache-jniLibs.outputs.cache-hit == 'true' run: | @@ -45,8 +45,8 @@ jobs: - name: Install NDK if: steps.cache-jniLibs.outputs.cache-hit != 'true' run: | - sdkmanager "ndk;${{ matrix.ndk_version }}" - ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/${{ matrix.ndk_version }}" + sdkmanager "ndk;${{ env.NDK_VERSION }}" + ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/${{ env.NDK_VERSION }}" ls $ANDROID_NDK_HOME echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV @@ -89,17 +89,11 @@ jobs: build-apk: - name: Build APK & AAB (${{ matrix.os }}, java-${{ matrix.java_version }}) - runs-on: ${{ matrix.os }} + name: Build APK & AAB + runs-on: ubuntu-20.04 needs: [build-rust] env: SUPPLY_TRACK: production # used by fastlane to determine track to publish to - strategy: - fail-fast: false - matrix: - os: [ubuntu-20.04] - java_version: [17] - ndk_version: ['25.2.9519653'] steps: - uses: actions/checkout@v2 with: @@ -130,15 +124,15 @@ jobs: - name: Set up JDK uses: actions/setup-java@v1 with: - java-version: ${{ matrix.java_version }} + java-version: ${{ env.JAVA_VERSION }} # Android SDK & NDK - name: Set up Android SDK uses: android-actions/setup-android@v2 - name: Install NDK run: | - sdkmanager "ndk;${{ matrix.ndk_version }}" - ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/${{ matrix.ndk_version }}" + sdkmanager "ndk;${{ env.NDK_VERSION }}" + ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/${{ env.NDK_VERSION }}" ls $ANDROID_NDK_HOME echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV @@ -183,11 +177,6 @@ jobs: - name: Update versionCode run: bundle exec fastlane update_version - # Test - - name: Test - run: | - make test - - name: Load Android secrets if: env.KEY_ANDROID_JKS != null env: @@ -217,11 +206,53 @@ jobs: name: aw-android path: dist/aw-android*.aab + test: + name: Test + runs-on: ubuntu-20.04 + needs: [build-rust] + env: + SUPPLY_TRACK: production # used by fastlane to determine track to publish to + + steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: ${{ env.JAVA_VERSION }} + + # Android SDK & NDK + - name: Set up Android SDK + uses: android-actions/setup-android@v2 + - name: Install NDK + run: | + sdkmanager "ndk;${{ env.NDK_VERSION }}" + ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/${{ env.NDK_VERSION }}" + ls $ANDROID_NDK_HOME + echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV + + - name: Download JNI libs + uses: actions/download-artifact@v3 + with: + name: jniLibs + path: mobile/src/main/jniLibs + - name: Check that jniLibs present + run: | + test -e mobile/src/main/jniLibs/x86_64/libaw_server.so + + # Test + - name: Test + run: | + make test + + test-e2e: - name: Test E2E ${{ matrix.android_avd }} #-${{ matrix.os }}-eAPI-${{ matrix.android_emu_version }}-java-${{ matrix.java_version }}-node-${{ matrix.node_version }} + name: Test E2E needs: [build-rust] if: false # disabled - runs-on: ${{ matrix.os }} + runs-on: "macos-12" # macOS-latest env: MATRIX_E_SDK: ${{ matrix.android_emu_version }} MATRIX_AVD: ${{ matrix.android_avd }} @@ -229,10 +260,7 @@ jobs: fail-fast: false max-parallel: 1 matrix: - os: [macos-12] # macOS-latest, android_avd: [Pixel_API_27_AOSP] - java_version: [11] - ndk_version: ['25.2.9519653'] include: - android_avd: Pixel_API_27_AOSP android_emu_version: 27 @@ -291,7 +319,7 @@ jobs: - name: Start Android emulator timeout-minutes: 30 # ~4min normal - 3x DOSafety env: - SUFFIX: ${{ matrix.android_avd }}-eAPI-${{ matrix.android_emu_version }}-${{ matrix.os }} + SUFFIX: ${{ matrix.android_avd }}-eAPI-${{ matrix.android_emu_version }} HOMEBREW_NO_INSTALL_CLEANUP: 1 run: | echo "Starting emulator and waiting for boot to complete...." @@ -345,15 +373,15 @@ jobs: - name: Set up JDK uses: actions/setup-java@v1 with: - java-version: ${{ matrix.java_version }} + java-version: ${{ env.JAVA_VERSION }} # Android SDK & NDK - name: Set up Android SDK uses: android-actions/setup-android@v2 - name: Install NDK run: | - sdkmanager "ndk;${{ matrix.ndk_version }}" - ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/${{ matrix.ndk_version }}" + sdkmanager "ndk;${{ env.NDK_VERSION }}" + ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/${{ env.NDK_VERSION }}" ls $ANDROID_NDK_HOME echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV @@ -373,7 +401,7 @@ jobs: - name: Screenshot if: ${{ success() || steps.test.conclusion == 'failure'}} env: - SUFFIX: ${{ matrix.android_avd }}-eAPI-${{ matrix.android_emu_version }}-${{ matrix.os }} + SUFFIX: ${{ matrix.android_avd }}-eAPI-${{ matrix.android_emu_version }} run: | adb shell monkey -p net.activitywatch.android.debug 1 sleep 10 @@ -419,7 +447,7 @@ jobs: # cat GITHUB_STEP_SUMMARY.html >> $GITHUB_STEP_SUMMARY release-fastlane: - needs: [build-apk] + needs: [build-apk, test] if: startsWith(github.ref, 'refs/tags/v') # only on runs triggered from tag runs-on: ubuntu-latest steps: @@ -474,7 +502,7 @@ jobs: bundle exec fastlane supply run --apk dist/*.apk release-gh: - needs: [build-apk] + needs: [build-apk, test] if: startsWith(github.ref, 'refs/tags/v') # only on runs triggered from tag runs-on: ubuntu-latest steps: From 6a6fa2bc76c0aa5388ab9d2041663fecce24e11f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 8 Oct 2023 16:33:08 +0200 Subject: [PATCH 04/12] fix: fixed Makefile --- Makefile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index c3c5098..f49b0a3 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,7 @@ install-apk-debug: $(APKDIR)/debug/mobile-debug.apk adb install $(APKDIR)/debug/mobile-debug-androidTest.apk # APK targets -$(APKDIR)/$(RELEASE_TYPE)/mobile-$(RELEASE_TYPE)%.apk: +$(APKDIR)/$(RELEASE_TYPE)/mobile-$(RELEASE_TYPE).apk: TERM=xterm ./gradlew assemble$(RELEASE_TYPE_CAPS) tree $(APKDIR) @@ -85,7 +85,7 @@ else endif # Signed release APK -dist/aw-android.apk: $(APKDIR)/$(RELEASE_TYPE)/mobile-$(RELEASE_TYPE)%.apk +dist/aw-android.apk: $(APKDIR)/$(RELEASE_TYPE)/mobile-$(RELEASE_TYPE).apk mkdir -p dist @# Only sign if we have key secrets set ($JKS_KEYPASS and $JKS_STOREPASS) ifneq ($(HAS_SECRETS), true) @@ -174,8 +174,3 @@ clean: rm -rf mobile/src/main/assets/webui rm -rf mobile/src/main/jniLibs -test: - bundle exec fastlane test - # ./gradlew clean lint test - # ./gradlew connectedAndroidTest # || true - From 953cca45f0e1abc2247c94e08e6404e3243a6366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 8 Oct 2023 16:44:14 +0200 Subject: [PATCH 05/12] fix: fixed sign_apk script --- scripts/sign_apk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sign_apk.sh b/scripts/sign_apk.sh index c0c4e17..e4ccc17 100755 --- a/scripts/sign_apk.sh +++ b/scripts/sign_apk.sh @@ -47,7 +47,7 @@ if [[ $input == *.aab ]]; then jarsigner -verbose \ -keystore android.jks activitywatch \ -storepass $JKS_STOREPASS -keypass $JKS_KEYPASS \ - $input activitywatch + $input fi # Move to output destination From e86e0c3280ad224a7c5006c4ca2842f28142b2a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 8 Oct 2023 16:44:47 +0200 Subject: [PATCH 06/12] ci: replace artifact upload/download with cache reuse --- .github/workflows/build.yml | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f1a19a..c63948d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,6 +33,7 @@ jobs: with: path: mobile/src/main/jniLibs/ key: ${{ env.cache-name }}-release-${{ env.RELEASE }}-ndk-${{ env.NDK_VERSION }}-${{ hashFiles('.git/modules/aw-server-rust/HEAD') }} + - name: Display structure of downloaded files if: steps.cache-jniLibs.outputs.cache-hit == 'true' run: | @@ -81,12 +82,6 @@ jobs: run: | test -e mobile/src/main/jniLibs/x86_64/libaw_server.so - - name: Upload JNI libs - uses: actions/upload-artifact@v3 - with: - name: jniLibs - path: mobile/src/main/jniLibs/ - build-apk: name: Build APK & AAB @@ -146,11 +141,17 @@ jobs: - name: Install age uses: adnsio/setup-age-action@v1.2.0 - - name: Download JNI libs - uses: actions/download-artifact@v3 + # Restores jniLibs from cache + # `actions/cache/restore` only restores, without saving back in a post-hook + - uses: actions/cache/restore@v3 + id: cache-jniLibs + env: + cache-name: jniLibs with: - name: jniLibs - path: mobile/src/main/jniLibs + path: mobile/src/main/jniLibs/ + key: ${{ env.cache-name }}-release-${{ env.RELEASE }}-ndk-${{ env.NDK_VERSION }}-${{ hashFiles('.git/modules/aw-server-rust/HEAD') }} + fail-on-cache-miss: true + - name: Check that jniLibs present run: | test -e mobile/src/main/jniLibs/x86_64/libaw_server.so @@ -233,11 +234,17 @@ jobs: ls $ANDROID_NDK_HOME echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV - - name: Download JNI libs - uses: actions/download-artifact@v3 + + # Restores jniLibs from cache + # `actions/cache/restore` only restores, without saving back in a post-hook + - uses: actions/cache/restore@v3 + id: cache-jniLibs + env: + cache-name: jniLibs with: - name: jniLibs - path: mobile/src/main/jniLibs + path: mobile/src/main/jniLibs/ + key: ${{ env.cache-name }}-release-${{ env.RELEASE }}-ndk-${{ env.NDK_VERSION }}-${{ hashFiles('.git/modules/aw-server-rust/HEAD') }} + fail-on-cache-miss: true - name: Check that jniLibs present run: | test -e mobile/src/main/jniLibs/x86_64/libaw_server.so From 24d4b3ca9fee579adcf350e7b79fc366d6b10732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 8 Oct 2023 16:47:55 +0200 Subject: [PATCH 07/12] ci: set RELEASE for job needed for cache key --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c63948d..8d35462 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -219,6 +219,10 @@ jobs: with: submodules: 'recursive' + - name: Set RELEASE + run: | + echo "RELEASE=${{ startsWith(github.ref_name, 'v') }}" >> $GITHUB_ENV + - name: Set up JDK uses: actions/setup-java@v1 with: From 5a1a826006a672dd755bfb8bd1366e7ede6f45f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 8 Oct 2023 16:54:00 +0200 Subject: [PATCH 08/12] fix: fixed sign_apk --- scripts/sign_apk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/sign_apk.sh b/scripts/sign_apk.sh index e4ccc17..4feb860 100755 --- a/scripts/sign_apk.sh +++ b/scripts/sign_apk.sh @@ -45,9 +45,9 @@ if [[ $input == *.apk ]]; then fi if [[ $input == *.aab ]]; then jarsigner -verbose \ - -keystore android.jks activitywatch \ + -keystore android.jks \ -storepass $JKS_STOREPASS -keypass $JKS_KEYPASS \ - $input + $input activitywatch fi # Move to output destination From 0eb99ab1897c1941984d398b1434d49ceaec3178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 8 Oct 2023 17:06:08 +0200 Subject: [PATCH 09/12] ci: use .aab bundle for releases with fastlane, upload .aab to GitHub release --- .github/workflows/build.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d35462..022c20f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -464,7 +464,7 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Download release APK + - name: Download APK & AAB uses: actions/download-artifact@v3 with: name: aw-android @@ -510,7 +510,8 @@ jobs: - name: Release with fastlane run: | - bundle exec fastlane supply run --apk dist/*.apk + # bundle exec fastlane supply run --apk dist/*.apk + bundle exec fastlane supply run --aab dist/*.aab release-gh: needs: [build-apk, test] @@ -519,7 +520,7 @@ jobs: steps: # Will download all artifacts to path - - name: Download release APK + - name: Download release APK & AAB uses: actions/download-artifact@v3 with: name: aw-android @@ -541,6 +542,8 @@ jobs: with: draft: true prerelease: ${{ !(steps.version.outputs.is_stable == 'true') }} # must compare to true, since boolean outputs are actually just strings, and "false" is truthy since it's not empty: https://github.com/actions/runner/issues/1483#issuecomment-994986996 - files: dist/*.apk + files: | + dist/*.apk + dist/*.aab # body_path: dist/release_notes/release_notes.md From b343a10f105bd46265ac4d2c977c1c307773254c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 8 Oct 2023 17:06:44 +0200 Subject: [PATCH 10/12] build(gradle): set ndk.debugSymbolLevel 'SYMBOL_TABLE' --- mobile/build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mobile/build.gradle b/mobile/build.gradle index 159a0ec..f4d5243 100644 --- a/mobile/build.gradle +++ b/mobile/build.gradle @@ -29,6 +29,9 @@ android { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + ndk { + debugSymbolLevel 'SYMBOL_TABLE' + } } debug { applicationIdSuffix ".debug" From eec94b096ee11f02eccd0d7354191f6806dde977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 8 Oct 2023 17:14:50 +0200 Subject: [PATCH 11/12] ci: split building apk and aab using matrix --- .github/workflows/build.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 022c20f..00906ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,11 +84,16 @@ jobs: build-apk: - name: Build APK & AAB + name: Build ${{ matrix.type }} runs-on: ubuntu-20.04 needs: [build-rust] env: SUPPLY_TRACK: production # used by fastlane to determine track to publish to + strategy: + fail-fast: true + matrix: + type: ['apk', 'aab'] + steps: - uses: actions/checkout@v2 with: @@ -187,25 +192,18 @@ jobs: cat android.jks.age | age -d -i android.jks.key -o android.jks rm android.jks.key - - name: Assemble APK and AAB + - name: Assemble env: JKS_STOREPASS: ${{ secrets.KEY_ANDROID_JKS_STOREPASS }} JKS_KEYPASS: ${{ secrets.KEY_ANDROID_JKS_KEYPASS }} run: | - make dist/aw-android.apk - make dist/aw-android.aab - - - name: Upload APK - uses: actions/upload-artifact@v3 - with: - name: aw-android - path: dist/aw-android*.apk + make dist/aw-android.${{ matrix.type }} - - name: Upload AAB + - name: Upload uses: actions/upload-artifact@v3 with: name: aw-android - path: dist/aw-android*.aab + path: dist/aw-android*.${{ matrix.type }} test: name: Test From dadfc252ef009879b65d7d7b8beb730cc0da6adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 8 Oct 2023 17:15:07 +0200 Subject: [PATCH 12/12] fix: simplified gitignore --- .gitignore | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index b1861ad..badbaec 100644 --- a/.gitignore +++ b/.gitignore @@ -51,15 +51,7 @@ captures/ # IntelliJ *.iml -.idea/workspace.xml -.idea/tasks.xml -.idea/gradle.xml -.idea/assetWizardSettings.xml -.idea/modules.xml -.idea/dictionaries -.idea/libraries -.idea/caches -.idea/deploymentTargetDropDown.xml +.idea # Keystore files # Uncomment the following lines if you do not want to check your keystore files in.