forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This pull request migrates Travis to Circle and pre-starts iOS simulators / tvOS ones as advised in documentation to speed up builds. It also uses Xcode 9.0 to build and test apps. Note that podspec test is failing and it's been failing for a while on Travis as well (since podspec has been changed to use Cxx bridge by default). I've notified few folks here of that and we are looking to fix this test, but it's not related to the scope of this PR. Also, previously, podspec tests were only runninng on master (disabled for PR builds) where I think it makes more sense to run them on PR builds as well (all in all, we want to prevent breakage before merging). That said, I've removed `if` check to make it run on all builds. Other small changes: - cache `node_modules` properly (previously defined as restore_cache and save_cache but not referenced in following jobs) Closes facebook#16354 Differential Revision: D6054858 Pulled By: hramos fbshipit-source-id: 5165bef0985f4257febced14873be5bcb80b9f51
- Loading branch information
1 parent
f3b117a
commit c0e6d41
Showing
3 changed files
with
139 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,42 @@ | ||
aliases: | ||
- &restore-cache | ||
- &restore-node-cache | ||
keys: | ||
- v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }} | ||
- v1-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }} | ||
# Fallback in case checksum fails | ||
- v1-dependencies-{{ .Branch }}- | ||
- &save-cache | ||
- v1-dependencies-{{ arch }}-{{ .Branch }}- | ||
|
||
- &save-node-cache | ||
paths: | ||
- node_modules | ||
key: v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }} | ||
key: v1-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }} | ||
|
||
- &restore-cache-website | ||
keys: | ||
- v1-website-dependencies-{{ .Branch }}-{{ checksum "website/package.json" }} | ||
- v1-website-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "website/package.json" }} | ||
# Fallback in case checksum fails | ||
- v1-website-dependencies-{{ .Branch }}- | ||
- v1-website-dependencies-{{ arch }}-{{ .Branch }}- | ||
|
||
- &save-cache-website | ||
paths: | ||
- website/node_modules | ||
key: v1-website-dependencies-{{ .Branch }}-{{ checksum "website/package.json" }} | ||
key: v1-website-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "website/package.json" }} | ||
|
||
- &restore-cache-danger | ||
keys: | ||
- v1-danger-dependencies-{{ .Branch }}-{{ checksum "danger/package.json" }} | ||
- v1-danger-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "danger/package.json" }} | ||
# Fallback in case checksum fails | ||
- v1-danger-dependencies-{{ .Branch }}- | ||
- v1-danger-dependencies-{{ arch }}-{{ .Branch }}- | ||
|
||
- &save-cache-danger | ||
paths: | ||
- danger/node_modules | ||
key: v1-danger-dependencies-{{ .Branch }}-{{ checksum "danger/package.json" }} | ||
key: v1-danger-dependencies-{{ arch }}-{{ .Branch }}-{{ checksum "danger/package.json" }} | ||
|
||
- &restore-cache-android-packages | ||
keys: | ||
- v1-android-sdkmanager-packages-{{ checksum "scripts/circle-ci-android-setup.sh" }} | ||
- v1-android-sdkmanager-packages-{{ arch }}-{{ checksum "scripts/circle-ci-android-setup.sh" }} | ||
# Fallback in case checksum fails | ||
- v1-android-sdkmanager-packages- | ||
- v1-android-sdkmanager-packages-{{ arch }}- | ||
- &save-cache-android-packages | ||
paths: | ||
- /opt/android/sdk/system-images/android-23 | ||
|
@@ -43,92 +46,151 @@ aliases: | |
- /opt/android/sdk/platforms/android-19 | ||
- /opt/android/sdk/build-tools/23.0.1 | ||
- /opt/android/sdk/add-ons/addon-google_apis-google-23 | ||
key: v1-android-sdkmanager-packages-{{ checksum "scripts/circle-ci-android-setup.sh" }} | ||
key: v1-android-sdkmanager-packages-{{ arch }}-{{ checksum "scripts/circle-ci-android-setup.sh" }} | ||
|
||
- &restore-cache-ndk | ||
keys: | ||
- v1-android-ndk-r10e-32-64 | ||
- v1-android-ndk-{{ arch }}-r10e-32-64 | ||
|
||
- &save-cache-ndk | ||
paths: | ||
- /opt/ndk | ||
key: v1-android-ndk-r10e-32-64 | ||
key: v1-android-ndk-{{ arch }}-r10e-32-64 | ||
|
||
- &restore-cache-buck-downloads | ||
keys: | ||
- v1-buck-downloads-{{ .Branch }}-{{ checksum "ReactAndroid/build.gradle" }} | ||
- v1-buck-downloads-{{ arch }}-{{ .Branch }}-{{ checksum "ReactAndroid/build.gradle" }} | ||
# Fallback in case checksum fails | ||
- v1-buck-downloads-{{ .Branch }}- | ||
- v1-buck-downloads-{{ arch }}-{{ .Branch }}- | ||
- &save-cache-buck-downloads | ||
paths: | ||
- "ReactAndroid/build/downloads" | ||
key: v1-buck-downloads-{{ .Branch }}-{{ checksum "ReactAndroid/build.gradle" }} | ||
key: v1-buck-downloads-{{ arch }}-{{ .Branch }}-{{ checksum "ReactAndroid/build.gradle" }} | ||
|
||
- &restore-cache-buck | ||
keys: | ||
- v1-buck-v2017.09.04.02 | ||
- v1-buck-{{ arch }}-v2017.09.04.02 | ||
- &save-cache-buck | ||
paths: | ||
- ~/buck | ||
key: v1-buck-v2017.09.04.02 | ||
key: v1-buck-{{ arch }}-v2017.09.04.02 | ||
|
||
- &restore-cache-watchman | ||
keys: | ||
- v1-watchman-v4.9.0 | ||
- v1-watchman-{{ arch }}-v4.9.0 | ||
- &save-cache-watchman | ||
paths: | ||
- ~/watchman | ||
key: v1-watchman-v4.9.0 | ||
key: v1-watchman-{{ arch }}-v4.9.0 | ||
|
||
- &install-node-dependencies | ||
| | ||
npm install --no-package-lock --no-spin --no-progress | ||
|
||
- &run-node-tests | ||
| | ||
npm test -- --maxWorkers=2 | ||
npm run lint | ||
npm run flow -- check | ||
|
||
defaults: &defaults | ||
working_directory: ~/react-native | ||
|
||
version: 2 | ||
jobs: | ||
test-node-8: | ||
|
||
# Runs unit tests on Node 8 | ||
test-js-node-8: | ||
<<: *defaults | ||
docker: | ||
- image: circleci/node:8 | ||
steps: | ||
- checkout | ||
- run: npm install --no-package-lock | ||
- run: | | ||
npm test -- --maxWorkers=2 | ||
npm run lint | ||
npm run flow -- check | ||
# eslint - doesn't run on non-PR builds | ||
- run: | ||
name: Analyze Code | ||
command: | | ||
if [ -n "$CIRCLE_PR_NUMBER" ]; then | ||
npm install [email protected] | ||
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 | ||
- restore-cache: *restore-node-cache | ||
- run: *install-node-dependencies | ||
- save-cache: *save-node-cache | ||
- run: *run-node-tests | ||
|
||
test-node-6: | ||
# Runs unit tests on Node 6 | ||
test-js-node-6: | ||
<<: *defaults | ||
docker: | ||
- image: circleci/node:6.11.0 | ||
steps: | ||
- checkout | ||
- run: npm install | ||
- run: | | ||
npm test -- --maxWorkers=2 | ||
npm run lint | ||
npm run flow -- check | ||
- restore-cache: *restore-node-cache | ||
- run: *install-node-dependencies | ||
- save-cache: *save-node-cache | ||
- run: *run-node-tests | ||
|
||
test-node-4: | ||
# Runs unit tests on Node 4 | ||
test-js-node-4: | ||
<<: *defaults | ||
docker: | ||
- image: circleci/node:4.8.4 | ||
steps: | ||
- checkout | ||
- run: npm install | ||
- run: | | ||
npm test -- --maxWorkers=2 | ||
npm run lint | ||
npm run flow -- check | ||
- restore-cache: *restore-node-cache | ||
- run: *install-node-dependencies | ||
- save-cache: *save-node-cache | ||
- run: *run-node-tests | ||
|
||
# Runs unit tests on iOS devices | ||
test-objc-ios: | ||
<<: *defaults | ||
macos: | ||
xcode: "9.0" | ||
dependencies: | ||
pre: | ||
- xcrun instruments -w "iPhone 5s (10.3.1)" || true | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-node-cache | ||
- run: *install-node-dependencies | ||
- save-cache: *save-node-cache | ||
- run: ./scripts/objc-test-ios.sh | ||
|
||
# Runs unit tests on tvOS devices | ||
test-objc-tvos: | ||
<<: *defaults | ||
macos: | ||
xcode: "9.0" | ||
dependencies: | ||
pre: | ||
- xcrun instruments -w "Apple TV 1080p (10.0)" || true | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-node-cache | ||
- run: *install-node-dependencies | ||
- save-cache: *save-node-cache | ||
- run: ./scripts/objc-test-tvos.sh | ||
|
||
# Runs end to end tests | ||
test-objc-e2e: | ||
<<: *defaults | ||
macos: | ||
xcode: "9.0" | ||
dependencies: | ||
pre: | ||
- xcrun instruments -w "iPhone 5s (10.3.1)" || true | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-node-cache | ||
- run: *install-node-dependencies | ||
- save-cache: *save-node-cache | ||
- run: node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3; | ||
|
||
# Checks podspec | ||
test-podspec: | ||
<<: *defaults | ||
macos: | ||
xcode: "9.0" | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-node-cache | ||
- run: *install-node-dependencies | ||
- save-cache: *save-node-cache | ||
- run: ./scripts/process-podspecs.sh | ||
|
||
test-website: | ||
<<: *defaults | ||
|
@@ -181,7 +243,9 @@ jobs: | |
- image: circleci/node:8 | ||
steps: | ||
- checkout | ||
- run: npm install --no-package-lock | ||
- restore-cache: *restore-node-cache | ||
- run: *install-node-dependencies | ||
- save-cache: *save-node-cache | ||
- run: | ||
name: Build JavaScript Bundle | ||
command: node local-cli/cli.js bundle --max-workers 2 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js | ||
|
@@ -258,7 +322,10 @@ jobs: | |
command: | | ||
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - | ||
sudo apt-get install -y nodejs | ||
- run: npm install | ||
- restore-cache: *restore-node-cache | ||
- run: *install-node-dependencies | ||
- save-cache: *save-node-cache | ||
# TODO: Install and use watchman to speed up builds | ||
# - restore-cache: *restore-cache-watchman | ||
# - run: | ||
# name: Install Watchman Dependencies | ||
|
@@ -322,11 +389,11 @@ jobs: | |
- run: | ||
name: Build and Install Test APK | ||
command: source scripts/circle-ci-android-setup.sh && NO_BUCKD=1 retry3 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=$BUILD_THREADS | ||
# Failing test is expected | ||
# TODO: Uncomment, test was already failing on Circle 1.0 | ||
# - run: | ||
# name: Run Installed APK with Tests | ||
# command: node ./scripts/run-android-ci-instrumentation-tests.js --retries 3 --path ./ReactAndroid/src/androidTest/java/com/facebook/react/tests --package com.facebook.react.tests | ||
# Should be disabled pending on https://our.intern.facebook.com/intern/tasks?t=16912142 | ||
# TODO: Should be disabled, pending on https://our.intern.facebook.com/intern/tasks?t=16912142 | ||
# - run: | ||
# name: Run Android End to End Tests | ||
# command: source scripts/circle-ci-android-setup.sh && retry3 node ./scripts/run-ci-e2e-tests.js --android --js --retries 2 | ||
|
@@ -338,7 +405,7 @@ jobs: | |
mkdir -p ~/junit/ | ||
find . -type f -regex ".*/build/test-results/debug/.*xml" -exec cp {} ~/junit/ \; | ||
find . -type f -regex ".*/outputs/androidTest-results/connected/.*xml" -exec cp {} ~/junit/ \; | ||
# TODO circle does not understand Buck's report, maybe need to transform xml slightly | ||
# TODO: Circle does not understand Buck's report, maybe need to transform xml slightly | ||
# find . -type f -regex ".*/buck-out/gen/ReactAndroid/src/test/.*/.*xml" -exec cp {} ~/junit/ \; | ||
when: always | ||
- store_test_results: | ||
|
@@ -349,12 +416,14 @@ jobs: | |
# Workflows enables us to run multiple jobs in parallel | ||
workflows: | ||
version: 2 | ||
|
||
test_node: | ||
jobs: | ||
- test-node-8 | ||
- test-node-6 | ||
# Node 4 tests are already failing on Circle 1.0 | ||
# - test-node-4 | ||
- test-js-node-8 | ||
- test-js-node-6 | ||
# TODO: Node 4 tests are already failing on Circle 1.0 | ||
# - test-js-node-4 | ||
|
||
website: | ||
jobs: | ||
- test-website | ||
|
@@ -366,6 +435,7 @@ workflows: | |
only: | ||
- /.*-stable/ | ||
- master | ||
|
||
test_android: | ||
jobs: | ||
- build-js-bundle: | ||
|
@@ -375,3 +445,11 @@ workflows: | |
- test-android: | ||
requires: | ||
- build-js-bundle | ||
|
||
test_ios: | ||
jobs: | ||
- test-objc-ios | ||
- test-objc-tvos | ||
# TODO: Podspec tests are already failing on Travis | ||
# - test-podspec | ||
- test-objc-e2e |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters