From a654718780f6b9040d586c4863eb808863ec3091 Mon Sep 17 00:00:00 2001 From: "K. Shankari" Date: Thu, 9 Feb 2023 22:58:58 -0800 Subject: [PATCH 1/5] Enhance the CI for the android install `setup/activate_native.sh` has been broken for a while because we had the wrong path in the activate script. But it looks like the activate script can fail without failing this check. Let's make the check stricter and also add a setup so that the check is more likely to succeed For now, the check will fail since we haven't fixed the path in the activate script ``` New SDK root /tmp/new-install/Android/sdk Activating nvm Using version 14.18.1 N/A: version "v14.18.1" is not yet installed. You need to run `nvm install 14.18.1` to install and use it. npm version = 8.19.3 setup/activate_native.sh: line 14: /Users/runner/.sdkman/bin/sdkman-init.sh: No such file or directory ``` --- .github/workflows/android-automated-sdk-install.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/android-automated-sdk-install.yml b/.github/workflows/android-automated-sdk-install.yml index d32d08d67..b78e5728a 100644 --- a/.github/workflows/android-automated-sdk-install.yml +++ b/.github/workflows/android-automated-sdk-install.yml @@ -72,6 +72,14 @@ jobs: export ANDROID_SDK_ROOT=$NEW_ANDROID_SDK_ROOT echo "New SDK root $ANDROID_SDK_ROOT" $ANDROID_SDK_ROOT/emulator/emulator -list-avds + $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager list avds + + - name: Setup the cordova environment + shell: bash -l {0} + run: | + export JAVA_HOME=$JAVA_HOME_11_X64 + export ANDROID_SDK_ROOT=$NEW_ANDROID_SDK_ROOT + bash setup/setup_android_native.sh - name: Ensure that the path is correct and the project can be activated shell: bash -l {0} @@ -80,3 +88,4 @@ jobs: export ANDROID_SDK_ROOT=$NEW_ANDROID_SDK_ROOT echo "New SDK root $ANDROID_SDK_ROOT" source setup/activate_native.sh + avdmanager list avd From f405594b0e4e0e6aebd37969efff5b6d72ecbba1 Mon Sep 17 00:00:00 2001 From: "K. Shankari" Date: Fri, 10 Feb 2023 07:41:17 -0800 Subject: [PATCH 2/5] Re-run the automated SDK install CI when it changes Before this, it would only run when the setup script changed --- .github/workflows/android-automated-sdk-install.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/android-automated-sdk-install.yml b/.github/workflows/android-automated-sdk-install.yml index b78e5728a..b9c6d56a4 100644 --- a/.github/workflows/android-automated-sdk-install.yml +++ b/.github/workflows/android-automated-sdk-install.yml @@ -6,9 +6,11 @@ on: push: paths: - 'setup/prereq_android_sdk_install.sh' + - '.github/workflows/android-automated-sdk-install.yml' pull_request: paths: - 'setup/prereq_android_sdk_install.sh' + - '.github/workflows/android-automated-sdk-install.yml' schedule: # * is a special character in YAML so you have to quote this string - cron: '5 4 * * 0' From cf5ee27bac228443131a5a55b87bb26187f7d56c Mon Sep 17 00:00:00 2001 From: "K. Shankari" Date: Fri, 10 Feb 2023 09:22:28 -0800 Subject: [PATCH 3/5] Add some additional log statements to indicate what we are running --- .github/workflows/android-automated-sdk-install.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/android-automated-sdk-install.yml b/.github/workflows/android-automated-sdk-install.yml index b9c6d56a4..e700b16b4 100644 --- a/.github/workflows/android-automated-sdk-install.yml +++ b/.github/workflows/android-automated-sdk-install.yml @@ -73,7 +73,9 @@ jobs: export JAVA_HOME=$JAVA_HOME_11_X64 export ANDROID_SDK_ROOT=$NEW_ANDROID_SDK_ROOT echo "New SDK root $ANDROID_SDK_ROOT" + echo "About to run the emulator at $ANDROID_SDK_ROOT/emulator/emulator" $ANDROID_SDK_ROOT/emulator/emulator -list-avds + echo "About to run the avdmanager at $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager" $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager list avds - name: Setup the cordova environment @@ -90,4 +92,5 @@ jobs: export ANDROID_SDK_ROOT=$NEW_ANDROID_SDK_ROOT echo "New SDK root $ANDROID_SDK_ROOT" source setup/activate_native.sh + echo "About to run the avdmanager from the path" `which avdmanager` avdmanager list avd From ae1e1155c0bd65f2dad5469194b41bdb223612a4 Mon Sep 17 00:00:00 2001 From: "K. Shankari" Date: Fri, 10 Feb 2023 10:35:36 -0800 Subject: [PATCH 4/5] Fix the breaking test by changing the path during activation --- setup/activate_native.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup/activate_native.sh b/setup/activate_native.sh index 27a2cd99d..c0b8eb6e3 100644 --- a/setup/activate_native.sh +++ b/setup/activate_native.sh @@ -8,13 +8,14 @@ echo "Verifying $ANDROID_HOME or $ANDROID_SDK_ROOT is set" if [ -z $ANDROID_HOME ] && [ -z $ANDROID_SDK_ROOT ]; then echo "ANDROID_HOME and ANDROID_SDK_ROOT not set, android SDK not found" + exit 1 fi echo "Activating sdkman, and by default, gradle" source ~/.sdkman/bin/sdkman-init.sh echo "Ensuring that we use the most recent version of the command line tools" -export PATH=$ANDROID_SDK_ROOT/sdk/cmdline-tools/bin:$ANDROID_SDK_ROOT/emulator:$PATH +export PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/emulator:$PATH echo "Configuring the repo for building native code" ./bin/configure_xml_and_json.js cordovabuild From 47a688c68bf2a8bf7500d9b4a696cb9d35560246 Mon Sep 17 00:00:00 2001 From: "K. Shankari" Date: Fri, 10 Feb 2023 11:32:56 -0800 Subject: [PATCH 5/5] Remove the unused variable from the android setup --- setup/setup_android_native.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/setup/setup_android_native.sh b/setup/setup_android_native.sh index 5b4ea6a4b..95dc9222e 100644 --- a/setup/setup_android_native.sh +++ b/setup/setup_android_native.sh @@ -13,7 +13,6 @@ JAVA_VERSION=`javac -version` echo "Found java in the path with version $JAVA_VERSION" echo "Setting up SDK environment" -ANDROID_BUILD_TOOLS_VERSION=27.0.3 MIN_SDK_VERSION=21 TARGET_SDK_VERSION=28