Skip to content

Commit 6620943

Browse files
authored
docs(README): Add a more detailed README
[skip ci]
1 parent 9cd8068 commit 6620943

File tree

1 file changed

+106
-1
lines changed

1 file changed

+106
-1
lines changed

README.md

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,110 @@
11
# React Native CircleCI Orb
22
A [CircleCI Orb](https://circleci.com/orbs/) which can be used to simplify building and testing React Native apps.
33

4+
***Note:** This Orb has not yet been officially published to the registry. Until that happens, only repositories inside the `react-native-community` Github organisation can use it.*
5+
6+
## Why?
7+
Setting up CircleCI to test your React Native app correctly is hard. You need to consider using the correct machine type, installing the correct dependencies, running the correct commands, and correctly setting up caching to speed up builds. All of this is complicated and involves a lot of trial and error.
8+
9+
With this Orb we provide simple reusable building blocks which you can use to do the right thing easily.
10+
11+
## Overview
12+
First, we recommend reading the [Using Orbs](https://circleci.com/docs/2.0/using-orbs/) guide from the CircleCI documentartion to get an overview of how to use Orbs.
13+
14+
This Orb provides three different categories of tools to help you build and test your React Native app on CircleCI:
15+
16+
* **Executors**: Machines which are configured for use with React Native.
17+
* **Commands**: Individual tasks which you can piece together in your own jobs to perform tasks like installing dependencies, building an APK, or running Detox tests.
18+
* **Jobs**: Groups of commands which are typically used together as a stage in a pipeline.
19+
20+
## Setup
21+
Firstly, as this is a 3rd Party Orb, you need to go into your organisations settings, press on "Security", and enable usage of 3rd Party Orbs.
22+
23+
You will also need to ensure that you have a MacOS plan enabled if you want to build and test your iOS app, or if you want to test your Android app. Open Source projects can contact CircleCI to ask them to enable it and private projects need to select a payment plan.
24+
25+
## Documentation
26+
[You can read the full documentation here](https://circleci.com/orbs/registry/orb/react-native-community/react-native).
27+
28+
## Example
29+
Here is a full example of how the Orb can be used in a CircleCI workflow to build and test a React Native app:
30+
31+
```yaml
32+
# Orb support is from version >= 2.1
33+
version: 2.1
34+
35+
# Make sure you use the latest version of the Orb
36+
orbs:
37+
rn: react-native-community/react-native@dev:0.2.0
38+
39+
# Custom jobs which are not part of the Orb
40+
jobs:
41+
checkout_code:
42+
executor: rn/linux_js
43+
steps:
44+
- checkout
45+
- persist_to_workspace:
46+
root: .
47+
paths: .
48+
analyse_js:
49+
executor: rn/linux_js
50+
steps:
51+
- attach_workspace:
52+
at: .
53+
- rn/yarn_install
54+
- run:
55+
name: Run ESLint
56+
command: yarn eslint
57+
- run:
58+
name: Flow
59+
command: yarn flow
60+
- run:
61+
name: Jest
62+
command: yarn jest
63+
64+
workflows:
65+
test:
66+
jobs:
67+
# Checkout the code and persist to the Workspace
68+
# Note: This is a job which is defined above and not part of the Orb
69+
- checkout_code
70+
71+
# Analyze the Javascript using ESLint, Flow, and Jest
72+
# Note: This is a job which is defined above and not part of the Orb
73+
- analyse_js:
74+
requires:
75+
- checkout_code
76+
77+
# Build the Android app in debug mode
78+
- rn/android_build:
79+
name: build_android_debug
80+
project_path: "android"
81+
build_type: debug
82+
requires:
83+
- analyse_js
84+
85+
# Build and test the Android app in release mode
86+
# Note: We split these into seperate jobs because we can build the Android app on a Linux machine and preserve the expensive MacOS executor minutes for when it's required
87+
- rn/android_build:
88+
name: build_android_release
89+
project_path: "android"
90+
build_type: release
91+
requires:
92+
- analyse_js
93+
- rn/android_test:
94+
detox_configuration: "android.emu.release"
95+
requires:
96+
- build_android_release
97+
98+
# Build and test the iOS app in release mode
99+
- rn/ios_build_and_test:
100+
project_path: "ios/Example.xcodeproj"
101+
device: "iPhone X"
102+
build_configuration: "Release"
103+
scheme: "Example"
104+
detox_configuration: "ios.sim.release"
105+
requires:
106+
- analyse_js
107+
```
108+
4109
## License
5-
The library is released under the MIT license. For more information see [`LICENSE`](/LICENSE).
110+
The Orb is released under the MIT license. For more information see [`LICENSE`](https://github.com/react-native-community/react-native-circleci-orb/LICENSE).

0 commit comments

Comments
 (0)