From 9b173f4fc82aca61213cec6fe3dfd4b19920d2ab Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Wed, 1 Mar 2023 05:12:36 +0200 Subject: [PATCH 1/7] Separate test build apk from overriding the original app --- .github/workflows/pr_test_build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index f8496ffcd..0be2a5e68 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -5,7 +5,7 @@ on: branches: [ main ] jobs: - test: + PR_test_build: runs-on: ubuntu-20.04 env: @@ -36,6 +36,7 @@ jobs: cd cake_wallet/scripts/android/ ./install_ndk.sh source ./app_env.sh cakewallet + export APP_ANDROID_PACKAGE="com.cakewallet.cake_wallet.test" ./app_config.sh - name: Cache Externals From 23128dbe3c73b94f2daa787f0de913f46fbcc688 Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Wed, 1 Mar 2023 05:40:52 +0200 Subject: [PATCH 2/7] Separate test build apk from overriding the original app --- .github/workflows/pr_test_build.yml | 3 +-- scripts/android/app_env.sh | 12 +++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index 0be2a5e68..759aa218d 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -35,8 +35,7 @@ jobs: git clone https://github.com/cake-tech/cake_wallet.git --branch $GITHUB_HEAD_REF cd cake_wallet/scripts/android/ ./install_ndk.sh - source ./app_env.sh cakewallet - export APP_ANDROID_PACKAGE="com.cakewallet.cake_wallet.test" + source ./app_env.sh cakewallet.test ./app_config.sh - name: Cache Externals diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index eabd192ce..26b5a399b 100644 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -9,8 +9,9 @@ APP_ANDROID_PACKAGE="" MONERO_COM="monero.com" CAKEWALLET="cakewallet" HAVEN="haven" +CAKEWALLET_TEST="cakewallet.test" -TYPES=($MONERO_COM $CAKEWALLET $HAVEN) +TYPES=($MONERO_COM $CAKEWALLET $HAVEN $CAKEWALLET_TEST) APP_ANDROID_TYPE=$1 MONERO_COM_NAME="Monero.com" @@ -31,6 +32,8 @@ HAVEN_BUILD_NUMBER=1 HAVEN_BUNDLE_ID="com.cakewallet.haven" HAVEN_PACKAGE="com.cakewallet.haven" +CAKEWALLET_TEST_PACKAGE="com.cakewallet.cake_wallet.test" + if ! [[ " ${TYPES[*]} " =~ " ${APP_ANDROID_TYPE} " ]]; then echo "Wrong app type." return 1 2>/dev/null @@ -59,6 +62,13 @@ case $APP_ANDROID_TYPE in APP_ANDROID_BUNDLE_ID=$HAVEN_BUNDLE_ID APP_ANDROID_PACKAGE=$HAVEN_PACKAGE ;; + $CAKEWALLET_TEST) + APP_ANDROID_NAME=$CAKEWALLET_NAME + APP_ANDROID_VERSION=$CAKEWALLET_VERSION + APP_ANDROID_BUILD_NUMBER=$CAKEWALLET_BUILD_NUMBER + APP_ANDROID_BUNDLE_ID=$CAKEWALLET_BUNDLE_ID + APP_ANDROID_PACKAGE=CAKEWALLET_TEST_PACKAGE + ;; esac export APP_ANDROID_TYPE From 1481ebc22920e0d830298aa9319aafad8b592cee Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Wed, 1 Mar 2023 06:34:10 +0200 Subject: [PATCH 3/7] Separate test build apk from overriding the original app --- scripts/android/app_env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index 26b5a399b..c456f8466 100644 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -32,7 +32,7 @@ HAVEN_BUILD_NUMBER=1 HAVEN_BUNDLE_ID="com.cakewallet.haven" HAVEN_PACKAGE="com.cakewallet.haven" -CAKEWALLET_TEST_PACKAGE="com.cakewallet.cake_wallet.test" +CAKEWALLET_TEST_PACKAGE="com.cakewallet.test" if ! [[ " ${TYPES[*]} " =~ " ${APP_ANDROID_TYPE} " ]]; then echo "Wrong app type." From 4ab7edf90b517c97258f8cbefd5f19abb3d53f42 Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Wed, 1 Mar 2023 07:01:17 +0200 Subject: [PATCH 4/7] Separate test build apk from overriding the original app --- .github/workflows/pr_test_build.yml | 6 +++++- scripts/android/app_env.sh | 14 ++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index 759aa218d..bd158a84d 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -35,7 +35,11 @@ jobs: git clone https://github.com/cake-tech/cake_wallet.git --branch $GITHUB_HEAD_REF cd cake_wallet/scripts/android/ ./install_ndk.sh - source ./app_env.sh cakewallet.test + source ./app_env.sh cakewallet + APP_ANDROID_PACKAGE="com.cakewallet.test" + export APP_ANDROID_PACKAGE="com.cakewallet.test" + set APP_ANDROID_PACKAGE="com.cakewallet.test" + env APP_ANDROID_PACKAGE="com.cakewallet.test" ./app_config.sh - name: Cache Externals diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index c456f8466..d2bee1773 100644 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -9,9 +9,8 @@ APP_ANDROID_PACKAGE="" MONERO_COM="monero.com" CAKEWALLET="cakewallet" HAVEN="haven" -CAKEWALLET_TEST="cakewallet.test" -TYPES=($MONERO_COM $CAKEWALLET $HAVEN $CAKEWALLET_TEST) +TYPES=($MONERO_COM $CAKEWALLET $HAVEN) APP_ANDROID_TYPE=$1 MONERO_COM_NAME="Monero.com" @@ -32,8 +31,6 @@ HAVEN_BUILD_NUMBER=1 HAVEN_BUNDLE_ID="com.cakewallet.haven" HAVEN_PACKAGE="com.cakewallet.haven" -CAKEWALLET_TEST_PACKAGE="com.cakewallet.test" - if ! [[ " ${TYPES[*]} " =~ " ${APP_ANDROID_TYPE} " ]]; then echo "Wrong app type." return 1 2>/dev/null @@ -62,13 +59,6 @@ case $APP_ANDROID_TYPE in APP_ANDROID_BUNDLE_ID=$HAVEN_BUNDLE_ID APP_ANDROID_PACKAGE=$HAVEN_PACKAGE ;; - $CAKEWALLET_TEST) - APP_ANDROID_NAME=$CAKEWALLET_NAME - APP_ANDROID_VERSION=$CAKEWALLET_VERSION - APP_ANDROID_BUILD_NUMBER=$CAKEWALLET_BUILD_NUMBER - APP_ANDROID_BUNDLE_ID=$CAKEWALLET_BUNDLE_ID - APP_ANDROID_PACKAGE=CAKEWALLET_TEST_PACKAGE - ;; esac export APP_ANDROID_TYPE @@ -76,4 +66,4 @@ export APP_ANDROID_NAME export APP_ANDROID_VERSION export APP_ANDROID_BUILD_NUMBER export APP_ANDROID_BUNDLE_ID -export APP_ANDROID_PACKAGE +export APP_ANDROID_PACKAGE \ No newline at end of file From c3c1999048410edcddd896a5f6b995302ee5f156 Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Wed, 1 Mar 2023 15:39:34 +0200 Subject: [PATCH 5/7] Change package name when renaming test app --- .github/workflows/pr_test_build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index bd158a84d..790316617 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -117,7 +117,9 @@ jobs: echo "const twitterBearerToken = '${{ secrets.TWITTER_BEARER_TOKEN }}';" >> lib/.secrets.g.dart - name: Rename app - run: sed -i -e "s/\${APP_NAME}/$GITHUB_HEAD_REF/g" /opt/android/cake_wallet/android/app/src/main/AndroidManifest.xml + run: | + sed -i -e "s/\${APP_NAME}/$GITHUB_HEAD_REF/g" /opt/android/cake_wallet/android/app/src/main/AndroidManifest.xml + sed -i -e "s/\com.cakewallet.cake_wallet/com.cakewallet.cake_wallet.test/g" /opt/android/cake_wallet/android/app/src/main/AndroidManifest.xml - name: Build run: | From bfaf5d11d1324e103a356cdba9e62d549505cf1e Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Wed, 1 Mar 2023 16:01:28 +0200 Subject: [PATCH 6/7] Update pr_test_build.yml --- .github/workflows/pr_test_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index 790316617..0638ac095 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -119,7 +119,7 @@ jobs: - name: Rename app run: | sed -i -e "s/\${APP_NAME}/$GITHUB_HEAD_REF/g" /opt/android/cake_wallet/android/app/src/main/AndroidManifest.xml - sed -i -e "s/\com.cakewallet.cake_wallet/com.cakewallet.cake_wallet.test/g" /opt/android/cake_wallet/android/app/src/main/AndroidManifest.xml + sed -i -e "s/com.cakewallet.cake_wallet/com.cakewallet.test/g" /opt/android/cake_wallet/android/app/src/main/AndroidManifest.xml - name: Build run: | From 1219cd2c14212850618879b83bc27b38e934ff82 Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Wed, 1 Mar 2023 16:57:55 +0200 Subject: [PATCH 7/7] Rename package along with app name in app.properties --- .github/workflows/pr_test_build.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index 0638ac095..cdf537cdb 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -36,10 +36,6 @@ jobs: cd cake_wallet/scripts/android/ ./install_ndk.sh source ./app_env.sh cakewallet - APP_ANDROID_PACKAGE="com.cakewallet.test" - export APP_ANDROID_PACKAGE="com.cakewallet.test" - set APP_ANDROID_PACKAGE="com.cakewallet.test" - env APP_ANDROID_PACKAGE="com.cakewallet.test" ./app_config.sh - name: Cache Externals @@ -117,9 +113,7 @@ jobs: echo "const twitterBearerToken = '${{ secrets.TWITTER_BEARER_TOKEN }}';" >> lib/.secrets.g.dart - name: Rename app - run: | - sed -i -e "s/\${APP_NAME}/$GITHUB_HEAD_REF/g" /opt/android/cake_wallet/android/app/src/main/AndroidManifest.xml - sed -i -e "s/com.cakewallet.cake_wallet/com.cakewallet.test/g" /opt/android/cake_wallet/android/app/src/main/AndroidManifest.xml + run: echo -e "id=com.cakewallet.test\nname=$GITHUB_HEAD_REF" > /opt/android/cake_wallet/android/app.properties - name: Build run: |