@@ -109,109 +109,6 @@ jobs:
109109 - store_test_results :
110110 path : ./reports/junit
111111
112- # -------------------------
113- # JOBS: iOS Unit Tests
114- # -------------------------
115- test_ios :
116- executor : reactnativeios
117- parameters :
118- run_unit_tests :
119- description : Specifies whether unit tests should run.
120- type : boolean
121- default : false
122- jsengine :
123- default : " Hermes"
124- description : Which JavaScript engine to use. Must be one of "Hermes", "JSC".
125- type : enum
126- enum : ["Hermes", "JSC"]
127- ruby_version :
128- default : " 2.6.10"
129- description : The version of ruby that must be used
130- type : string
131- environment :
132- - REPORTS_DIR : " ./reports/junit"
133- steps :
134- - checkout_code_with_cache
135- - setup_ruby :
136- ruby_version : << parameters.ruby_version >>
137- - brew_install :
138- package : xcbeautify
139- - run :
140- name : Run Ruby Tests
141- command : |
142- cd packages/react-native/scripts
143- sh run_ruby_tests.sh
144- - run_yarn
145- - *attach_hermes_workspace
146- - run : |
147- cd packages/rn-tester
148- bundle check || bundle install
149- - run :
150- name : Boot iPhone Simulator
151- command : source scripts/.tests.env && xcrun simctl boot "$IOS_DEVICE" || true
152-
153- - run :
154- name : Configure Environment Variables
155- command : |
156- echo 'export PATH=/usr/local/opt/node@18/bin:$PATH' >> $BASH_ENV
157- source $BASH_ENV
158-
159- - run :
160- name : " Brew: Tap wix/brew"
161- command : brew tap wix/brew
162- - brew_install :
163- package : applesimutils watchman
164-
165- - run :
166- name : Configure Watchman
167- command : echo "{}" > .watchmanconfig
168-
169- - run :
170- name : Setup the CocoaPods environment
171- command : |
172- bundle exec pod setup
173-
174- - with_hermes_tarball_cache_span :
175- set_tarball_path : True
176- steps :
177- - with_rntester_pods_cache_span :
178- steps :
179- - run :
180- name : Generate RNTesterPods Workspace
181- command : |
182- if [[ << parameters.jsengine >> == "JSC" ]]; then
183- export USE_HERMES=0
184- fi
185-
186- cd packages/rn-tester
187- bundle install
188- bundle exec pod install --verbose
189-
190- # -------------------------
191- # Runs iOS unit tests
192- - when :
193- condition : << parameters.run_unit_tests >>
194- steps :
195- - run :
196- name : " Run Tests: iOS Unit and Integration Tests"
197- command : node ./scripts/circleci/run_with_retry.js 3 yarn test-ios
198- - run :
199- name : Zip Derived data folder
200- when : always
201- command : |
202- echo "zipping tests results"
203- cd /Users/distiller/Library/Developer/Xcode
204- XCRESULT_PATH=$(find . -name '*.xcresult')
205- tar -zcvf xcresults.tar.gz $XCRESULT_PATH
206- - store_artifacts_if_needed :
207- path : /Users/distiller/Library/Developer/Xcode/xcresults.tar.gz
208- # -------------------------
209- # Collect Results
210- - report_bundle_size :
211- platform : ios
212- - store_test_results :
213- path : ./reports/junit
214-
215112 # -------------------------
216113 # JOBS: iOS E2E Tests
217114 # -------------------------
@@ -627,6 +524,10 @@ jobs:
627524 default : " 2.6.10"
628525 description : The version of ruby that must be used
629526 type : string
527+ run_unit_tests :
528+ description : whether unit tests should run or not.
529+ default : false
530+ type : boolean
630531 steps :
631532 - checkout_code_with_cache
632533 - run_yarn
@@ -641,6 +542,10 @@ jobs:
641542 command : sudo rm -rf /Library/Developer/CoreSimulator/Profiles/Runtimes/
642543 - setup_ruby :
643544 ruby_version : << parameters.ruby_version >>
545+ - when :
546+ condition : << parameters.run_unit_tests >>
547+ steps :
548+ - prepare_ios_tests
644549 - with_hermes_tarball_cache_span :
645550 set_tarball_path : True
646551 steps :
@@ -666,13 +571,24 @@ jobs:
666571
667572 bundle install
668573 bundle exec pod install
669- - run :
670- name : Build RNTester
671- command : |
672- xcodebuild build \
673- -workspace packages/rn-tester/RNTesterPods.xcworkspace \
674- -scheme RNTester \
675- -sdk iphonesimulator
574+ - when :
575+ condition :
576+ # The run_ios_test will also build RNTester so we don't nee to build it
577+ # here if we run tests
578+ equal : [ false, << parameters.run_unit_tests >> ]
579+
580+ steps :
581+ - run :
582+ name : Build RNTester
583+ command : |
584+ xcodebuild build \
585+ -workspace packages/rn-tester/RNTesterPods.xcworkspace \
586+ -scheme RNTester \
587+ -sdk iphonesimulator
588+ - when :
589+ condition : << parameters.run_unit_tests >>
590+ steps :
591+ - run_ios_tests
676592
677593 # -------------------------
678594 # JOBS: Windows
0 commit comments