Skip to content
Closed
Show file tree
Hide file tree
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
40 changes: 39 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ aliases:
mkdir -p ~/react-native/reports/build/
mkdir -p ~/react-native/reports/junit/
mkdir -p ~/react-native/reports/outputs/

- &run-objc-ios-tests
name: iOS Test Suite
command: ./scripts/objc-test-ios.sh test
Expand All @@ -288,6 +288,18 @@ aliases:
name: tvOS End-to-End Test Suite
command: node ./scripts/run-ci-e2e-tests.js --tvos --js --retries 3;

- &build-objc-ios-cocoapods-install
name: Test Cocoapods
command: ./scripts/objc-test-ios-cocoapods-install.sh

- &build-objc-ios-cocoapods-test-app
name: Build Objective-C iOS Test App
command: ./scripts/objc-test-ios-cocoapods.sh

- &run-objc-ios-cocoapods-tests
name: Objective-C iOS Test Suite
command: ./scripts/objc-test-ios-cocoapods.sh test

defaults: &defaults
working_directory: ~/react-native

Expand Down Expand Up @@ -397,6 +409,25 @@ jobs:
- store_test_results:
path: ~/react-native/reports/junit

# Runs unit tests on iOS devices - cocoapods flavour
test_ios_cocoapods:
<<: *macos_defaults
dependencies:
pre:
- xcrun instruments -w "iPhone 5s (11.1)" || true
steps:
- attach_workspace:
at: ~/react-native

- run: *build-objc-ios-cocoapods-install
- run: *build-objc-ios-cocoapods-test-app
- run: *run-objc-ios-cocoapods-tests

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

# Runs unit tests on tvOS devices
test_tvos:
<<: *macos_defaults
Expand Down Expand Up @@ -635,6 +666,7 @@ workflows:
filters: *filter-ignore-gh-pages
requires:
- checkout_code

- test_tvos:
filters: *filter-ignore-gh-pages
requires:
Expand All @@ -646,6 +678,12 @@ workflows:
requires:
- checkout_code

# End-to-end tests
- test_ios_cocoapods:
filters: *filter-ignore-gh-pages
requires:
- checkout_code

# Only runs on PRs
analyze:
jobs:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ package-lock.json

/coverage
/third-party
/RNTester/Pods
51 changes: 51 additions & 0 deletions RNTester/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
source 'https://github.com/CocoaPods/Specs.git'

use_frameworks!
inhibit_all_warnings!

platform :ios, '9.0'

project 'RNTester.xcodeproj'

def shared_pods
pod 'yoga', :path => '../ReactCommon/yoga'

# Third party deps podspec link
pod 'DoubleConversion', :podspec => '../third-party-podspecs/DoubleConversion.podspec'
pod 'Folly', :podspec => '../third-party-podspecs/Folly.podspec'
pod 'glog', :podspec => '../third-party-podspecs/glog.podspec'

pod 'React', :path => '../', :subspecs => [
'Core',
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
'RCTImage',
'RCTLinkingIOS',
'RCTActionSheet',
'RCTAnimation',
'CxxBridge',
'RCTPushNotification'
]
end

target 'RNTester' do
shared_pods
end

target 'RNTesterUnitTests' do
shared_pods
end

target 'RNTester-tvOS' do
shared_pods
end

target 'RNTester-tvOSUnitTests' do
shared_pods
end

target 'RNTester-tvOSIntegrationTests' do
shared_pods
end
20 changes: 20 additions & 0 deletions scripts/objc-test-ios-cocoapods-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -ex

# Script used to run iOS tests.
# If not arguments are passed to the script, it will only compile
# the RNTester.
# If the script is called with a single argument "test", we'll
# also run the RNTester integration test (needs JS and packager):
# ./objc-test-ios.sh test

SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$(dirname "$SCRIPTS")

cd "$ROOT/RNTester"

SCHEME="RNTester"
SDK="iphonesimulator"
DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=10.3.1"

pod install
21 changes: 21 additions & 0 deletions scripts/objc-test-ios-cocoapods.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -ex

# Script used to run iOS tests.
# If not arguments are passed to the script, it will only compile
# the RNTester.
# If the script is called with a single argument "test", we'll
# also run the RNTester integration test (needs JS and packager):
# ./objc-test-ios.sh test

SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$(dirname "$SCRIPTS")

cd "$ROOT"

SCHEME="RNTester"
SDK="iphonesimulator"
DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=10.3.1"

# If there's a "test" argument, pass it to the test script.
. ./scripts/objc-test.sh $1 workspace
10 changes: 8 additions & 2 deletions scripts/objc-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ set -ex
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$(dirname $SCRIPTS)

XCODE_PROJECT_PATH="RNTester/RNTester.xcodeproj"

if [ "$2" = "workspace" ]; then
XCODE_PROJECT_PATH="RNTester/RNTester.xcodeproj"
fi

cd $ROOT

# Create cleanup handler
Expand Down Expand Up @@ -74,7 +80,7 @@ rm temp.bundle

# Run tests
xcodebuild \
-project "RNTester/RNTester.xcodeproj" \
-project $XCODE_PROJECT_PATH \
-scheme $SCHEME \
-sdk $SDK \
-destination "$DESTINATION" \
Expand All @@ -85,7 +91,7 @@ else

# Don't run tests. No need to pass -destination to xcodebuild.
xcodebuild \
-project "RNTester/RNTester.xcodeproj" \
-project $XCODE_PROJECT_PATH \
-scheme $SCHEME \
-sdk $SDK \
build
Expand Down