Giter VIP home page Giter VIP logo

circleci-react-native-orb's Introduction

Circle CI React Native Orb

Overview

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

Other useful features

  • overrideable test_steps, pre_build, build, and post_build hooks to customize the build process

Caveats

  • 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

  • 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/[email protected]
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}

Jest

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.

Pre_build

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.

Kick off a build!

Push the branch. Circle should run and build ios and android releases after the node job passes.

Customizing

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.

Orb Documentation

Generated documentation is available on the orb page: https://circleci.com/orbs/registry/orb/echobind/react-native

circleci-react-native-orb's People

Contributors

cball avatar isaiahgrey93 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

circleci-react-native-orb's Issues

Errors when upgrading to XCode 11.4

Apple is requiring all apps to be built using iOS SDK 13+ starting June 30th, which requires XCode 11.X. The default XCode image for this Orb is currently 10.1. Manually setting the ios executor is throwing an error when building in CI.

My project's config.yml:

custom_executor:
    name: react-native/ios
    xcode_version: '11.4.1'

Error in CI:
2020-05-20 at 11 35 AM

Detailed error in the logs:

error `fsevents` unavailable (this watcher can only be used on Darwin). Run CLI with --verbose flag for more details

This seems to be caused by using yarn instead of npm in CI.

The yarn install step shows the following error:

Error running install script for optional dependency: "/Users/distiller/react-native/node_modules/fsevents: Command failed.

Using npm install succeeded with no errors.

  1. Is there another fix for this besides using npm?
  2. If not, what's the easiest way to override that using this Orb?
  3. Is this Orb still maintained?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.