Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<PROJECT_ROOT>/.*/__tests__/.*

# Ignore Docs
<PROJECT_ROOT>/docs/.*
<PROJECT_ROOT>/.*/docs/.*

[include]
Expand Down
42 changes: 42 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
general:
branches:
ignore:
- gh-pages

machine:
timezone: America/Los_Angeles
node:
version: 6
ruby:
version: 2.2.3
environment:
TRAVIS_REPO_SLUG: facebook/react

dependencies:
pre:
# This is equivalent to $TRAVIS_COMMIT_RANGE
# Need to figure out how to bail early if this is a "docs only" build
- echo $CIRCLE_COMPARE_URL | cut -d/ -f7
override:
- bundle install --gemfile=docs/Gemfile --deployment --path=vendor/bundle --jobs=3 --retry=3
- npm install
- scripts/circleci/set_up_github_keys.sh
post:
# - npm ls --depth=0
cache_directories:
- docs/vendor/bundle
- .grunt # Show size comparisons between builds
- ~/react-gh-pages # docs checkout

test:
override:
- ./scripts/circleci/test_entry_point.sh:
parallel: true

deployment:
staging:
branch: /.*/
commands:
- ./scripts/circleci/upload_build.sh
- ./scripts/circleci/build_gh_pages.sh
2 changes: 2 additions & 0 deletions fixtures/browserify/input.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var React = require('react');
var CSSTransitionGroup = require('react-addons-css-transition-group');
var ReactDOM = require('react-dom');
Expand Down
2 changes: 2 additions & 0 deletions fixtures/brunch/app/initialize.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var React = require('react');
var CSSTransitionGroup = require('react-addons-css-transition-group');
var ReactDOM = require('react-dom');
Expand Down
2 changes: 2 additions & 0 deletions fixtures/brunch/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

exports.config = {
paths: {
public: '.',
Expand Down
2 changes: 2 additions & 0 deletions fixtures/brunch/input.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var React = require('react');
var CSSTransitionGroup = require('react-addons-css-transition-group');
var ReactDOM = require('react-dom');
Expand Down
2 changes: 2 additions & 0 deletions fixtures/build-all.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var fs = require('fs');
var path = require('path');
var { spawnSync } = require('child_process');
Expand Down
2 changes: 2 additions & 0 deletions fixtures/rjs/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
baseUrl: '.',
name: 'input',
Expand Down
2 changes: 2 additions & 0 deletions fixtures/rjs/input.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

require(['react', 'react-dom'], function(React, ReactDOM) {
var CSSTransitionGroup = React.addons.CSSTransitionGroup;
ReactDOM.render(
Expand Down
2 changes: 2 additions & 0 deletions fixtures/systemjs-builder/build.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var Builder = require('systemjs-builder');

var builder = new Builder('/', './config.js');
Expand Down
2 changes: 2 additions & 0 deletions fixtures/systemjs-builder/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

System.config({
paths: {
react: '../../build/react-with-addons.js',
Expand Down
2 changes: 2 additions & 0 deletions fixtures/systemjs-builder/input.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

import React from 'react';
import ReactDOM from 'react-dom';

Expand Down
2 changes: 2 additions & 0 deletions fixtures/webpack-alias/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
entry: './input',
output: {
Expand Down
2 changes: 2 additions & 0 deletions fixtures/webpack-alias/input.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var React = require('react');
var ReactDOM = require('react-dom');

Expand Down
2 changes: 2 additions & 0 deletions fixtures/webpack/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
entry: './input',
output: {
Expand Down
2 changes: 2 additions & 0 deletions fixtures/webpack/input.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var React = require('react');
var CSSTransitionGroup = require('react-addons-css-transition-group');
var ReactDOM = require('react-dom');
Expand Down
1 change: 1 addition & 0 deletions grunt/tasks/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function run(done, coverage) {

var args = [
path.join('node_modules', 'jest', 'bin', 'jest'),
'--runInBand',
];
if (coverage) {
args.push('--coverage');
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"gulp-util": "^3.0.7",
"gzip-js": "~0.3.2",
"jest": "^15.1.1",
"jest-cli": "^15.1.1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that just adding jest-cli is not enough.

The problem is we haven't synced package.json for a while, and we need to update it to match what we have on master. For example we already have jest-cli@18 there.

In general, in this PR the goal is to bring it as close as possible to master. We probably missed some commits at some point. There shouldn't be much intentional divergence between 15-stable and master. So now that you found a set of changes that work, could you also reduce it so that it matches master whenever possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In terms of linting, would it be preferable to pull in the eslint updates from master and make 15-stable conform? Or update 15-stable to conform to its current linting rules? I seem to be getting linting errors on install due to these changes and this rule. That rule was removed in 16.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s best to make it as close to master as we can in terms of linting setup. It would make sense to me to have 32f5b03 and similar changes cherry-picked.

"loose-envify": "^1.1.0",
"merge-stream": "^1.0.0",
"object-assign": "^4.1.0",
Expand Down
33 changes: 33 additions & 0 deletions scripts/circleci/build_gh_pages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -e

if [ -z $CI_PULL_REQUEST ] && [ "$CIRCLE_BRANCH" = "$REACT_WEBSITE_BRANCH" ]; then

GH_PAGES_DIR=`pwd`/../react-gh-pages

# check if directory exists (restored from cache)
if [ -d $GH_PAGES_DIR ]; then
pushd $GH_PAGES_DIR
git pull origin gh-pages
popd
else
git clone --branch gh-pages --depth=1 \
https://reactjs-bot@github.com/facebook/react.git \
$GH_PAGES_DIR
fi

pushd docs
bundle exec rake release
cd $GH_PAGES_DIR
git status
git --no-pager diff
if ! git diff-index --quiet HEAD --; then
git add -A .
git commit -m "Rebuild website"
git push origin gh-pages
fi
popd
else
echo "Not building website"
fi
12 changes: 12 additions & 0 deletions scripts/circleci/set_up_github_keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

if [ -n $GITHUB_TOKEN ]; then

GH_PAGES_DIR=`pwd`/../react-gh-pages
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" >~/.netrc
git config --global user.name "Circle CI"
git config --global user.email "circle@reactjs.org"

fi
8 changes: 8 additions & 0 deletions scripts/circleci/test_coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -e

./node_modules/.bin/grunt jest:coverage
if [ -z $CI_PULL_REQUEST ]; then
cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
fi
62 changes: 62 additions & 0 deletions scripts/circleci/test_entry_point.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

set -e

COMMANDS_TO_RUN=()

# We split these to be approximately equal chunks of four. As of this writing,
# times were around:
# - 3:30 test_coverage.sh
# - 2:00 test_fiber.sh
# - 1:15 test_html_generation.sh
# - 1:15 grunt build
# with everything else < 0:30.

if [ $((1 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
COMMANDS_TO_RUN+=('./scripts/circleci/test_coverage.sh')
fi

if [ $((2 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
COMMANDS_TO_RUN+=('./scripts/circleci/test_html_generation.sh')
fi

# These seem out of order but extract-errors must be run after jest.
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
COMMANDS_TO_RUN+=('./node_modules/.bin/gulp lint')
COMMANDS_TO_RUN+=('./node_modules/.bin/gulp flow')
COMMANDS_TO_RUN+=('./node_modules/.bin/grunt build')
COMMANDS_TO_RUN+=('./scripts/circleci/test_extract_errors.sh')
COMMANDS_TO_RUN+=('./scripts/circleci/track_stats.sh')
fi

RETURN_CODES=()
FAILURE=0

printf "Node #%s (%s total). " "$CIRCLE_NODE_INDEX" "$CIRCLE_NODE_TOTAL"
if [ -n "${COMMANDS_TO_RUN[0]}" ]; then
echo "Preparing to run commands:"
for cmd in "${COMMANDS_TO_RUN[@]}"; do
echo "- $cmd"
done

for cmd in "${COMMANDS_TO_RUN[@]}"; do
echo
echo "$ $cmd"
set +e
$cmd
rc=$?
set -e
RETURN_CODES+=($rc)
if [ $rc -ne 0 ]; then
FAILURE=$rc
fi
done

echo
for i in "${!COMMANDS_TO_RUN[@]}"; do
echo "Received return code ${RETURN_CODES[i]} from: ${COMMANDS_TO_RUN[i]}"
done
exit $FAILURE
else
echo "No commands to run."
fi
6 changes: 6 additions & 0 deletions scripts/circleci/test_extract_errors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e

./node_modules/.bin/gulp react:extract-errors
git checkout -- scripts/error-codes/codes.json
9 changes: 9 additions & 0 deletions scripts/circleci/test_html_generation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -e

echo 'Testing in server-render (HTML generation) mode...'
printf '\nmodule.exports.useCreateElement = false;\n' \
>> src/renderers/dom/shared/ReactDOMFeatureFlags.js
./node_modules/.bin/grunt jest:normal
git checkout -- src/renderers/dom/shared/ReactDOMFeatureFlags.js
8 changes: 8 additions & 0 deletions scripts/circleci/track_stats.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -e

ALL_FILES=`find src -name '*.js' | grep -v umd/ | grep -v __tests__ | grep -v __mocks__`
COUNT_ALL_FILES=`echo "$ALL_FILES" | wc -l`
COUNT_WITH_FLOW=`grep '@flow' $ALL_FILES | perl -pe 's/:.+//' | wc -l`
node scripts/facts-tracker/index.js "flow-files" "$COUNT_WITH_FLOW/$COUNT_ALL_FILES"
23 changes: 23 additions & 0 deletions scripts/circleci/upload_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

if [ -z $CI_PULL_REQUEST ] && [ -n "$BUILD_SERVER_ENDPOINT" ]; then
curl \
-F "react=@build/react.js" \
-F "react.min=@build/react.min.js" \
-F "react-with-addons=@build/react-with-addons.js" \
-F "react-with-addons.min=@build/react-with-addons.min.js" \
-F "react-dom=@build/react-dom.js" \
-F "react-dom.min=@build/react-dom.min.js" \
-F "react-dom-server=@build/react-dom-server.js" \
-F "react-dom-server.min=@build/react-dom-server.min.js" \
-F "npm-react=@build/packages/react.tgz" \
-F "npm-react-dom=@build/packages/react-dom.tgz" \
-F "commit=$CIRCLE_SHA1" \
-F "date=`git log --format='%ct' -1`" \
-F "pull_request=false" \
-F "token=$BUILD_SERVER_TOKEN" \
-F "branch=$CIRCLE_BRANCH" \
$BUILD_SERVER_ENDPOINT
fi