An orb for building React Native applications. Assumes the usage of Fastlane. By default, it:
- Installs dependencies with yarn and caches them
- Installs gem dependencies (typically for Fastlane) and caches them
- Installs gradle dependencies and caches them
- Runs jest tests via
yarn test:ci
- Decodes an Android keystore from $ANDROID_ENCODED_KEYSTORE and saves to android.keystore for later use
- Overrides ENV vars with branch-specific ENV vars if they exist. example: API_URL_BETA or BETA_API_URL would override API_URL
- Creates an .env file containing current ENV vars for use by react-native-config and others
- overrideable test_steps, pre_build, build, and post_build hooks to customize the build process
- Assumes that Fastlane will either inject signing config for Android via gradle properties and the encoded keystore mentioned above or Gradle is otherwise setup to fully handle the signing process
- Setup your project for Fastlane
- Setup your project for Circle CI
- Create a config file at
.circleci/config.yml
. Here's an example:
version: 2.1
orbs:
react-native: echobind/react-native@0.1.1
workflows:
version: 2
main:
jobs:
- react-native/node:
name: node
- react-native/android:
requires:
- node
build:
- run:
name: fastlane adhoc android
working_directory: android
command: |
bundle exec fastlane adhoc build_number:${CIRCLE_BUILD_NUM}
- react-native/ios:
requires:
- node
build:
- run:
name: fastlane adhoc ios
working_directory: ios
command: |
bundle exec fastlane adhoc build_number:${CIRCLE_BUILD_NUM}
If using the default jest
step, make sure you install jest-junit
as a devDependency
and add a test:ci
script like the following: "test:ci": "jest --reporters=default --reporters=jest-junit"
Otherwise, make sure to override the jest
step to fit your project's needs.
If using the default pre_build
steps:
- Add
ANDROID_ENCODED_KEYSTORE
as an environment variable in the Circle UI. Encode using:cat <path-to-keystore-file> | base64 | pbcopy
. - Add environment variables required for your app: ex.
API_URL
. Override on a per-branch basis by using the branch name. ex:BETA_API_URL
Otherwise, make sure to override pre_build
to fit your project's needs.
Push the branch. Circle should run and build ios and android releases after the node job passes.
Need to override node version, xcode version, build steps, or anything else? Most jobs & steps take parameters to customize. Check the orb documentation page for more details.
Generated documentation is available on the orb page: https://circleci.com/orbs/registry/orb/echobind/react-native