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

[CI] Enable CocoaPods tests, add parallelism #19764

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 65 additions & 63 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,17 @@ aliases:
# eslint sometimes runs into trouble generating the reports
- &run-lint-checks
name: Lint code
command: scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ~/react-native/reports/junit/eslint/results.xml
when: always
command: |
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ~/react-native/reports/junit/eslint/results.xml
fi

- &run-flow-checks
name: Check for errors in code using Flow
command: yarn flow check
when: always
command: |
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
yarn flow check
fi

- &run-sanity-checks
name: Sanity checks
Expand Down Expand Up @@ -281,31 +285,64 @@ aliases:

- &boot-simulator-iphone
name: Boot iPhone Simulator
command: xcrun simctl boot "iPhone 5s" || true
command: |
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
xcrun simctl boot "iPhone 5s" || true
fi

- &boot-simulator-appletv
name: Boot Apple TV Simulator
command: xcrun simctl boot "Apple TV" || true
command: |
if [ $((1 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
xcrun simctl boot "Apple TV" || true
fi

- &run-objc-ios-tests
name: iOS Test Suite
command: ./scripts/objc-test-ios.sh test
command: |
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
./scripts/objc-test-ios.sh test
fi

- &run-objc-tvos-tests
name: tvOS Test Suite
command: ./scripts/objc-test-tvos.sh test
command: |
if [ $((1 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
./scripts/objc-test-tvos.sh test
fi

- &run-podspec-tests
name: Test CocoaPods
command: |
if [ $((2 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
./scripts/process-podspecs.sh
fi

- &run-e2e-tests
name: End-to-End Test Suite
command: node ./scripts/run-ci-e2e-tests.js --ios --tvos --js --retries 3;
command: node ./scripts/run-ci-e2e-tests.js --android --ios --tvos --js --retries 3;

- &run-objc-ios-e2e-tests
name: iOS End-to-End Test Suite
command: node ./scripts/run-ci-e2e-tests.js --ios --retries 3;
command: |
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
node ./scripts/run-ci-e2e-tests.js --ios --retries 3;
fi

- &run-objc-tvos-e2e-tests
name: tvOS End-to-End Test Suite
command: node ./scripts/run-ci-e2e-tests.js --tvos --js --retries 3;
command: |
if [ $((1 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
node ./scripts/run-ci-e2e-tests.js --tvos --js --retries 3;
fi

- &run-android-e2e-tests
name: Android End-to-End Test Suite
command: node ./scripts/run-ci-e2e-tests.js --android --retries 3;

- &run-js-e2e-tests
name: JavaScript End-to-End Test Suite
command: node ./scripts/run-ci-e2e-tests.js --js --retries 3;

defaults: &defaults
working_directory: ~/react-native
Expand Down Expand Up @@ -339,7 +376,6 @@ macos_defaults: &macos_defaults

version: 2
jobs:

# Set up a Node environment for downstream jobs
checkout_code:
<<: *js_defaults
Expand Down Expand Up @@ -386,42 +422,35 @@ jobs:
- store_test_results:
path: ~/react-native/reports/junit

# Runs unit tests on iOS devices
test_ios:
# Runs unit tests on iOS and Apple TV devices
test_objc:
<<: *macos_defaults
parallelism: 3
steps:
- attach_workspace:
at: ~/react-native

- run: *boot-simulator-iphone
- run: brew install watchman
- run: *run-objc-ios-tests

- store_test_results:
path: ~/react-native/reports/junit

# Runs unit tests on tvOS devices
test_tvos:
<<: *macos_defaults
steps:
- attach_workspace:
at: ~/react-native

- run: *boot-simulator-appletv
- run: brew install watchman

- run: *run-objc-ios-tests
- run: *run-objc-tvos-tests
- run: *run-podspec-tests

- store_test_results:
path: ~/react-native/reports/junit

# Runs end to end tests
test_end_to_end:
<<: *macos_defaults
parallelism: 2
steps:
- attach_workspace:
at: ~/react-native

- run: *boot-simulator-iphone
- run: *boot-simulator-appletv

- run:
name: Configure Environment Variables
Expand All @@ -437,19 +466,12 @@ jobs:
node -v

- run: *run-objc-ios-e2e-tests
# Disabled for now
# - run: *run-objc-tvos-e2e-tests

- store_test_results:
path: ~/react-native/reports/junit

# Checks podspec
test_podspec:
<<: *macos_defaults
steps:
- attach_workspace:
at: ~/react-native

- run: ./scripts/process-podspecs.sh

# Publishes new version onto npm
publish_npm_package:
<<: *android_defaults
Expand Down Expand Up @@ -571,6 +593,10 @@ jobs:
command: |
./gradlew RNTester:android:app:assembleRelease -Pjobs=$BUILD_THREADS

# Run Android end-to-end tests
# Disabled
# - run: *run-android-e2e-tests

# Collect Results
- run: *collect-android-test-results
- store_test_results:
Expand Down Expand Up @@ -626,7 +652,6 @@ workflows:

tests:
jobs:

# Checkout repo and run Yarn
- checkout_code:
filters: *filter-ignore-gh-pages
Expand All @@ -650,11 +675,7 @@ workflows:
- checkout_code

# Test iOS & tvOS
- test_ios:
filters: *filter-ignore-gh-pages
requires:
- checkout_code
- test_tvos:
- test_objc:
filters: *filter-ignore-gh-pages
requires:
- checkout_code
Expand All @@ -674,8 +695,8 @@ workflows:
only: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/
requires:
- test_javascript
- test_ios
- test_tvos
- test_objc
- test_android
- test_end_to_end
- analyze

Expand All @@ -691,22 +712,3 @@ workflows:
filters: *filter-ignore-master-stable
requires:
- checkout_code


# These tests are flaky or are yet to be fixed. They are placed on their own
# workflow to avoid marking benign PRs as broken.
# To run them, uncomment the entire block and open a PR (do not merge).
# Once a test is fixed, move the test definition to the 'tests' workflow.
# disabled_tests:
# jobs:
# # Checkout repo and run Yarn (pre-req, should succeed)
# - checkout_code:
# filters: *filter-ignore-gh-pages

# # The following were DISABLED because they have not run since
# # the migration from Travis, and they have broken since then,
# # CocoaPods
# - test_podspec:
# filters: *filter-ignore-gh-pages
# requires:
# - checkout_code