build.sh 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. #!/usr/bin/env bash
  2. # Copyright 2018 Google
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # USAGE: build.sh product [platform] [method]
  16. #
  17. # Builds the given product for the given platform using the given build method
  18. function pod_gen() {
  19. # Call pod gen with a podspec and additional optional arguments.
  20. bundle exec pod gen --local-sources=./ --sources=https://github.com/firebase/SpecsDev.git,https://github.com/firebase/SpecsStaging.git,https://cdn.cocoapods.org/ "$@"
  21. }
  22. set -euo pipefail
  23. if [[ $# -lt 1 ]]; then
  24. cat 1>&2 <<EOF
  25. USAGE: $0 product [platform] [method]
  26. product can be one of:
  27. Firebase
  28. Firestore
  29. CombineSwift
  30. InAppMessaging
  31. Messaging
  32. MessagingSample
  33. SwiftUISample
  34. MLModelDownloaderSample
  35. RemoteConfig
  36. RemoteConfigSample
  37. Sessions
  38. Storage
  39. SymbolCollision
  40. GoogleDataTransport
  41. Performance
  42. ClientApp
  43. platform can be one of:
  44. iOS (default)
  45. iOS-device
  46. macOS
  47. tvOS
  48. watchOS
  49. catalyst
  50. visionOS
  51. method can be one of:
  52. xcodebuild (default)
  53. cmake
  54. unit
  55. integration
  56. spm
  57. Optionally, reads the environment variable SANITIZERS. If set, it is expected to
  58. be a string containing a space-separated list with some of the following
  59. elements:
  60. asan
  61. tsan
  62. ubsan
  63. EOF
  64. exit 1
  65. fi
  66. product="$1"
  67. platform="iOS"
  68. if [[ $# -gt 1 ]]; then
  69. platform="$2"
  70. fi
  71. method="xcodebuild"
  72. if [[ $# -gt 2 ]]; then
  73. method="$3"
  74. fi
  75. echo "Building $product for $platform using $method"
  76. if [[ -n "${SANITIZERS:-}" ]]; then
  77. echo "Using sanitizers: $SANITIZERS"
  78. fi
  79. scripts_dir=$(dirname "${BASH_SOURCE[0]}")
  80. firestore_emulator="${scripts_dir}/run_firestore_emulator.sh"
  81. database_emulator="${scripts_dir}/run_database_emulator.sh"
  82. system=$(uname -s)
  83. case "$system" in
  84. Darwin)
  85. xcode_version=$(xcodebuild -version | grep Xcode)
  86. xcode_version="${xcode_version/Xcode /}"
  87. xcode_major="${xcode_version/.*/}"
  88. ;;
  89. *)
  90. xcode_major="0"
  91. ;;
  92. esac
  93. # Source function to check if CI secrets are available.
  94. source scripts/check_secrets.sh
  95. # Runs xcodebuild with the given flags, piping output to xcbeautify
  96. # If xcodebuild fails with known error codes, retries once.
  97. function RunXcodebuild() {
  98. echo xcodebuild "$@"
  99. local xcodebuild_args=("$@")
  100. local buildaction="${xcodebuild_args[$# - 1]}" # buildaction is the last arg
  101. local log_filename="xcodebuild-${buildaction}.log"
  102. local xcbeautify_cmd=(xcbeautify --renderer github-actions --disable-logging)
  103. local result=0
  104. NSUnbufferedIO=YES xcodebuild "$@" 2>&1 | tee "$log_filename" | \
  105. "${xcbeautify_cmd[@]}" && CheckUnexpectedFailures "$log_filename" \
  106. || result=$?
  107. if [[ $result == 65 ]]; then
  108. ExportLogs "$@"
  109. echo "xcodebuild exited with 65, retrying" 1>&2
  110. sleep 5
  111. result=0
  112. NSUnbufferedIO=YES xcodebuild "$@" 2>&1 | tee "$log_filename" | \
  113. "${xcbeautify_cmd[@]}" && CheckUnexpectedFailures "$log_filename" \
  114. || result=$?
  115. fi
  116. if [[ $result != 0 ]]; then
  117. echo "xcodebuild exited with $result" 1>&2
  118. ExportLogs "$@"
  119. return $result
  120. fi
  121. }
  122. # Exports any logs output captured in the xcresult
  123. function ExportLogs() {
  124. python "${scripts_dir}/xcresult_logs.py" "$@"
  125. }
  126. function CheckUnexpectedFailures() {
  127. local log_file=$1
  128. if grep -Eq "[1-9]\d* failures \([1-9]\d* unexpected\)" "$log_file"; then
  129. echo "xcodebuild failed with unexpected failures." 1>&2
  130. return 65
  131. fi
  132. }
  133. if [[ "$xcode_major" -lt 16 && "$method" != "cmake" ]]; then
  134. echo "Unsupported Xcode major version being used: $xcode_major"
  135. exit 1
  136. else
  137. ios_flags=(
  138. -sdk 'iphonesimulator'
  139. -destination 'platform=iOS Simulator,name=iPhone 16'
  140. )
  141. watchos_flags=(
  142. -sdk 'watchsimulator'
  143. -destination 'platform=watchOS Simulator,name=Apple Watch Series 10 (42mm)'
  144. )
  145. fi
  146. ios_device_flags=(
  147. -sdk 'iphoneos'
  148. -destination 'generic/platform=iOS'
  149. )
  150. ipad_flags=(
  151. -sdk 'iphonesimulator'
  152. -destination 'platform=iOS Simulator,name=iPad Pro (9.7-inch)'
  153. )
  154. macos_flags=(
  155. -sdk 'macosx'
  156. -destination 'platform=OS X,arch=x86_64'
  157. )
  158. tvos_flags=(
  159. -sdk "appletvsimulator"
  160. -destination 'platform=tvOS Simulator,name=Apple TV'
  161. )
  162. visionos_flags=(
  163. -sdk 'xrsimulator'
  164. -destination 'platform=visionOS Simulator,name=Apple Vision Pro'
  165. )
  166. catalyst_flags=(
  167. ARCHS=x86_64 VALID_ARCHS=x86_64 SUPPORTS_MACCATALYST=YES -sdk macosx
  168. -destination platform="macOS,variant=Mac Catalyst,arch=x86_64" TARGETED_DEVICE_FAMILY=2
  169. CODE_SIGN_IDENTITY=- CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
  170. )
  171. # Compute standard flags for all platforms
  172. case "$platform" in
  173. iOS)
  174. xcb_flags=("${ios_flags[@]}")
  175. gen_platform=ios
  176. ;;
  177. iOS-device)
  178. xcb_flags=("${ios_device_flags[@]}")
  179. gen_platform=ios
  180. ;;
  181. iPad)
  182. xcb_flags=("${ipad_flags[@]}")
  183. ;;
  184. macOS)
  185. xcb_flags=("${macos_flags[@]}")
  186. gen_platform=macos
  187. ;;
  188. tvOS)
  189. xcb_flags=("${tvos_flags[@]}")
  190. gen_platform=tvos
  191. ;;
  192. watchOS)
  193. xcb_flags=("${watchos_flags[@]}")
  194. ;;
  195. visionOS)
  196. xcb_flags=("${visionos_flags[@]}")
  197. ;;
  198. catalyst)
  199. xcb_flags=("${catalyst_flags[@]}")
  200. ;;
  201. all)
  202. xcb_flags=()
  203. ;;
  204. Linux)
  205. xcb_flags=()
  206. ;;
  207. *)
  208. echo "Unknown platform '$platform'" 1>&2
  209. exit 1
  210. ;;
  211. esac
  212. xcb_flags+=(
  213. ONLY_ACTIVE_ARCH=YES
  214. CODE_SIGNING_REQUIRED=NO
  215. CODE_SIGNING_ALLOWED=YES
  216. COMPILER_INDEX_STORE_ENABLE=NO
  217. )
  218. source scripts/buildcache.sh
  219. xcb_flags=("${xcb_flags[@]}" "${buildcache_xcb_flags[@]}")
  220. # TODO(varconst): Add --warn-unused-vars and --warn-uninitialized.
  221. # Right now, it makes the log overflow on Travis because many of our
  222. # dependencies don't build cleanly this way.
  223. cmake_options=(
  224. -Wdeprecated
  225. -DCMAKE_BUILD_TYPE=Debug
  226. )
  227. if [[ -n "${SANITIZERS:-}" ]]; then
  228. for sanitizer in $SANITIZERS; do
  229. case "$sanitizer" in
  230. asan)
  231. xcb_flags+=(
  232. -enableAddressSanitizer YES
  233. )
  234. cmake_options+=(
  235. -DWITH_ASAN=ON
  236. )
  237. ;;
  238. tsan)
  239. xcb_flags+=(
  240. -enableThreadSanitizer YES
  241. )
  242. cmake_options+=(
  243. -DWITH_TSAN=ON
  244. )
  245. ;;
  246. ubsan)
  247. xcb_flags+=(
  248. -enableUndefinedBehaviorSanitizer YES
  249. )
  250. cmake_options+=(
  251. -DWITH_UBSAN=ON
  252. )
  253. ;;
  254. *)
  255. echo "Unknown sanitizer '$sanitizer'" 1>&2
  256. exit 1
  257. ;;
  258. esac
  259. done
  260. fi
  261. case "$product-$platform-$method" in
  262. FirebasePod-iOS-*)
  263. RunXcodebuild \
  264. -workspace 'CoreOnly/Tests/FirebasePodTest/FirebasePodTest.xcworkspace' \
  265. -scheme "FirebasePodTest" \
  266. "${xcb_flags[@]}" \
  267. build
  268. ;;
  269. Auth-*-*)
  270. if check_secrets; then
  271. RunXcodebuild \
  272. -project 'FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj' \
  273. -scheme "$method" \
  274. "${xcb_flags[@]}" \
  275. test
  276. fi
  277. ;;
  278. CombineSwift-*-xcodebuild)
  279. pod_gen FirebaseCombineSwift.podspec --platforms=ios
  280. RunXcodebuild \
  281. -workspace 'gen/FirebaseCombineSwift/FirebaseCombineSwift.xcworkspace' \
  282. -scheme "FirebaseCombineSwift-Unit-unit" \
  283. "${xcb_flags[@]}" \
  284. build
  285. ;;
  286. # TODO(#14760): s/build/test after addressing UI test flakes on CI.
  287. InAppMessaging-*-xcodebuild)
  288. RunXcodebuild \
  289. -workspace 'FirebaseInAppMessaging/Tests/Integration/DefaultUITestApp/InAppMessagingDisplay-Sample.xcworkspace' \
  290. -scheme 'FiamDisplaySwiftExample' \
  291. "${xcb_flags[@]}" \
  292. build
  293. ;;
  294. Firestore-*-xcodebuild)
  295. "${firestore_emulator}" start
  296. trap '"${firestore_emulator}" stop' ERR EXIT
  297. RunXcodebuild \
  298. -workspace 'Firestore/Example/Firestore.xcworkspace' \
  299. -scheme "Firestore_IntegrationTests_$platform" \
  300. -enableCodeCoverage YES \
  301. "${xcb_flags[@]}" \
  302. test
  303. ;;
  304. Firestore-macOS-cmake | Firestore-Linux-cmake)
  305. "${firestore_emulator}" start
  306. trap '"${firestore_emulator}" stop' ERR EXIT
  307. (
  308. test -d build || mkdir build
  309. cd build
  310. echo "Preparing cmake build ..."
  311. cmake -G Ninja "${cmake_options[@]}" ..
  312. echo "Building cmake build ..."
  313. ninja -k 10 all
  314. ctest --verbose
  315. )
  316. ;;
  317. SymbolCollision-*-*)
  318. RunXcodebuild \
  319. -workspace 'SymbolCollisionTest/SymbolCollisionTest.xcworkspace' \
  320. -scheme "SymbolCollisionTest" \
  321. "${xcb_flags[@]}" \
  322. build
  323. ;;
  324. # TODO(#12205) Restore this test to "test" instead of "build"
  325. Messaging-*-xcodebuild)
  326. pod_gen FirebaseMessaging.podspec --platforms=ios
  327. # Add GoogleService-Info.plist to generated Test Wrapper App.
  328. ruby ./scripts/update_xcode_target.rb gen/FirebaseMessaging/Pods/Pods.xcodeproj \
  329. AppHost-FirebaseMessaging-Unit-Tests \
  330. ../../../FirebaseMessaging/Tests/IntegrationTests/Resources/GoogleService-Info.plist
  331. if check_secrets; then
  332. # Integration tests are only run on iOS to minimize flake failures.
  333. RunXcodebuild \
  334. -workspace 'gen/FirebaseMessaging/FirebaseMessaging.xcworkspace' \
  335. -scheme "FirebaseMessaging-Unit-integration" \
  336. "${ios_flags[@]}" \
  337. "${xcb_flags[@]}" \
  338. build
  339. fi
  340. ;;
  341. MessagingSample-*-*)
  342. if check_secrets; then
  343. RunXcodebuild \
  344. -workspace 'FirebaseMessaging/Apps/Sample/Sample.xcworkspace' \
  345. -scheme "Sample" \
  346. "${xcb_flags[@]}" \
  347. build
  348. fi
  349. ;;
  350. SwiftUISample-*-*)
  351. if check_secrets; then
  352. RunXcodebuild \
  353. -workspace 'FirebaseMessaging/Apps/SwiftUISample/SwiftUISample.xcworkspace' \
  354. -scheme "SwiftUISample" \
  355. "${xcb_flags[@]}" \
  356. build
  357. fi
  358. ;;
  359. # TODO: This is actually building for iOS instead of watchOS. Update to use
  360. # watchOS xcb_flags along with the watchOS sdk option. Also nanopb and promises
  361. # podspecs need minimum version updates.
  362. MessagingSampleStandaloneWatchApp-*-*)
  363. if check_secrets; then
  364. RunXcodebuild \
  365. -workspace 'FirebaseMessaging/Apps/SampleStandaloneWatchApp/SampleStandaloneWatchApp.xcworkspace' \
  366. -scheme "SampleStandaloneWatchApp Watch App" \
  367. -destination 'platform=watchOS Simulator,name=Apple Watch Series 10 (42mm)' \
  368. build
  369. fi
  370. ;;
  371. MLModelDownloaderSample-*-*)
  372. if check_secrets; then
  373. RunXcodebuild \
  374. -workspace 'FirebaseMLModelDownloader/Apps/Sample/MLDownloaderTestApp.xcworkspace' \
  375. -scheme "MLDownloaderTestApp" \
  376. "${xcb_flags[@]}" \
  377. build
  378. fi
  379. ;;
  380. WatchOSSample-*-*)
  381. RunXcodebuild \
  382. -workspace 'Example/watchOSSample/SampleWatchApp.xcworkspace' \
  383. -scheme "SampleWatchAppWatchKitApp" \
  384. "${xcb_flags[@]}" \
  385. build
  386. ;;
  387. Database-*-integration)
  388. "${database_emulator}" start
  389. trap '"${database_emulator}" stop' ERR EXIT
  390. pod_gen FirebaseDatabase.podspec --platforms="${gen_platform}"
  391. RunXcodebuild \
  392. -workspace 'gen/FirebaseDatabase/FirebaseDatabase.xcworkspace' \
  393. -scheme "FirebaseDatabase-Unit-integration" \
  394. "${xcb_flags[@]}" \
  395. build \
  396. test
  397. ;;
  398. RemoteConfig-*-fakeconsole)
  399. pod_gen FirebaseRemoteConfig.podspec --platforms="${gen_platform}"
  400. RunXcodebuild \
  401. -workspace 'gen/FirebaseRemoteConfig/FirebaseRemoteConfig.xcworkspace' \
  402. -scheme "FirebaseRemoteConfig-Unit-fake-console-tests" \
  403. "${xcb_flags[@]}" \
  404. build \
  405. test
  406. ;;
  407. RemoteConfig-*-integration)
  408. pod_gen FirebaseRemoteConfig.podspec --platforms="${gen_platform}"
  409. # Add GoogleService-Info.plist to generated Test Wrapper App.
  410. ruby ./scripts/update_xcode_target.rb gen/FirebaseRemoteConfig/Pods/Pods.xcodeproj \
  411. AppHost-FirebaseRemoteConfig-Unit-Tests \
  412. ../../../FirebaseRemoteConfig/Tests/Swift/SwiftAPI/GoogleService-Info.plist
  413. # Add AccessToken to generated Test Wrapper App.
  414. ruby ./scripts/update_xcode_target.rb gen/FirebaseRemoteConfig/Pods/Pods.xcodeproj \
  415. AppHost-FirebaseRemoteConfig-Unit-Tests \
  416. ../../../FirebaseRemoteConfig/Tests/Swift/AccessToken.json
  417. # Integration tests are only run on iOS to minimize flake failures.
  418. # TODO(ncooke3): Remove -sdk and -destination flags and replace with "${xcb_flags[@]}"
  419. RunXcodebuild \
  420. -workspace 'gen/FirebaseRemoteConfig/FirebaseRemoteConfig.xcworkspace' \
  421. -scheme "FirebaseRemoteConfig-Unit-swift-api-tests" \
  422. -sdk 'iphonesimulator' \
  423. -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.3.1' \
  424. build \
  425. test
  426. ;;
  427. RemoteConfigSample-*-*)
  428. RunXcodebuild \
  429. -workspace 'FirebaseRemoteConfig/Tests/Sample/RemoteConfigSampleApp.xcworkspace' \
  430. -scheme "RemoteConfigSampleApp" \
  431. "${xcb_flags[@]}" \
  432. build
  433. ;;
  434. FirebaseAIIntegration-*-*)
  435. # Build
  436. RunXcodebuild \
  437. -project 'FirebaseAI/Tests/TestApp/FirebaseAITestApp.xcodeproj' \
  438. -scheme "FirebaseAITestApp-SPM" \
  439. "${xcb_flags[@]}" \
  440. build
  441. # Run tests
  442. RunXcodebuild \
  443. -project 'FirebaseAI/Tests/TestApp/FirebaseAITestApp.xcodeproj' \
  444. -scheme "FirebaseAITestApp-SPM" \
  445. "${xcb_flags[@]}" \
  446. -parallel-testing-enabled NO \
  447. -retry-tests-on-failure \
  448. -test-iterations 3 \
  449. test
  450. ;;
  451. Sessions-*-integration)
  452. # Perform "pod install" to install the relevant dependencies
  453. # ./FirebaseSessions/generate_testapp.sh
  454. pod_gen FirebaseSessions.podspec --platforms=ios --clean
  455. cd FirebaseSessions/Tests/TestApp; pod install; cd -
  456. # Run E2E Integration Tests for Prod.
  457. RunXcodebuild \
  458. -workspace 'FirebaseSessions/Tests/TestApp/AppQualityDevApp.xcworkspace' \
  459. -scheme "AppQualityDevApp_iOS" \
  460. "${ios_flags[@]}" \
  461. "${xcb_flags[@]}" \
  462. build \
  463. test
  464. # Run E2E Integration Tests for Staging.
  465. RunXcodebuild \
  466. -workspace 'FirebaseSessions/Tests/TestApp/AppQualityDevApp.xcworkspace' \
  467. -scheme "AppQualityDevApp_iOS" \
  468. FirebaseSessionsRunEnvironment=STAGING \
  469. "${ios_flags[@]}" \
  470. "${xcb_flags[@]}" \
  471. build \
  472. test
  473. # Run E2E Integration Tests for Autopush.
  474. RunXcodebuild \
  475. -workspace 'FirebaseSessions/Tests/TestApp/AppQualityDevApp.xcworkspace' \
  476. -scheme "AppQualityDevApp_iOS" \
  477. FirebaseSessionsRunEnvironment=AUTOPUSH \
  478. "${ios_flags[@]}" \
  479. "${xcb_flags[@]}" \
  480. build \
  481. test
  482. ;;
  483. StorageSwift-*-xcodebuild)
  484. pod_gen FirebaseStorage.podspec --platforms=ios
  485. # Add GoogleService-Info.plist to generated Test Wrapper App.
  486. ruby ./scripts/update_xcode_target.rb gen/FirebaseStorage/Pods/Pods.xcodeproj \
  487. AppHost-FirebaseStorage-Unit-Tests \
  488. ../../../FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  489. if check_secrets; then
  490. # Integration tests are only run on iOS to minimize flake failures.
  491. # TODO(ncooke3): Add back "${ios_flags[@]}". See #14657.
  492. RunXcodebuild \
  493. -workspace 'gen/FirebaseStorage/FirebaseStorage.xcworkspace' \
  494. -scheme "FirebaseStorage-Unit-integration" \
  495. -sdk 'iphonesimulator' \
  496. -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.3.1' \
  497. "${xcb_flags[@]}" \
  498. test
  499. fi
  500. ;;
  501. StorageObjC-*-xcodebuild)
  502. pod_gen FirebaseStorage.podspec --platforms=ios
  503. # Add GoogleService-Info.plist to generated Test Wrapper App.
  504. ruby ./scripts/update_xcode_target.rb gen/FirebaseStorage/Pods/Pods.xcodeproj \
  505. AppHost-FirebaseStorage-Unit-Tests \
  506. ../../../FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  507. if check_secrets; then
  508. # Integration tests are only run on iOS to minimize flake failures.
  509. # TODO(ncooke3): Add back "${ios_flags[@]}". See #14657.
  510. RunXcodebuild \
  511. -workspace 'gen/FirebaseStorage/FirebaseStorage.xcworkspace' \
  512. -scheme "FirebaseStorage-Unit-ObjCIntegration" \
  513. -sdk 'iphonesimulator' \
  514. -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.3.1' \
  515. "${xcb_flags[@]}" \
  516. test
  517. fi
  518. ;;
  519. StorageCombine-*-xcodebuild)
  520. pod_gen FirebaseCombineSwift.podspec --platforms=ios
  521. # Add GoogleService-Info.plist to generated Test Wrapper App.
  522. ruby ./scripts/update_xcode_target.rb gen/FirebaseCombineSwift/Pods/Pods.xcodeproj \
  523. AppHost-FirebaseCombineSwift-Unit-Tests \
  524. ../../../FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
  525. if check_secrets; then
  526. # Integration tests are only run on iOS to minimize flake failures.
  527. RunXcodebuild \
  528. -workspace 'gen/FirebaseCombineSwift/FirebaseCombineSwift.xcworkspace' \
  529. -scheme "FirebaseCombineSwift-Unit-integration" \
  530. -sdk 'iphonesimulator' \
  531. -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.3.1' \
  532. test
  533. fi
  534. ;;
  535. GoogleDataTransport-watchOS-xcodebuild)
  536. RunXcodebuild \
  537. -workspace 'GoogleDataTransport/GDTWatchOSTestApp/GDTWatchOSTestApp.xcworkspace' \
  538. -scheme "GDTWatchOSTestAppWatchKitApp" \
  539. "${xcb_flags[@]}" \
  540. build
  541. RunXcodebuild \
  542. -workspace 'GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSTestApp.xcworkspace' \
  543. -scheme "GDTCCTWatchOSIndependentTestAppWatchKitApp" \
  544. "${xcb_flags[@]}" \
  545. build
  546. RunXcodebuild \
  547. -workspace 'GoogleDataTransport/GDTCCTWatchOSTestApp/GDTCCTWatchOSTestApp.xcworkspace' \
  548. -scheme "GDTCCTWatchOSCompanionTestApp" \
  549. "${xcb_flags[@]}" \
  550. build
  551. ;;
  552. Performance-*-unit)
  553. # Run unit tests on prod environment with unswizzle capabilities.
  554. export FPR_UNSWIZZLE_AVAILABLE="1"
  555. export FPR_AUTOPUSH_ENV="0"
  556. pod_gen FirebasePerformance.podspec --platforms="${gen_platform}"
  557. RunXcodebuild \
  558. -workspace 'gen/FirebasePerformance/FirebasePerformance.xcworkspace' \
  559. -scheme "FirebasePerformance-Unit-unit" \
  560. "${xcb_flags[@]}" \
  561. build \
  562. test
  563. ;;
  564. Performance-*-proddev)
  565. # Build the prod dev test app.
  566. export FPR_UNSWIZZLE_AVAILABLE="0"
  567. export FPR_AUTOPUSH_ENV="0"
  568. pod_gen FirebasePerformance.podspec --platforms="${gen_platform}"
  569. RunXcodebuild \
  570. -workspace 'gen/FirebasePerformance/FirebasePerformance.xcworkspace' \
  571. -scheme "FirebasePerformance-TestApp" \
  572. "${xcb_flags[@]}" \
  573. build
  574. ;;
  575. Performance-*-integration)
  576. # Generate the workspace for the SDK to generate Protobuf files.
  577. export FPR_UNSWIZZLE_AVAILABLE="0"
  578. pod_gen FirebasePerformance.podspec --platforms=ios --clean
  579. # Perform "pod install" to install the relevant dependencies
  580. cd FirebasePerformance/Tests/FIRPerfE2E; pod install; cd -
  581. # Run E2E Integration Tests for Autopush.
  582. RunXcodebuild \
  583. -workspace 'FirebasePerformance/Tests/FIRPerfE2E/FIRPerfE2E.xcworkspace' \
  584. -scheme "FIRPerfE2EAutopush" \
  585. FPR_AUTOPUSH_ENV=1 \
  586. "${ios_flags[@]}" \
  587. "${xcb_flags[@]}" \
  588. build \
  589. test
  590. # Run E2E Integration Tests for Prod.
  591. RunXcodebuild \
  592. -workspace 'FirebasePerformance/Tests/FIRPerfE2E/FIRPerfE2E.xcworkspace' \
  593. -scheme "FIRPerfE2EProd" \
  594. "${ios_flags[@]}" \
  595. "${xcb_flags[@]}" \
  596. build \
  597. test
  598. ;;
  599. FirebaseDataConnect-*-spm)
  600. RunXcodebuild \
  601. -scheme $product \
  602. "${xcb_flags[@]}" \
  603. IPHONEOS_DEPLOYMENT_TARGET=15.0 \
  604. TVOS_DEPLOYMENT_TARGET=15.0 \
  605. test
  606. ;;
  607. # Note that the combine tests require setting the minimum iOS and tvOS version to 13.0
  608. *-*-spm)
  609. RunXcodebuild \
  610. -scheme $product \
  611. "${xcb_flags[@]}" \
  612. IPHONEOS_DEPLOYMENT_TARGET=13.0 \
  613. TVOS_DEPLOYMENT_TARGET=13.0 \
  614. test
  615. ;;
  616. *-*-spmbuildonly)
  617. RunXcodebuild \
  618. -scheme $product \
  619. "${xcb_flags[@]}" \
  620. build
  621. ;;
  622. ClientApp-iOS-xcodebuild | ClientApp-iOS13-iOS-xcodebuild)
  623. RunXcodebuild \
  624. -project 'IntegrationTesting/ClientApp/ClientApp.xcodeproj' \
  625. -scheme $product \
  626. "${xcb_flags[@]}" \
  627. build
  628. ;;
  629. ClientApp-CocoaPods*-iOS-xcodebuild)
  630. RunXcodebuild \
  631. -workspace 'IntegrationTesting/ClientApp/ClientApp.xcworkspace' \
  632. -scheme $product \
  633. "${xcb_flags[@]}" \
  634. build
  635. ;;
  636. *)
  637. echo "Don't know how to build this product-platform-method combination" 1>&2
  638. echo " product=$product" 1>&2
  639. echo " platform=$platform" 1>&2
  640. echo " method=$method" 1>&2
  641. exit 1
  642. ;;
  643. esac