[TOC]
NOTE: If you have issues with any of the set up, check the Troubleshooting section.
Before anything else, request access to the AND central gitlab. This can often take a couple of days to go through, so you can complete the rest of the environment setup whilst waiting for access:
Follow the steps on the React Native docs to get setup. You want to follow the 'Installing dependencies' instructions under the React Native CLI Quickstart tab for both iOS and Android.
and-murray
org some of these values can be found in the org variables.
MURRAY_APPS_DEV_REACT_APP_FIREBASE_FUNCTIONS_BASE_URL
MURRAY_APPS_DEV
or MURRAY_APPS_PROD
refers to the environment.REACT_APP_FIREBASE_FUNCTIONS_BASE_URL
refers to the key part. This will match one of the keys in .env.template.env.production
.env.development
yarn install
. We're using yarn in this project instead of npm, so you should not be using npm to execute any commands.
env /usr/bin/arch -arm64 /bin/zsh --login
. If any of the steps with ruby or bundler fail, try prefixing them with arch -arm64 (e.g. arch -arm64 bundle install)cd ios
) and perform bundle install
rvm install y
followed by rvm use y
, then retry the bundle install
.bundle exec pod install
bundle exec pod install --repo-update
yarn android:debug:dev
yarn ios:debug:dev
We use match to manage certificates & profiles for running on devices.
gcloud auth application-default
if credentials have expired.yarn ios:setup
to install the certificates.yarn ios:qa:distribute
to deploy your current branch (usually develop or main) to the firebase distibution. This only needs to be done for iOS because Android is handled by the CI and so are the functions.On iOS we have one Scheme but multiple build configurations:
These are a combination of the build settings (Debug & Release) and the backend environment that they hit. The
GoogleService-Info-Dev.plist
& GoogleService-Info-Prod.plist
are stored in ios/Firebase
. A build phase script pulls out the correct one based on the configuration and renames it correctly.
On Android there are the following build variants:
These are combination of the productFlavours
: (These are for separate Firebase instances, keeping data separate for each backend.)
google-services.json
files are in separate folders for each flavour: android/app/src/development/google-services.json
& android/app/src/production/google-services.json
These are combination of the buildTypes
: (These are for different types of builds, the release type is optimised and doesn't have any debugging or developer features.)
This is all configured from android/app/build.gradle
.
See the Firebase docs for the most up to date instructions.
yarn install
will ensure the cli is installed as it is in the package.json This guide has the most up to date commandsfirebase setup:emulators:firestore
. See this for more up to date setup if required.firebase emulators:start --only firestore --import=EmulatorData --export-on-exit=EmulatorData
.
~/.cache/firebase/emulators/
. Delete the Ui folder ui-v1.11.5
and unzip the zipped version and rerun.Database.ts
for more on this.firebase login
to login. If required.firebase deploy --only firestore:rules
will deploy the rules in the project.firebase functions:shell
you can then run the function by running functionName()
. See hereREACT_APP_USE_EMULATORS
flag in src/util/FirebaseUtils/FirebaseUtils.ts
to true to enable emulation of firebase functions.yarn emulateFirebase:dev
/ emulateFirebase:prod
for just enabling the functions emulation, or firebase use development
/ firebase use production
& firebase emulators:start --import=EmulatorData --export-on-exit=EmulatorData
for use of the emulated firestore as well.There is also an adminsdk json file that contains the secrets that allow admin access for the sdk to do this. This file is generated from the project settings within firebase and should not be shared publicly. Ideally this file would be stored on gitlab CI and not in version control but it is not currently possible to do that and should be done as soon as it is possible.
cd functions
and then yarn install
.yarn build
yarn test-functions
yarn test
If the git-crypt key has been regenerated/changed, the CI will need to be updated to include this new key. We need to upload the key as a base64 encoded string because secure files don't work correctly GitLab CI, to do so:
base64 -i git-crypt-key -o base64-git-crypt-key
CRYPT_KEY
in GitLab variables. Make sure it is masked.We use fastlane lanes for this - Read the guide here
yarn react-native doctor
first, it will guide you/automatically find and fix common react-native issues for you.env /usr/bin/arch -arm64 /bin/zsh --login
. If any of the steps with ruby or bundler fail, try prefixing them with arch -arm64 (e.g. arch -arm64 bundle install)Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds
OR error Failed to install the app. Make sure you have the Android...
yarn react-native doctor
doesn't report Android issues, you may have an issue elsewhere:which yarn
to get the path for Yarn, and then replace the _YARN_GLOBALPATH in the following and run set -U fish_user_paths YARN_GLOBAL_PATH $fish_user_paths
.rvm install XXXX; rvm use XXXX;
(where XXXX is the version quoted in the error message)yarn clean-caches
. If it's still, not working, you can try deleting node_modules
and running yarn install
.Watchman crawl failed
Seems like Watchman wants to be uninstalled and reinstalled, try the following:
brew uninstall watchman
brew install watchman
watchman shutdown-server # (just in case it's running)
watchman watch-del-all
yarn start --reset-cache