Skip to content

Commit 4d77c74

Browse files
grabboufacebook-github-bot
authored andcommitted
Fix Analyze step on CI
Summary: Recent changes that introduced Circle 2 (thanks ide and hramos for work on this) include special step for analyzing code. It takes PR number and processes the build. Unfortunately, that breaks all non-PR builds (including ones scheduled by me as a part of release step). This PR simply checks if such env variable is set and stops executing in case it's undefined. Also, I have updated the order of the tests so that most important (unit tests) are no longer shadowed by temporary eslint and flow breakage. The reason for this change is that flow has been broken for ~20 days which shadowed breakage in unit tests (addressed in my other PR). You can see build breaking before this change: https://circleci.com/gh/facebook/react-native/22391 And being green after: https://circleci.com/gh/facebook/react-native/22530 Closes react#16302 Differential Revision: D6031348 Pulled By: hramos fbshipit-source-id: f1127a87faa872f413e9fcb780bdc1d5d587de2c
1 parent 78d5705 commit 4d77c74

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

.circleci/config.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,19 @@ jobs:
9292
- checkout
9393
- run: npm install --no-package-lock
9494
- run: |
95+
npm test -- --maxWorkers=2
9596
npm run lint
9697
npm run flow -- check
97-
npm test -- --maxWorkers=2
98-
# eslint
98+
# eslint - doesn't run on non-PR builds
9999
- run:
100100
name: Analyze Code
101101
command: |
102-
npm install github@0.2.4
103-
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
102+
if [ -n "$CIRCLE_PR_NUMBER" ]; then
103+
npm install github@0.2.4
104+
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
105+
else
106+
echo "Skipping code analysis."
107+
fi
104108
105109
test-node-6:
106110
<<: *defaults
@@ -110,9 +114,9 @@ jobs:
110114
- checkout
111115
- run: npm install
112116
- run: |
117+
npm test -- --maxWorkers=2
113118
npm run lint
114119
npm run flow -- check
115-
npm test -- --maxWorkers=2
116120
117121
test-node-4:
118122
<<: *defaults
@@ -122,10 +126,10 @@ jobs:
122126
- checkout
123127
- run: npm install
124128
- run: |
129+
npm test -- --maxWorkers=2
125130
npm run lint
126131
npm run flow -- check
127-
npm test -- --maxWorkers=2
128-
132+
129133
test-website:
130134
<<: *defaults
131135
docker:

0 commit comments

Comments
 (0)