Add Danger and publish to npm
Summary: Run on Circle Closes https://github.com/facebook/react-native/pull/16350 Differential Revision: D6066460 Pulled By: hramos fbshipit-source-id: 667e1cc8b2b32f6aa1c8b995618d6362cd71d9e5
This commit is contained in:
parent
6747a36f5d
commit
601abd2503
|
@ -21,16 +21,16 @@ aliases:
|
||||||
- website/node_modules
|
- website/node_modules
|
||||||
key: v1-website-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "website/package.json" }}
|
key: v1-website-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "website/package.json" }}
|
||||||
|
|
||||||
- &restore-cache-danger
|
- &restore-cache-analysis
|
||||||
keys:
|
keys:
|
||||||
- v1-danger-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "danger/package.json" }}
|
- v1-analysis-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}{{ checksum "danger/package.json" }}
|
||||||
# Fallback in case checksum fails
|
# Fallback in case checksum fails
|
||||||
- v1-danger-dependencies-{{ arch }}-{{ .Branch }}-
|
- v1-analysis-dependencies-{{ arch }}-{{ .Branch }}-
|
||||||
|
- &save-cache-analysis
|
||||||
- &save-cache-danger
|
|
||||||
paths:
|
paths:
|
||||||
- danger/node_modules
|
- danger/node_modules
|
||||||
key: v1-danger-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "danger/package.json" }}
|
- node_modules
|
||||||
|
key: v1-analysis-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}{{ checksum "danger/package.json" }}
|
||||||
|
|
||||||
- &restore-cache-android-packages
|
- &restore-cache-android-packages
|
||||||
keys:
|
keys:
|
||||||
|
@ -93,13 +93,29 @@ aliases:
|
||||||
npm run lint
|
npm run lint
|
||||||
npm run flow -- check
|
npm run flow -- check
|
||||||
|
|
||||||
|
- &filter-only-master-stable
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- /.*-stable/
|
||||||
|
- master
|
||||||
|
|
||||||
|
- &filter-ignore-gh-pages
|
||||||
|
branches:
|
||||||
|
ignore: gh-pages
|
||||||
|
|
||||||
|
- &filter-ignore-master-stable
|
||||||
|
branches:
|
||||||
|
ignore:
|
||||||
|
- master
|
||||||
|
- /.*-stable/
|
||||||
|
- gh-pages
|
||||||
|
|
||||||
defaults: &defaults
|
defaults: &defaults
|
||||||
working_directory: ~/react-native
|
working_directory: ~/react-native
|
||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
jobs:
|
jobs:
|
||||||
|
# Runs JavaScript tests on Node 8
|
||||||
# Runs unit tests on Node 8
|
|
||||||
test-js-node-8:
|
test-js-node-8:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
docker:
|
docker:
|
||||||
|
@ -111,7 +127,7 @@ jobs:
|
||||||
- save-cache: *save-node-cache
|
- save-cache: *save-node-cache
|
||||||
- run: *run-node-tests
|
- run: *run-node-tests
|
||||||
|
|
||||||
# Runs unit tests on Node 6
|
# Runs JavaScript tests on Node 6
|
||||||
test-js-node-6:
|
test-js-node-6:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
docker:
|
docker:
|
||||||
|
@ -123,7 +139,7 @@ jobs:
|
||||||
- save-cache: *save-node-cache
|
- save-cache: *save-node-cache
|
||||||
- run: *run-node-tests
|
- run: *run-node-tests
|
||||||
|
|
||||||
# Runs unit tests on Node 4
|
# Runs JavaScript tests on Node 4
|
||||||
test-js-node-4:
|
test-js-node-4:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
docker:
|
docker:
|
||||||
|
@ -191,7 +207,7 @@ jobs:
|
||||||
- run: *install-node-dependencies
|
- run: *install-node-dependencies
|
||||||
- save-cache: *save-node-cache
|
- save-cache: *save-node-cache
|
||||||
- run: ./scripts/process-podspecs.sh
|
- run: ./scripts/process-podspecs.sh
|
||||||
|
|
||||||
test-website:
|
test-website:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
docker:
|
docker:
|
||||||
|
@ -202,7 +218,7 @@ jobs:
|
||||||
name: Install Dependencies
|
name: Install Dependencies
|
||||||
command: |
|
command: |
|
||||||
cd website
|
cd website
|
||||||
npm install --no-package-lock
|
npm install --no-package-lock --no-spin --no-progress
|
||||||
- run:
|
- run:
|
||||||
name: Test Website
|
name: Test Website
|
||||||
command: |
|
command: |
|
||||||
|
@ -222,7 +238,7 @@ jobs:
|
||||||
name: Install Dependencies
|
name: Install Dependencies
|
||||||
command: |
|
command: |
|
||||||
cd website
|
cd website
|
||||||
npm install --no-package-lock
|
npm install --no-package-lock --no-spin --no-progress
|
||||||
- run:
|
- run:
|
||||||
name: Build and Deploy Static Website
|
name: Build and Deploy Static Website
|
||||||
command: |
|
command: |
|
||||||
|
@ -230,13 +246,13 @@ jobs:
|
||||||
git config --global user.email "reactjs-bot@users.noreply.github.com"
|
git config --global user.email "reactjs-bot@users.noreply.github.com"
|
||||||
git config --global user.name "Website Deployment Script"
|
git config --global user.name "Website Deployment Script"
|
||||||
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
|
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
|
||||||
|
|
||||||
echo "Deploying website..."
|
echo "Deploying website..."
|
||||||
cd website && GIT_USER=reactjs-bot npm run gh-pages
|
cd website && GIT_USER=reactjs-bot npm run gh-pages
|
||||||
else
|
else
|
||||||
echo "Skipping deploy."
|
echo "Skipping deploy."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Build JavaScript bundle for Android tests
|
||||||
build-js-bundle:
|
build-js-bundle:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
docker:
|
docker:
|
||||||
|
@ -256,6 +272,7 @@ jobs:
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
path: ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
||||||
|
|
||||||
|
# Runs unit tests tests on Android
|
||||||
test-android:
|
test-android:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
docker:
|
docker:
|
||||||
|
@ -413,43 +430,120 @@ jobs:
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: ~/junit
|
path: ~/junit
|
||||||
|
|
||||||
|
analyze-pull-request:
|
||||||
|
<<: *defaults
|
||||||
|
docker:
|
||||||
|
- image: circleci/node:8
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- restore-cache: *restore-cache-analysis
|
||||||
|
- run: *install-node-dependencies
|
||||||
|
- run:
|
||||||
|
name: Install Dependencies
|
||||||
|
command: |
|
||||||
|
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
|
||||||
|
npm install github@0.2.4
|
||||||
|
cd danger
|
||||||
|
npm install --no-package-lock --no-spin --no-progress
|
||||||
|
else
|
||||||
|
echo "Skipping dependency installation."
|
||||||
|
fi
|
||||||
|
- save-cache: *save-cache-analysis
|
||||||
|
# Run Danger
|
||||||
|
- run:
|
||||||
|
name: Analyze Pull Request
|
||||||
|
command: |
|
||||||
|
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
|
||||||
|
cd danger && DANGER_GITHUB_API_TOKEN="e622517d9f1136ea8900""07c6373666312cdfaa69" npm run danger
|
||||||
|
else
|
||||||
|
echo "Skipping pull request analysis."
|
||||||
|
fi
|
||||||
|
when: always
|
||||||
|
# Run eslint
|
||||||
|
- run:
|
||||||
|
name: Analyze Code
|
||||||
|
command: |
|
||||||
|
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
|
||||||
|
cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; npm run flow --silent -- check --json) | GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" CI_USER=$CIRCLE_PROJECT_USERNAME CI_REPO=$CIRCLE_PROJECT_REPONAME PULL_REQUEST_NUMBER=$CIRCLE_PR_NUMBER node bots/code-analysis-bot.js
|
||||||
|
else
|
||||||
|
echo "Skipping code analysis."
|
||||||
|
fi
|
||||||
|
|
||||||
|
publish-npm:
|
||||||
|
<<: *defaults
|
||||||
|
docker:
|
||||||
|
- image: circleci/node:8
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: *install-node-dependencies
|
||||||
|
- run:
|
||||||
|
name: Publish React Native Package
|
||||||
|
command: |
|
||||||
|
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
|
||||||
|
echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
|
||||||
|
git config --global user.email "reactjs-bot@users.noreply.github.com"
|
||||||
|
git config --global user.name "Website Deployment Script"
|
||||||
|
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
|
||||||
|
node ./scripts/publish-npm.js
|
||||||
|
else
|
||||||
|
echo "Skipping publication."
|
||||||
|
fi
|
||||||
|
|
||||||
# Workflows enables us to run multiple jobs in parallel
|
# Workflows enables us to run multiple jobs in parallel
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
|
||||||
test_node:
|
test_node:
|
||||||
jobs:
|
jobs:
|
||||||
- test-js-node-8
|
- test-js-node-8:
|
||||||
- test-js-node-6
|
filters: *filter-ignore-gh-pages
|
||||||
# TODO: Node 4 tests are already failing on Circle 1.0
|
- test-js-node-6:
|
||||||
# - test-js-node-4
|
filters: *filter-ignore-gh-pages
|
||||||
|
|
||||||
|
# TODO: Re-enable. Node 4 tests are already failing on Circle 1.0
|
||||||
|
# - test-js-node-4:
|
||||||
|
# filters: *filter-ignore-gh-pages
|
||||||
|
|
||||||
website:
|
|
||||||
jobs:
|
|
||||||
- test-website
|
|
||||||
- deploy-website:
|
|
||||||
requires:
|
|
||||||
- test-website
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- /.*-stable/
|
|
||||||
- master
|
|
||||||
|
|
||||||
test_android:
|
test_android:
|
||||||
jobs:
|
jobs:
|
||||||
- build-js-bundle:
|
- build-js-bundle:
|
||||||
filters:
|
filters: *filter-ignore-gh-pages
|
||||||
branches:
|
|
||||||
ignore: gh-pages
|
|
||||||
- test-android:
|
- test-android:
|
||||||
requires:
|
requires:
|
||||||
- build-js-bundle
|
- build-js-bundle
|
||||||
|
|
||||||
test_ios:
|
test_ios:
|
||||||
jobs:
|
jobs:
|
||||||
- test-objc-ios
|
- test-objc-ios:
|
||||||
- test-objc-tvos
|
filters: *filter-ignore-gh-pages
|
||||||
# TODO: Podspec tests are already failing on Travis
|
- test-objc-tvos:
|
||||||
# - test-podspec
|
filters: *filter-ignore-gh-pages
|
||||||
- test-objc-e2e
|
- test-objc-e2e:
|
||||||
|
filters: *filter-ignore-gh-pages
|
||||||
|
# TODO: Re-enable. Podspec tests are already failing on Travis
|
||||||
|
# - test-podspec:
|
||||||
|
# filters: *filter-ignore-gh-pages
|
||||||
|
|
||||||
|
website:
|
||||||
|
jobs:
|
||||||
|
- test-website:
|
||||||
|
filters: *filter-ignore-gh-pages
|
||||||
|
- deploy-website:
|
||||||
|
requires:
|
||||||
|
- test-website
|
||||||
|
filters: *filter-only-master-stable
|
||||||
|
|
||||||
|
analyze:
|
||||||
|
jobs:
|
||||||
|
- analyze-pull-request:
|
||||||
|
filters: *filter-ignore-master-stable
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
jobs:
|
||||||
|
- hold:
|
||||||
|
type: approval
|
||||||
|
- publish-npm:
|
||||||
|
requires:
|
||||||
|
- hold
|
||||||
|
filters: *filter-only-master-stable
|
||||||
|
|
|
@ -51,7 +51,7 @@ if (editsBlogPost) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fails if the description is too short.
|
// Fails if the description is too short.
|
||||||
if (danger.github.pr.body.length < 10) {
|
if (!danger.github.pr.body || danger.github.pr.body.length < 10) {
|
||||||
fail(':grey_question: This pull request needs a description.');
|
fail(':grey_question: This pull request needs a description.');
|
||||||
markdown('@facebook-github-bot label Needs more information');
|
markdown('@facebook-github-bot label Needs more information');
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ if (packageChanged) {
|
||||||
|
|
||||||
// Warns if a test plan is missing.
|
// Warns if a test plan is missing.
|
||||||
const gettingStartedChanged = includes(danger.git.modified_files, 'docs/GettingStarted.md');
|
const gettingStartedChanged = includes(danger.git.modified_files, 'docs/GettingStarted.md');
|
||||||
const includesTestPlan = danger.github.pr.body.toLowerCase().includes('test plan');
|
const includesTestPlan = danger.github.pr.body && danger.github.pr.body.toLowerCase().includes('test plan');
|
||||||
|
|
||||||
// Warns if a test plan is missing, when editing the Getting Started guide. This page needs to be
|
// Warns if a test plan is missing, when editing the Getting Started guide. This page needs to be
|
||||||
// tested in all its permutations.
|
// tested in all its permutations.
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"danger": "node ./node_modules/.bin/danger"
|
"danger": "node ./node_modules/.bin/danger"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"danger": "^0.21.2",
|
"danger": "^1.2.0",
|
||||||
"lodash.includes": "^4.3.0",
|
"lodash.includes": "^4.3.0",
|
||||||
"minimatch": "^3.0.4"
|
"minimatch": "^3.0.4"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue