Skip to content

Commit

Permalink
Merge pull request #701 from shankari/minor_install_and_ci_fixes
Browse files Browse the repository at this point in the history
Minor install and ci fixes
  • Loading branch information
shankari authored Jul 11, 2020
2 parents 59c9ae4 + 318f1a0 commit 4402868
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 34 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ jobs:
- name: Setup the cordova environment
shell: bash -l {0}
run: |
source setup/setup_android_native.sh
bash setup/setup_android_native.sh
source setup/activate_native.sh
npx cordova -version
npx ionic -version
- name: Access cordova with a specified shell
shell: bash -l {0}
run: |
source setup/activate_native.sh
npx cordova -version
which gradle
gradle -version
Expand All @@ -54,8 +56,8 @@ jobs:
echo $PATH
which gradle
gradle -version
echo "Let's rerun the sdkman again"
source ~/.sdkman/bin/sdkman-init.sh
echo "Let's rerun the activation"
source setup/activate_native.sh
echo $PATH
which gradle
gradle --version
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/ios-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,27 @@ jobs:
- name: Setup the cordova environment
shell: bash -l {0}
run: |
source setup/setup_ios_native.sh
bash setup/setup_ios_native.sh
source setup/activate_native.sh
npx cordova -version
npx ionic -version
- name: Access cordova directly
run: npx cordova -version

- name: Access cordova with a specified shell
shell: bash -l {0}
run: |
source setup/activate_native.sh
npx cordova -version
- name: Access cordova directly
run: npx cordova -version

- name: Build ios
shell: bash -l {0}
run: npx cordova build ios
run: |
source setup/activate_native.sh
npx cordova build ios
- name: Cleanup the cordova environment
shell: bash -l {0}
run: source setup/teardown_ios_native.sh
run: bash setup/teardown_ios_native.sh

3 changes: 2 additions & 1 deletion .github/workflows/serve-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ jobs:
- name: Setup the serve environment
shell: bash -l {0}
run: |
source setup/setup_serve.sh
bash setup/setup_serve.sh
source setup/activate_serve.sh
npx cordova -version
npx ionic --version
Expand Down
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ Updating the UI only

If you want to make only UI changes, (as opposed to modifying the existing plugins, adding new plugins, etc), you can use the **new and improved** (as of June 2018) e-mission dev app.

### Installing
### Installing (one-time)

Run the setup script

```
$ source setup/setup_serve.sh
$ bash setup/setup_serve.sh
```

