Skip to content

Commit

Permalink
CI now builds docs website and deploys it to /%version% path
Browse files Browse the repository at this point in the history
Summary:
Copy of #5760 reverted merge.

We need to preserve history of docs changes on the webserver.
The goal is to allow users to browse outdated versions of docs.
To make things simple all websites will be released to https://facebook.github.io/react-native/releases/version/XX folder when there is a branch cut.

I switched from Travis CI to Cirle CI because it works faster and I am more familiar with it.

How it works:

1. If code is pushed to `master` branch then CI will build a fresh version of docs and put it in https://github.com/facebook/react-native/tree/gh-pages/releases/next folder.
Github will serve this website from https://facebook.github.io/react-native/releases/version/next URL.
All relative URLs will work within that website

2. If code is pushed to `0.20-stable` branch then CI will build a fresh version of docs and put it in https://github.com/facebook/react-native/tree/gh-pages/releases/0.20 folder.
Github will serve this website from https://facebook.github.io/react-native/releases/v
Closes #5873

Reviewed By: svcscm

Differential Revision: D2926901

Pulled By: androidtrunkagent

fb-gh-sync-id: 16aea430bac815933d9c603f03921cc6353906f1
shipit-source-id: 16aea430bac815933d9c603f03921cc6353906f1
  • Loading branch information
