Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Travis over to Circle #16354

Closed
wants to merge 15 commits into from
86 changes: 71 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ aliases:
- v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}
# Fallback in case checksum fails
- v1-dependencies-{{ .Branch }}-

- &save-cache
paths:
- node_modules
Expand All @@ -14,6 +15,7 @@ aliases:
- v1-website-dependencies-{{ .Branch }}-{{ checksum "website/package.json" }}
# Fallback in case checksum fails
- v1-website-dependencies-{{ .Branch }}-

- &save-cache-website
paths:
- website/node_modules
Expand All @@ -24,6 +26,7 @@ aliases:
- v1-danger-dependencies-{{ .Branch }}-{{ checksum "danger/package.json" }}
# Fallback in case checksum fails
- v1-danger-dependencies-{{ .Branch }}-

- &save-cache-danger
paths:
- danger/node_modules
Expand All @@ -48,6 +51,7 @@ aliases:
- &restore-cache-ndk
keys:
- v1-android-ndk-r10e-32-64

- &save-cache-ndk
paths:
- /opt/ndk
Expand Down Expand Up @@ -79,6 +83,13 @@ aliases:
- ~/watchman
key: v1-watchman-v4.9.0

- &install_node_dependencies
|
npm config set spin=false
npm config set progress=false
npm install --no-package-lock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can consolidate this into a single command:

npm install --no-package-lock --no-spin --no-progress

(Using the separate npm config commands is good when changing the preferences globally, but we're mostly running npm install on separate images where the preference won't persist)



defaults: &defaults
working_directory: ~/react-native

Expand All @@ -90,29 +101,19 @@ jobs:
- image: circleci/node:8
steps:
- checkout
- run: npm install --no-package-lock
- run: *install_node_dependencies
- 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is re-added in @hramos PR as a separate job.

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

test-node-6:
<<: *defaults
docker:
- image: circleci/node:6.11.0
steps:
- checkout
- run: npm install
- run: *install_node_dependencies
- run: |
npm test -- --maxWorkers=2
npm run lint
Expand All @@ -124,11 +125,56 @@ jobs:
- image: circleci/node:4.8.4
steps:
- checkout
- run: npm install
- run: *install_node_dependencies
- run: |
npm test -- --maxWorkers=2
npm run lint
npm run flow -- check

# Runs unit tests on iOS devices
test-objc-ios:
<<: *defaults
macos:
xcode: "9.0"
steps:
- checkout
- run: *install_node_dependencies
- run: ./scripts/objc-test-ios.sh

# Runs unit tests on tvOS devices
test-objc-tvos:
<<: *defaults
macos:
xcode: "9.0"
steps:
- checkout
- run: *install_node_dependencies
- run: ./scripts/objc-test-tvos.sh

# Runs end to end tests
test-objc-e2e:
<<: *defaults
macos:
xcode: "9.0"
steps:
- checkout
- run: *install_node_dependencies
- run: node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3;

# Checks podspec
test-podspec:
<<: *defaults
macos:
xcode: "9.0"
steps:
- checkout
- run: *install_node_dependencies
- run: |
if [ "$CI_PULL_REQUEST" ]; then
./scripts/process-podspecs.sh
else
echo "Skipping testing podspec."
fi

test-website:
<<: *defaults
Expand Down Expand Up @@ -181,7 +227,7 @@ jobs:
- image: circleci/node:8
steps:
- checkout
- run: npm install --no-package-lock
- run: *install_node_dependencies
- 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
Expand Down Expand Up @@ -258,7 +304,7 @@ jobs:
command: |
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
- run: npm install
- run: *install_node_dependencies
# - restore-cache: *restore-cache-watchman
# - run:
# name: Install Watchman Dependencies
Expand Down Expand Up @@ -349,12 +395,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

website:
jobs:
- test-website
Expand All @@ -366,6 +414,7 @@ workflows:
only:
- /.*-stable/
- master

test_android:
jobs:
- build-js-bundle:
Expand All @@ -375,3 +424,10 @@ workflows:
- test-android:
requires:
- build-js-bundle

test_ios:
jobs:
- test-objc-ios
- test-objc-tvos
- test-objc-e2e
- test-podspec
49 changes: 0 additions & 49 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/run-ci-e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down