**(optional)** Configure by changing the files in `www/json`.
Expand All @@ -42,6 +42,12 @@ $ ls www/json/*.sample
$ cp www/json/startupConfig.json.sample www/json/startupConfig.json
$ cp ..... www/json/connectionConfig.json
```

### Activation (after install, and in every new shell)

```
$ source setup/activate_serve.sh
```

### Running

Expand Down Expand Up @@ -69,7 +75,6 @@ $ cp ..... www/json/connectionConfig.json
**Note1**: You may need to scroll up, past all the warnings about `Content Security Policy has been added` to find the port that the server is listening to.
End to end testing
---
A lot of the visualizations that we display in the phone client come from the server. In order to do end to end testing, we need to run a local server and connect to it. Instructions for:
Expand All @@ -95,8 +100,10 @@ Pre-requisites
- the version of xcode used by the CI
- to install a particular version, use [xcode-select](https://www.unix.com/man-page/OSX/1/xcode-select/)
- or this [supposedly easier to use repo](https://github.com/xcpretty/xcode-install)
- **NOTE**: the basic xcode install on Catalina was messed up for me due to a prior installation of command line tools. [These workarounds helped](https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md).
- git
- the most recent version of android studio
- **NOTE**: although Catalina has a `/usr/bin/java`, trying to run it gives the error `No Java runtime present, requesting install.`. Installed [OpenJDK 1.8 using AdoptOpenJDK](https://adoptopenjdk.net/releases.html) to be consistent with the CI.
Important
---
Expand All @@ -110,14 +117,14 @@ have now:
If you have setup failures, please compare the configuration in the passing CI
builds with your configuration. That is almost certainly the source of the error.
Installing
Installing (one time only)
---
Run the setup script for the platform you want to build
```
$ source setup/setup_android_native.sh
$ bash setup/setup_android_native.sh
AND/OR
$ source setup/setup_ios_native.sh
$ bash setup/setup_ios_native.sh
```
**(optional)** Configure by changing the files in `www/json`.
Expand All @@ -129,6 +136,14 @@ $ cp www/json/startupConfig.json.sample www/json/startupConfig.json
$ cp ..... www/json/connectionConfig.json
```
### Activation (after install, and in every new shell)
```
$ source setup/activate_native.sh
```
Run in the emulator
```
Expand Down
17 changes: 17 additions & 0 deletions setup/activate_native.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Setup the development environment
source setup/activate_shared.sh

echo "Adding cocoapods to the path"
export PATH=$RUBY_PATH:$PATH

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"
fi

echo "Activating sdkman, and by default, gradle"
source "/Users/kshankar/.sdkman/bin/sdkman-init.sh"

echo "Configuring the repo for building native code"
./bin/configure_xml_and_json.js cordovabuild
4 changes: 4 additions & 0 deletions setup/activate_serve.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source setup/activate_shared.sh

echo "Configuring the repo for UI development"
./bin/configure_xml_and_json.js serve
12 changes: 12 additions & 0 deletions setup/activate_shared.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
source setup/export_shared_dep_versions.sh

echo "Activating nvm"

[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

echo "Using version $NODE_VERSION"
nvm use $NODE_VERSION

CURR_NPM_VERSION=`npm --version`
echo "npm version = $CURR_NPM_VERSION"
9 changes: 9 additions & 0 deletions setup/export_shared_dep_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export NVM_VERSION=0.35.3
export NODE_VERSION=13.12.0
export NPM_VERSION=6.14.4
export RUBY_VERSION=2.6.0
export COCOAPODS_VERSION=1.9.1
export GRADLE_VERSION=4.10.3

export NVM_DIR="$HOME/.nvm"
export RUBY_PATH=$HOME/.gem/ruby/$RUBY_VERSION/bin
8 changes: 4 additions & 4 deletions setup/setup_android_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ TARGET_SDK_VERSION=28
# Setup the development environment
source setup/setup_shared.sh

if [ -z $ANDROID_HOME ];
if [ -z $ANDROID_HOME ] && [ -z $ANDROID_SDK_ROOT ];
then
echo "ANDROID_HOME not set, android SDK not found, exiting"
echo "ANDROID_HOME and ANDROID_SDK_ROOT not set, android SDK not found, exiting"
exit 1
else
echo "ANDROID_HOME found at $ANDROID_HOME"
echo "ANDROID_HOME = $ANDROID_HOME; ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT"
fi

echo "Setting up sdkman"
curl -s "https://get.sdkman.io" | bash
source ~/.sdkman/bin/sdkman-init.sh

echo "Setting up gradle using SDKMan"
sdk install gradle 4.1
sdk install gradle $GRADLE_VERSION

source setup/setup_shared_native.sh
5 changes: 1 addition & 4 deletions setup/setup_ios_native.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# error out if any command fails
set -e

COCOAPODS_VERSION=1.9.1
EXPECTED_PLUGIN_COUNT=15

# Setup the development environment
source setup/setup_shared.sh

echo "Installing cocoapods"
export PATH=~/.gem/ruby/2.6.0/bin:$PATH
export PATH=$RUBY_PATH:$PATH
gem install --no-document --user-install cocoapods -v $COCOAPODS_VERSION

source setup/setup_shared_native.sh
8 changes: 1 addition & 7 deletions setup/setup_shared.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
export NVM_VERSION=0.35.3
export NODE_VERSION=13.12.0
export NPM_VERSION=6.14.4

echo "Is this in a CI environment? $CI"
export CI="true"
source setup/export_shared_dep_versions.sh

echo "Installing the correct version of nvm"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v$NVM_VERSION/install.sh | bash

echo "Setting up the variables to run nvm"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

Expand Down
1 change: 0 additions & 1 deletion setup/teardown_ios_native.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
echo "Ensure we exit on error"
set -e

export COCOAPODS_VERSION=1.9.1
source setup/teardown_shared.sh

echo "Uninstalling cocoapods"
Expand Down
3 changes: 1 addition & 2 deletions setup/teardown_shared.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export COCOAPODS_VERSION=1.7.5
export NODE_VERSION=9.4.0
source setup/export_shared_dep_versions.sh

echo "Removing .nvm since we installed it"
rm -rf ~/.nvm/$NODE_VERSION
Expand Down

0 comments on commit 4402868

Please sign in to comment.