bestander authored and facebook-github-bot-0 committed Feb 11, 2016
1 parent 0b89b18 commit 6f1417c
Show file tree
Hide file tree
Showing 44 changed files with 234 additions and 186 deletions.
20 changes: 2 additions & 18 deletions .travis.yml
Expand Up @@ -42,24 +42,11 @@ script:
npm test -- '\/(local|private|react-native)-cli\/'
elif [ "$TEST_TYPE" = build_website ]
then
cd website
$(which npm) install
./setup.sh
if [ "$TRAVIS_PULL_REQUEST" = false ] && [ "$TRAVIS_BRANCH" = master ]; then
# Automatically publish the website
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" >~/.netrc
./publish.sh
else
# Make sure the website builds without error
node server/generate.js
fi
elif [ "$TEST_TYPE" = e2e ]
then
./scripts/e2e-test.sh
else
echo "Unknown test type: $TEST_TYPE"
exit 1
Expand All @@ -71,11 +58,8 @@ env:
- TEST_TYPE=js
- TEST_TYPE=packager
- TEST_TYPE=cli
- TEST_TYPE=build_website
- TEST_TYPE=e2e
global:
# $GITHUB_TOKEN
- secure: "HlmG8M2DmBUSBh6KH1yVIe/8gR4iibg4WfcHq1x/xYQxGbvleq7NOo04V6eFHnl9cvZCu+PKH0841WLnGR7c4BBf47GVu/o16nXzggPumHKy++lDzxFPlJ1faMDfjg/5vjbAxRUe7D3y98hQSeGHH4tedc8LvTaFLVu7iiGqvjU="
# $APPETIZE_TOKEN
- secure: "egsvVSpszTzrNd6bN62DsVAzMiSZI/OHgdizfPryqvqWBf655ztE6XFQSEFNpuIAzSKDDF25ioT8iPfVsbC1iK6HDWHfmqYxML0L+OoU0gi+hV2oKUBFZDZ1fwSnFoWuBdNdMDpLlUxvJp6N1WyfNOB2dxuZUt8eTt48Hi3+Hpc="
# $S3_TOKEN
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Animated/src/AnimatedImplementation.js
Expand Up @@ -1556,7 +1556,7 @@ var event = function(
* interaction patterns, like drag-and-drop.
*
* You can see more example usage in `AnimationExample.js`, the Gratuitous
* Animation App, and [Animations documentation guide](http://facebook.github.io/react-native/docs/animations.html).
* Animation App, and [Animations documentation guide](docs/animations.html).
*
* Note that `Animated` is designed to be fully serializable so that animations
* can be run in a high performance way, independent of the normal JavaScript
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/ScrollView/ScrollView.js
Expand Up @@ -315,7 +315,7 @@ var ScrollView = React.createClass({
* A RefreshControl component, used to provide pull-to-refresh
* functionality for the ScrollView.
*
* See [RefreshControl](http://facebook.github.io/react-native/docs/refreshcontrol.html).
* See [RefreshControl](docs/refreshcontrol.html).
*/
refreshControl: PropTypes.element,

Expand Down
2 changes: 1 addition & 1 deletion Libraries/PushNotificationIOS/PushNotificationIOS.js
Expand Up @@ -30,7 +30,7 @@ var DEVICE_LOCAL_NOTIF_EVENT = 'localNotificationReceived';
* To get up and running, [configure your notifications with Apple](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html#//apple_ref/doc/uid/TP40012582-CH26-SW6)
* and your server-side system. To get an idea, [this is the Parse guide](https://parse.com/tutorials/ios-push-notifications).
*
* [Manually link](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#manual-linking) the PushNotificationIOS library
* [Manually link](docs/linking-libraries-ios.html#manual-linking) the PushNotificationIOS library
*
* - Be sure to add the following to your `Header Search Paths`:
* `$(SRCROOT)/../node_modules/react-native/Libraries/PushNotificationIOS`
Expand Down
6 changes: 3 additions & 3 deletions Libraries/ReactIOS/NativeMethodsMixin.js
Expand Up @@ -56,7 +56,7 @@ function warnForStyleProps(props, validAttributes) {
* composite components that aren't directly backed by a native view. This will
* generally include most components that you define in your own app. For more
* information, see [Direct
* Manipulation](/react-native/docs/direct-manipulation.html).
* Manipulation](docs/direct-manipulation.html).
*/
var NativeMethodsMixin = {
/**
Expand All @@ -74,7 +74,7 @@ var NativeMethodsMixin = {
* Note that these measurements are not available until after the rendering
* has been completed in native. If you need the measurements as soon as
* possible, consider using the [`onLayout`
* prop](/react-native/docs/view.html#onlayout) instead.
* prop](docs/view.html#onlayout) instead.
*/
measure: function(callback: MeasureOnSuccessCallback) {
UIManager.measure(
Expand Down Expand Up @@ -108,7 +108,7 @@ var NativeMethodsMixin = {
* This function sends props straight to native. They will not participate in
* future diff process - this means that if you do not include them in the
* next render, they will remain active (see [Direct
* Manipulation](/react-native/docs/direct-manipulation.html)).
* Manipulation](docs/direct-manipulation.html)).
*/
setNativeProps: function(nativeProps: Object) {
if (__DEV__) {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Utilities/AlertIOS.js
Expand Up @@ -45,7 +45,7 @@ type ButtonsArray = Array<{
class AlertIOS {
/**
* Creates a popup to alert the user. See
* [Alert](/react-native/docs/alert.html).
* [Alert](docs/alert.html).
*
* - title: string -- The dialog's title.
* - message: string -- An optional message that appears above the text input.
Expand Down
Expand Up @@ -23,7 +23,7 @@ var currentCentroidY = TouchHistoryMath.currentCentroidY;
* recognize simple multi-touch gestures.
*
* It provides a predictable wrapper of the responder handlers provided by the
* [gesture responder system](/react-native/docs/gesture-responder-system.html).
* [gesture responder system](docs/gesture-responder-system.html).
* For each handler, it provides a new `gestureState` object alongside the
* native event object:
*
Expand Down
16 changes: 16 additions & 0 deletions circle.yml
Expand Up @@ -26,12 +26,15 @@ dependencies:
- npm install -g npm@3.2
- source scripts/circle-ci-android-setup.sh && getAndroidSDK
- ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog
- cd website && npm install
cache_directories:
- "ReactAndroid/build/downloads"
- "buck"
- "buck-out/bin"
- "website/node_modules"
override:
- npm install

test:
pre:
# starting emulator in advance because it takes very long to boot
Expand All @@ -41,6 +44,7 @@ test:
- ./gradlew :ReactAndroid:assembleDebug -PdisablePreDex -Pjobs=1:
timeout: 360
- source scripts/circle-ci-android-setup.sh && waitForAVD

override:
# buck tests
- buck/bin/buck test ReactAndroid/src/test/... --config build.threads=1
Expand All @@ -57,9 +61,21 @@ test:
# run tests on the emulator
- ./gradlew :ReactAndroid:connectedAndroidTest -PdisablePreDex --stacktrace --info:
timeout: 360

# testing docs generation is not broken
- cd website && node ./server/generate.js
post:
# copy test report for Circle CI to display
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
- find . -type f -regex ".*/build/test-results/debug/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
- find . -type f -regex ".*/outputs/androidTest-results/connected/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;

deployment:
website:
branch: [/.*-stable/, /master/]
commands:
# generate docs website
- git config --global user.email "bestnader@fb.com"

This comment has been minimized.

Copy link
@ide

ide Apr 4, 2016

Contributor

fyi @bestander :)

This comment has been minimized.

Copy link
@bestander

bestander Apr 5, 2016

Author Contributor

good catch, :)
@spicyj does reactjs-bot have an email?
So that I could configure git CLI on CI properly.

This comment has been minimized.

Copy link
@sophiebits

sophiebits Apr 6, 2016

Contributor

No official one. You could use reactjs-bot@users.noreply.github.com or make something else up.

- git config --global user.name "Website Deployment Script"
- echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
- cd website && GIT_USER=bestander npm run gh-pages
24 changes: 12 additions & 12 deletions docs/AndroidUIPerformance.md
Expand Up @@ -43,15 +43,15 @@ Once the trace starts collecting, perform the animation or interaction you care

After opening the trace in your browser (preferably Chrome), you should see something like this:

![Example](/react-native/img/SystraceExample.png)
![Example](img/SystraceExample.png)

**HINT**: Use the WASD keys to strafe and zoom

### Enable VSync highlighting

The first thing you should do is highlight the 16ms frame boundaries if you haven't already done that. Check this checkbox at the top right of the screen:

![Enable VSync Highlighting](/react-native/img/SystraceHighlightVSync.png)
![Enable VSync Highlighting](img/SystraceHighlightVSync.png)

You should see zebra stripes as in the screenshot above. If you don't, try profiling on a different device: Samsung has been known to have issues displaying vsyncs while the Nexus series is generally pretty reliable.

Expand All @@ -65,43 +65,43 @@ On the left side, you'll see a set of threads which correspond to the timeline r

This is where standard android measure/layout/draw happens. The thread name on the right will be your package name (in my case book.adsmanager) or UI Thread. The events that you see on this thread should look something like this and have to do with `Choreographer`, `traversals`, and `DispatchUI`:

![UI Thread Example](/react-native/img/SystraceUIThreadExample.png)
![UI Thread Example](img/SystraceUIThreadExample.png)

### JS Thread

This is where JS is executed. The thread name will be either `mqt_js` or `<...>` depending on how cooperative the kernel on your device is being. To identify it if it doesn't have a name, look for things like `JSCall`, `Bridge.executeJSCall`, etc:

![JS Thread Example](/react-native/img/SystraceJSThreadExample.png)
![JS Thread Example](img/SystraceJSThreadExample.png)

### Native Modules Thread

This is where native module calls (e.g. the `UIManager`) are executed. The thread name will be either `mqt_native_modules` or `<...>`. To identify it in the latter case, look for things like `NativeCall`, `callJavaModuleMethod`, and `onBatchComplete`:

![Native Modules Thread Example](/react-native/img/SystraceNativeModulesThreadExample.png)
![Native Modules Thread Example](img/SystraceNativeModulesThreadExample.png)

### Bonus: Render Thread

If you're using Android L (5.0) and up, you will also have a render thread in your application. This thread generates the actual OpenGL commands used to draw your UI. The thread name will be either `RenderThread` or `<...>`. To identify it in the latter case, look for things like `DrawFrame` and `queueBuffer`:

![Render Thread Example](/react-native/img/SystraceRenderThreadExample.png)
![Render Thread Example](img/SystraceRenderThreadExample.png)

## Identifying a culprit

A smooth animation should look something like the following:

![Smooth Animation](/react-native/img/SystraceWellBehaved.png)
![Smooth Animation](img/SystraceWellBehaved.png)

Each change in color is a frame -- remember that in order to display a frame, all our UI work needs to be done by the end of that 16ms period. Notice that no thread is working close to the frame boundary. An application rendering like this is rendering at 60FPS.

If you noticed chop, however, you might see something like this:

![Choppy Animation from JS](/react-native/img/SystraceBadJS.png)
![Choppy Animation from JS](img/SystraceBadJS.png)

Notice that the JS thread is executing basically all the time, and across frame boundaries! This app is not rendering at 60FPS. In this case, **the problem lies in JS**.

You might also see something like this:

![Choppy Animation from UI](/react-native/img/SystraceBadUI.png)
![Choppy Animation from UI](img/SystraceBadUI.png)

In this case, the UI and render threads are the ones that have work crossing frame boundaries. The UI that we're trying to render on each frame is requiring too much work to be done. In this case, **the problem lies in the native views being rendered**.

Expand All @@ -111,7 +111,7 @@ At this point, you'll have some very helpful information to inform your next ste

If you identified a JS problem, look for clues in the specific JS that you're executing. In the scenario above, we see `RCTEventEmitter` being called multiple times per frame. Here's a zoom-in of the JS thread from the trace above:

![Too much JS](/react-native/img/SystraceBadJS2.png)
![Too much JS](img/SystraceBadJS2.png)

This doesn't seem right. Why is it being called so often? Are they actually different events? The answers to these questions will probably depend on your product code. And many times, you'll want to look into [shouldComponentUpdate](https://facebook.github.io/react/docs/component-specs.html#updating-shouldcomponentupdate).

Expand All @@ -128,7 +128,7 @@ If you identified a native UI problem, there are usually two scenarios:

In the first scenario, you'll see a trace that has the UI thread and/or Render Thread looking like this:

![Overloaded GPU](/react-native/img/SystraceBadUI.png)
![Overloaded GPU](img/SystraceBadUI.png)

Notice the long amount of time spent in `DrawFrame` that crosses frame boundaries. This is time spent waiting for the GPU to drain its command buffer from the previous frame.

Expand All @@ -143,7 +143,7 @@ If these don't help and you want to dig deeper into what the GPU is actually doi

In the second scenario, you'll see something more like this:

![Creating Views](/react-native/img/SystraceBadCreateUI.png)
![Creating Views](img/SystraceBadCreateUI.png)

Notice that first the JS thread thinks for a bit, then you see some work done on the native modules thread, followed by an expensive traversal on the UI thread.

Expand Down
18 changes: 9 additions & 9 deletions docs/Animations.md
Expand Up @@ -267,7 +267,7 @@ it provides much less control than `Animated` and other animation libraries, so
you may need to use another approach if you can't get `LayoutAnimation` to do
what you want.
![](/react-native/img/LayoutAnimationExample.gif)
![](img/LayoutAnimationExample.gif)
```javascript
var App = React.createClass({
Expand Down Expand Up @@ -376,7 +376,7 @@ var App = React.createClass({
```
[Run this example](https://rnplay.org/apps/4FUQ-A)
![](/react-native/img/TweenState.gif)
![](img/TweenState.gif)
Here we animated the opacity, but as you might guess, we can animate any
numeric value. Read more about react-tween-state in its
Expand All @@ -395,7 +395,7 @@ value and end value. Rebound [is used
internally](https://github.com/facebook/react-native/search?utf8=%E2%9C%93&q=rebound)
by React Native on `Navigator` and `WarningBox`.
![](/react-native/img/ReboundImage.gif)
![](img/ReboundImage.gif)
Notice that Rebound animations can be interrupted - if you release in
the middle of a press, it will animate back from the current state to
Expand Down Expand Up @@ -440,7 +440,7 @@ var App = React.createClass({
transform: [{scaleX: this.state.scale}, {scaleY: this.state.scale}],
};

var imageUri = "https://facebook.github.io/react-native/img/ReboundExample.png";
var imageUri = "img/ReboundExample.png";

return (
<View style={styles.container}>
Expand All @@ -461,13 +461,13 @@ oscillate around the end value. In the above example, we would add
See the below gif for an example of where in your interface you might
use this.
![](/react-native/img/Rebound.gif) Screenshot from
![](img/Rebound.gif) Screenshot from
[react-native-scrollable-tab-view](https://github.com/brentvatne/react-native-scrollable-tab-view).
You can run a similar example [here](https://rnplay.org/apps/qHU_5w).
#### A sidenote about setNativeProps
As mentioned [in the Direction Manipulation section](/react-native/docs/direct-manipulation.html),
As mentioned [in the Direction Manipulation section](docs/direct-manipulation.html),
`setNativeProps` allows us to modify properties of native-backed
components (components that are actually backed by native views, unlike
composite components) directly, without having to `setState` and
Expand Down Expand Up @@ -497,7 +497,7 @@ render: function() {
<View style={styles.container}>
<TouchableWithoutFeedback onPressIn={this._onPressIn} onPressOut={this._onPressOut}>
<Image ref={component => this._photo = component}
source={{uri: "https://facebook.github.io/react-native/img/ReboundExample.png"}}
source={{uri: "img/ReboundExample.png"}}
style={{width: 250, height: 200}} />
</TouchableWithoutFeedback>
</View>
Expand All @@ -516,14 +516,14 @@ frames per second), look into using `setNativeProps` or
`shouldComponentUpdate` to optimize them. You may also want to defer any
computationally intensive work until after animations are complete,
using the
[InteractionManager](/react-native/docs/interactionmanager.html). You
[InteractionManager](docs/interactionmanager.html). You
can monitor the frame rate by using the In-App Developer Menu "FPS
Monitor" tool.
### Navigator Scene Transitions
As mentioned in the [Navigator
Comparison](https://facebook.github.io/react-native/docs/navigator-comparison.html#content),
Comparison](docs/navigator-comparison.html#content),
`Navigator` is implemented in JavaScript and `NavigatorIOS` is a wrapper
around native functionality provided by `UINavigationController`, so
these scene transitions apply only to `Navigator`. In order to re-create
Expand Down

0 comments on commit 6f1417c

Please sign in to comment.