Skip to content

Commit 365a4d4

Browse files
hramosfacebook-github-bot
authored andcommitted
Run more checks in parallel
Summary: Closes #17808 Differential Revision: D6866937 Pulled By: hramos fbshipit-source-id: 34c9aa93a5274b57da81eb5bbece2ce3e5296846
1 parent 22a2553 commit 365a4d4

File tree

1 file changed

+95
-53
lines changed

1 file changed

+95
-53
lines changed

.circleci/config.yml

Lines changed: 95 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
aliases:
2+
# Cache Management
23
- &restore-yarn-cache
34
keys:
45
- v1-yarn-{{ arch }}-{{ checksum "package.json" }}
@@ -34,11 +35,6 @@ aliases:
3435
- &restore-cache-ndk
3536
keys:
3637
- v1-android-ndk-{{ arch }}-r10e-32-64
37-
38-
- &install-ndk
39-
|
40-
source scripts/circle-ci-android-setup.sh && getAndroidNDK
41-
4238
- &save-cache-ndk
4339
paths:
4440
- /opt/ndk
@@ -60,6 +56,34 @@ aliases:
6056
- ~/watchman
6157
key: v1-watchman-{{ arch }}-v4.9.0
6258

59+
# Branch Filtering
60+
- &filter-only-master-stable
61+
branches:
62+
only:
63+
- /.*-stable/
64+
- master
65+
66+
- &filter-only-stable
67+
branches:
68+
only:
69+
- /.*-stable/
70+
71+
- &filter-ignore-gh-pages
72+
branches:
73+
ignore: gh-pages
74+
75+
- &filter-ignore-master-stable
76+
branches:
77+
ignore:
78+
- master
79+
- /.*-stable/
80+
- gh-pages
81+
82+
# Dependency Management
83+
- &install-ndk
84+
|
85+
source scripts/circle-ci-android-setup.sh && getAndroidNDK
86+
6387
- &yarn
6488
|
6589
yarn install --non-interactive --cache-folder ~/.cache/yarn
@@ -87,40 +111,6 @@ aliases:
87111
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
88112
sudo apt-get install -y nodejs
89113

90-
- &run-js-tests
91-
name: JavaScript Test Suite
92-
command: yarn test-ci
93-
94-
- &run-lint-checks
95-
|
96-
yarn lint
97-
98-
- &run-flow-checks
99-
|
100-
yarn flow check
101-
102-
- &filter-only-master-stable
103-
branches:
104-
only:
105-
- /.*-stable/
106-
- master
107-
108-
- &filter-only-stable
109-
branches:
110-
only:
111-
- /.*-stable/
112-
113-
- &filter-ignore-gh-pages
114-
branches:
115-
ignore: gh-pages
116-
117-
- &filter-ignore-master-stable
118-
branches:
119-
ignore:
120-
- master
121-
- /.*-stable/
122-
- gh-pages
123-
124114
- &create-ndk-directory
125115
|
126116
if [[ ! -e /opt/ndk ]]; then
@@ -144,6 +134,21 @@ aliases:
144134
sudo apt-get update -y
145135
sudo apt-get install ant autoconf automake g++ gcc libqt5widgets5 lib32z1 lib32stdc++6 make maven python-dev python3-dev qml-module-qtquick-controls qtdeclarative5-dev file -y
146136

137+
# Test Definitions
138+
- &run-js-tests
139+
name: JavaScript Test Suite
140+
command: yarn test-ci
141+
142+
- &run-lint-checks
143+
name: Lint code
144+
command: yarn lint --format junit -o ~/reports/junit/js-lint-results.xml
145+
when: always
146+
147+
- &run-flow-checks
148+
name: Check for errors in code using Flow
149+
command: yarn flow check
150+
when: always
151+
147152
- &build-android-app
148153
name: Build Android App
149154
command: |
@@ -193,6 +198,22 @@ aliases:
193198
command: |
194199
mkdir -p ~/reports/junit/
195200
201+
- &run-objc-ios-tests
202+
name: Objective-C iOS Test Suite
203+
command: ./scripts/objc-test-ios.sh
204+
205+
- &run-objc-tvos-tests
206+
name: Objective-C tvOS Test Suite
207+
command: ./scripts/objc-test-tvos.sh
208+
209+
- &run-objc-ios-e2e-tests
210+
name: Objective-C iOS End-to-End Test Suite
211+
command: node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3;
212+
213+
- &run-objc-tvos-e2e-tests
214+
name: Objective-C tvOS End-to-End Test Suite
215+
command: node ./scripts/run-ci-e2e-tests.js --tvos --js --retries 3;
216+
196217
defaults: &defaults
197218
working_directory: ~/react-native
198219

@@ -211,7 +232,8 @@ android_defaults: &android_defaults
211232

