Skip to content

Commit

Permalink
[ci] Optimize Android shell apps (expo#7888)
Browse files Browse the repository at this point in the history
# Why

- Let's keep secrets secret!
- Makes Turtle deploy faster and use less memory and storage

# How

- Removed the `decrypt_secrets…` from `shell_app_android` job,
- Removed the `yarn install` from `tools-public` (Turtle doesn't use anything JS-y from within `tools-public`, the only thing it uses is the `check-…macros.sh` script).
- Removed the `android/versioned-abis` directory as it used a couple of MBs and we are sure we would never use it in standalone apps.
- Annotated the whole `buildAndroidTarballLocally.sh` script for future reference.

# Test Plan

The shell app build process has been tested on an `sdk-37`-based branch in expo#7889 ([job](https://app.circleci.com/jobs/github/expo/expo/143387)).

Pushed the shell app built as a part of expo/turtle#209 to staging and it built as expected.
  • Loading branch information
sjchmiela authored Apr 20, 2020
1 parent 6c0d874 commit 7820a3e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
5 changes: 0 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -706,12 +706,7 @@ jobs:
steps:
- setup
- run: echo 'export S3_URI=s3://exp-artifacts/android-shell-builder-$CIRCLE_SHA1.tar.gz' >> $BASH_ENV
- decrypt_secrets_if_possible
- install_yarn
- yarn_install:
working_directory: ~/project/tools-public
- yarn_install:
working_directory: ~/project/tools
- yarn_restore_and_install:
working_directory: ~/project/tools/expotools
- run:
Expand Down
25 changes: 17 additions & 8 deletions buildAndroidTarballLocally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,28 @@ TEMP_DIR="/tmp/android-shell-app"
mkdir -p $ARTIFACTS_DIR
rm -rf $TEMP_DIR
mkdir -p $TEMP_DIR
ln -s ${ROOT_DIR}/tools-public $TEMP_DIR/tools-public
ln -s ${ROOT_DIR}/secrets $TEMP_DIR/secrets
ln -s ${ROOT_DIR}/template-files $TEMP_DIR/template-files

# only check-dynamic-macros-android.sh is used
mkdir -p $TEMP_DIR/tools-public
ln -s ${ROOT_DIR}/tools-public/check-dynamic-macros-android.sh $TEMP_DIR/tools-public/check-dynamic-macros-android.sh

# we use the root android project as a shell app template
ln -s ${ROOT_DIR}/android $TEMP_DIR/android
# We wouldn't want to use any versioned ABI in a standalone app
# and it makes the shell app smaller.
rm -rf $TEMP_DIR/android/versioned-abis

# root package.json defines a dependency on react-native-unimodules,
# which we require when building the shell app
ln -s ${ROOT_DIR}/package.json $TEMP_DIR/package.json
ln -s ${ROOT_DIR}/expokit-npm-package $TEMP_DIR/expokit-npm-package

# packages are used by the optional-modules-linking-code in XDL
# see xdl/AndroidShellApp.js
ln -s ${ROOT_DIR}/packages $TEMP_DIR/packages

# generate dynamic macros
mkdir -p $TEMP_DIR/android/expoview/src/main/java/host/exp/exponent/generated/
cd $TEMP_DIR/tools-public
# generate dynamic macros (we can do it here, as the contents are already `ln -s`-ed)
et android-generate-dynamic-macros --configuration release
rm -rf $TEMP_DIR/secrets

# build the artifact
cd $TEMP_DIR; tar -czhf $ARTIFACTS_DIR/android-shell-builder.tar.gz .
rm -rf $TEMP_DIR
2 changes: 1 addition & 1 deletion template-files/keys.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"AMPLITUDE_DEV_KEY": "773a3e0a8a28b8b1c3497792df4a5271",
"REACT_NATIVE_PATH": "../react-native-lab/react-native",
"UNIVERSAL_MODULES_PATH": "../packages",
"CERTIFICATE_HASH": "892B2B46907B26D3E729829AFCE15446B9947450",
"CERTIFICATE_HASH": "",
"FIREBASE_CLIENT_ID": "",
"FIREBASE_REVERSED_CLIENT_ID": "",
"FIREBASE_API_KEY": "",
Expand Down

0 comments on commit 7820a3e

Please sign in to comment.