Skip to content

Commit

Permalink
Get the installation checks to actually work (#817)
Browse files Browse the repository at this point in the history
* Comment out everything else and just echo the initial environment variables

* Run the test CI for all pushes and PRs

So that at least it shows up

* Change the automated install to be identical to the CI workflow

* Fix the file ending

* Now introduce the actual changes we want to test

* Fix the list_installed syntax

* Enable all the other steps as well

* actually run the install script

Not sure why it is hanging through

* Add some logging statements to check when the install is complete

+ ensure that this only runs when the prerequisite script is changed

* Ensure that we explicitly exit from the script

Since we are running it with `yes Y | ...` and it does not appear to exit
automatically

* Simplify the install script so we can see why it doesn't exit properly

* Remove all prompts and make sure that it works

* Remove the pipe to confirm that this the problem

* Restore the prompts

We will try different options to pass in the prompt since the `yes` pipe doesn't seem to work
https://www.baeldung.com/linux/bash-interactive-prompts

* Reintroduce the actual install now that the printf workaround seems to work

* Fix install check and diff check

- Diff check is expected to fail
- Install check should be the last item so that the workflow will fail correctly

* Add -x so we print lines before executing them

Which makes it easier to find errors in these giant scripts

* Fix syntax of single line command by adding appropriate semicolons

```
$ if [ ! -f $ANDROID_SDK_ROOT/emulator ]; then echo "not found" fi
> -bash: syntax error: unexpected end of file
$ if [ ! -f $ANDROID_SDK_ROOT/emulator ]; then echo "not found"; fi
not found
```

* Fix the checks to look for directories and not files

* Split the checks into two so we detect if either check fails

* Restore the default CI to only run on the master branch

Reverts "Run the test CI for all pushes and PRs" which will not be a separate
commit once we squash and merge
  • Loading branch information
shankari authored Apr 4, 2022
1 parent 9179850 commit 2423030
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,49 @@ jobs:
echo "SDK root before install $ANDROID_SDK_ROOT"
cat $ANDROID_SDK_ROOT/cmdline-tools/latest/source.properties
echo "Existing installed packages"
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --list-installed
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --list_installed
- name: Install to a new SDK root
run: |
export ANDROID_SDK_ROOT=$NEW_ANDROID_SDK_ROOT
echo "New SDK root $ANDROID_SDK_ROOT"
yes Y | setup/prereq_android_sdk_install.sh
printf "Y\nY\nY\nY\nY\n" | bash setup/prereq_android_sdk_install.sh
- name: Verify that all packages are as expected
shell: bash -l {0}
run: |
echo "Comparing $ANDROID_SDK_ROOT and $NEW_ANDROID_SDK_ROOT"
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --list_installed > /tmp/existing_packages
$NEW_ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --list_installed > /tmp/new_packages
diff /tmp/existing_packages /tmp/new_packages
diff -uw /tmp/existing_packages /tmp/new_packages
echo "Expected differences; emulators, SDK versions, tool versions"
- name: Verify that directory structure is consistent
shell: bash -l {0}
shell: bash -l -x {0}
run: |
export ANDROID_SDK_ROOT=$NEW_ANDROID_SDK_ROOT
echo "New SDK root $ANDROID_SDK_ROOT"
ls -al $ANDROID_SDK_ROOT
if [ ! -f $ANDROID_SDK_ROOT/emulator ]; then exit 1 fi
if [ ! -f $ANDROID_SDK_ROOT/build-tools ]; then exit 1 fi
if [ ! -f $ANDROID_SDK_ROOT/patcher ]; then exit 1 fi
if [ ! -f $ANDROID_SDK_ROOT/extras ]; then exit 1 fi
if [ ! -f $ANDROID_SDK_ROOT/platforms ]; then exit 1 fi
if [ ! -f $ANDROID_SDK_ROOT/platform-tools ]; then exit 1 fi
if [ ! -f $ANDROID_SDK_ROOT/system-images ]; then exit 1 fi
if [ ! -d $ANDROID_SDK_ROOT/emulator ]; then exit 1; fi
if [ ! -d $ANDROID_SDK_ROOT/build-tools ]; then exit 1; fi
if [ ! -d $ANDROID_SDK_ROOT/patcher ]; then exit 1; fi
if [ ! -d $ANDROID_SDK_ROOT/extras ]; then exit 1; fi
if [ ! -d $ANDROID_SDK_ROOT/platforms ]; then exit 1; fi
if [ ! -d $ANDROID_SDK_ROOT/platform-tools ]; then exit 1; fi
if [ ! -d $ANDROID_SDK_ROOT/system-images ]; then exit 1; fi
- name: Ensure that the path is correct and installed programs are runnable
shell: bash -l {0}
run: |
export JAVA_HOME=$JAVA_HOME_11_X64
export ANDROID_SDK_ROOT=$NEW_ANDROID_SDK_ROOT
echo "New SDK root $ANDROID_SDK_ROOT"
source setup/activate_native.sh
$ANDROID_SDK_ROOT/emulator/emulator -list-avds
- name: Ensure that the path is correct and the project can be activated
shell: bash -l {0}
run: |
export JAVA_HOME=$JAVA_HOME_11_X64
export ANDROID_SDK_ROOT=$NEW_ANDROID_SDK_ROOT
echo "New SDK root $ANDROID_SDK_ROOT"
source setup/activate_native.sh
2 changes: 2 additions & 0 deletions setup/prereq_android_sdk_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ echo "Downloading the android SDK. This will take a LONG time and will require y
read -p "Do you wish to continue? (Y/N)" CONTINUE
if [ $CONTINUE == "Y" ];
then
echo "BEGIN: About to start android SDK download"
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --package_file=setup/android_sdk_packages
echo "END: Done with android SDK download, exiting script"
else
echo "Please install this before proceeding with the installation steps"
exit 1
Expand Down

0 comments on commit 2423030

Please sign in to comment.