212233
version: 2
213234
jobs:
214-
# Runs JavaScript lint and flow checks
235+
# Runs JavaScript lint and flow checks.
236+
# Currently will fail a PR if lint/flow raises issues.
215237
run-js-checks:
216238
<<: *defaults
217239
docker:
@@ -223,9 +245,15 @@ jobs:
223245
- restore-cache: *restore-yarn-cache
224246
- run: *yarn
225247
- save-cache: *save-yarn-cache
248+
226249
- run: *run-lint-checks
227250
- run: *run-flow-checks
228251

252+
- store_test_results:
253+
path: ~/reports/junit
254+
- store_artifacts:
255+
path: ~/reports/junit
256+
229257
# Runs JavaScript tests on Node 8
230258
test-js-node-8:
231259
<<: *defaults
@@ -238,7 +266,9 @@ jobs:
238266
- restore-cache: *restore-yarn-cache
239267
- run: *yarn
240268
- save-cache: *save-yarn-cache
269+
241270
- run: *run-js-tests
271+
242272
- store_test_results:
243273
path: ~/reports/junit
244274
- store_artifacts:
@@ -256,7 +286,9 @@ jobs:
256286
- restore-cache: *restore-yarn-cache
257287
- run: *yarn
258288
- save-cache: *save-yarn-cache
289+
259290
- run: *run-js-tests
291+
260292
- store_test_results:
261293
path: ~/reports/junit
262294
- store_artifacts:
@@ -277,7 +309,9 @@ jobs:
277309
- restore-cache: *restore-yarn-cache
278310
- run: *yarn
279311
- save-cache: *save-yarn-cache
280-
- run: ./scripts/objc-test-ios.sh
312+
313+
- run: *run-objc-ios-tests
314+
281315
- store_test_results:
282316
path: ~/reports/junit
283317
- store_artifacts:
@@ -298,14 +332,16 @@ jobs:
298332
- restore-cache: *restore-yarn-cache
299333
- run: *yarn
300334
- save-cache: *save-yarn-cache
301-
- run: ./scripts/objc-test-tvos.sh
335+
336+
- run: *run-objc-tvos-tests
337+
302338
- store_test_results:
303339
path: ~/reports/junit
304340
- store_artifacts:
305341
path: ~/reports/junit
306342

307343
# Runs end to end tests
308-
test-objc-e2e:
344+
test-e2e-objc-ios:
309345
<<: *defaults
310346
macos:
311347
xcode: "9.0"
@@ -319,7 +355,13 @@ jobs:
319355
- restore-cache: *restore-yarn-cache
320356
- run: *yarn
321357
- save-cache: *save-yarn-cache
322-
- run: node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3;
358+
359+
- run: *run-objc-ios-e2e-tests
360+
361+
- store_test_results:
362+
path: ~/reports/junit
363+
- store_artifacts:
364+
path: ~/reports/junit
323365

324366
# Checks podspec
325367
test-podspec:
@@ -440,13 +482,15 @@ jobs:
440482
- store_artifacts:
441483
path: ~/reports/junit
442484

485+
# Analyze pull request and raise any lint/flow issues.
486+
# Issues will be posted to the PR itself via GitHub bots.
487+
# This workflow should only fail if the bots fail to run.
443488
analyze-pull-request:
444489
<<: *defaults
445490
docker:
446491
- image: circleci/node:8
447492
steps:
448493
- checkout
449-
- run: *setup-artifacts
450494

451495
- restore-cache: *restore-cache-analysis
452496
- run: *yarn
@@ -469,23 +513,16 @@ jobs:
469513
else
470514
echo "Skipping pull request analysis."
471515
fi
472-
background: true
473516
when: always
474517
- run:
475518
name: Analyze Code
476519
command: |
477520
if [ -n "$CIRCLE_PR_NUMBER" ]; then
478521
cat <(echo eslint; yarn --silent lint --format=json; echo flow; yarn --silent flow 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
479-
yarn lint --format junit -o ~/reports/junit/js-lint-results.xml
480522
else
481523
echo "Skipping code analysis."
482524
fi
483-
background: true
484525
when: always
485-
- store_test_results:
486-
path: ~/reports/junit
487-
- store_artifacts:
488-
path: ~/reports/junit
489526

490527
# Workflows enables us to run multiple jobs in parallel
491528
workflows:
@@ -513,8 +550,13 @@ workflows:
513550
filters: *filter-ignore-gh-pages
514551
- test-objc-tvos:
515552
filters: *filter-ignore-gh-pages
516-
- test-objc-e2e:
553+
554+
# End-to-end tests
555+
- test-e2e-objc-ios:
517556
filters: *filter-ignore-gh-pages
557+
requires:
558+
- test-objc-ios
559+
- test-js-node-8
518560

519561
# If we are on a stable branch, deploy to `npm`
520562
- hold:

0 commit comments

Comments
 (0)