Migrate Travis over to Circle
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 https://github.com/facebook/react-native/pull/16354 Differential Revision: D6054858 Pulled By: hramos fbshipit-source-id: 5165bef0985f4257febced14873be5bcb80b9f51
This commit is contained in:
parent
f3b117abd0
commit
c0e6d415ce
|
@ -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 github@0.2.4
|
||||
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
|
||||
|
|
49
.travis.yml
49
.travis.yml
|
@ -1,49 +0,0 @@
|
|||
language: objective-c
|
||||
|
||||
osx_image: xcode8.3
|
||||
|
||||
install:
|
||||
- nvm install 8
|
||||
- rm -Rf "${TMPDIR}/jest_preprocess_cache"
|
||||
- brew install yarn --ignore-dependencies
|
||||
- brew install watchman
|
||||
- yarn install
|
||||
|
||||
script:
|
||||
- if [[ "$TEST_TYPE" = objc-ios ]]; then travis_retry travis_wait 30 ./scripts/objc-test-ios.sh test; fi
|
||||
- if [[ "$TEST_TYPE" = objc-tvos ]]; then travis_retry travis_wait 30 ./scripts/objc-test-tvos.sh; fi
|
||||
- if [[ "$TEST_TYPE" = e2e-objc ]]; then node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3; fi
|
||||
- if [[ ( "$TEST_TYPE" = podspecs ) && ( "$TRAVIS_PULL_REQUEST" = "false" ) ]]; then gem install cocoapods && travis_wait 30 ./scripts/process-podspecs.sh; fi
|
||||
|
||||
cache:
|
||||
- cocoapods
|
||||
- yarn
|
||||
|
||||
matrix:
|
||||
- fast_finish: true # Fail the whole build as soon as one test type fails. Should help with Travis capacity issues (very long queues).
|
||||
|
||||
# The order of these tests says which are more likely to run first and fail the whole build fast.
|
||||
env:
|
||||
- TEST_TYPE=objc-ios
|
||||
- TEST_TYPE=podspecs
|
||||
- TEST_TYPE=e2e-objc
|
||||
- TEST_TYPE=objc-tvos
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /^.*-stable$/
|
||||
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
- douglowder@mac.com # Doug Lowder built and maintains Apple TV specific code and wants to be notified about tvOS failures.
|
||||
- eloy@artsy.net # Eloy Durán maintains the podspecs test and wants to be notified about failures.
|
||||
on_failure: change
|
||||
on_success: change
|
||||
slack:
|
||||
secure: oQL2C966v7/DtxNqfM7WowjY0R5mgLHR2qHkoucwK5iVrmaptnHr8fq01xlj7VT0kDwNLqT3n4+gtCviGw89lq71m3W76c8Pms/10jpjw+LwAfQPVizNw/Bx8MFNNmjDauK/auFxaybiLZupi7zd4xFGOZvScmFdfD4CAAp2OOA=
|
||||
on_pull_requests: false
|
||||
on_failure: change
|
||||
on_success: change
|
||||
webhooks: https://code.facebook.com/travis/webhook/
|
|
@ -175,7 +175,7 @@ try {
|
|||
if (argv.tvos) {
|
||||
return exec('xcodebuild -destination "platform=tvOS Simulator,name=Apple TV 1080p,OS=10.0" -scheme EndToEndTest-tvOS -sdk appletvsimulator test | xcpretty && exit ${PIPESTATUS[0]}').code;
|
||||
} else {
|
||||
return exec('xcodebuild -destination "platform=iOS Simulator,name=iPhone 5s,OS=10.0" -scheme EndToEndTest -sdk iphonesimulator test | xcpretty && exit ${PIPESTATUS[0]}').code;
|
||||
return exec('xcodebuild -destination "platform=iOS Simulator,name=iPhone 5s,OS=10.3.1" -scheme EndToEndTest -sdk iphonesimulator test | xcpretty && exit ${PIPESTATUS[0]}').code;
|
||||
}
|
||||
},
|
||||
numberOfRetries)) {
|
||||
|
|
Loading…
Reference in New Issue