@@ -13,7 +13,6 @@ podspec_names = ['StreamVideo', 'StreamVideo-XCFramework', 'StreamVideoSwiftUI',
1313github_repo = ENV [ 'GITHUB_REPOSITORY' ] || 'GetStream/stream-video-swift'
1414sinatra_port = 4567
1515video_buddy_port = 5678
16- app_secret = ENV . fetch ( 'STREAM_VIDEO_SECRET' , nil )
1716derived_data_path = 'derived_data'
1817source_packages_path = 'spm_cache'
1918gci = ENV [ 'GOOGLE_CLIENT_ID' ] || ''
@@ -234,8 +233,7 @@ lane :test do |options|
234233 devices : options [ :device ] ,
235234 number_of_retries : 3 ,
236235 skip_build : options [ :skip_build ] ,
237- build_for_testing : options [ :build_for_testing ] ,
238- xcargs : is_ci ? "STREAM_VIDEO_SECRET=#{ app_secret } " : ''
236+ build_for_testing : options [ :build_for_testing ]
239237 }
240238
241239 begin
@@ -423,33 +421,27 @@ lane :test_e2e do |options|
423421 build_for_testing : options [ :build_for_testing ] ,
424422 devices : options [ :device ] ,
425423 prelaunch_simulator : is_ci ,
426- number_of_retries : 3 ,
427- xcargs : is_ci ? "STREAM_VIDEO_SECRET=#{ app_secret } " : ''
424+ number_of_retries : 3
428425 }
429426
430- if is_localhost
431- scan ( scan_options )
432- else
433- parallelize_tests_on_ci ( scan : scan_options , batch : options [ :batch ] , cron : options [ :cron ] )
427+ if ENV [ 'MATRIX_SIZE' ] && options [ :batch ]
428+ products_dir = File . expand_path ( "../#{ derived_data_path } /Build/Products" )
429+ xctestrun = Dir . glob ( File . expand_path ( "#{ products_dir } /*.xctestrun" ) ) . first
430+ tests = retrieve_xctest_names ( xctestrun : xctestrun ) . values . flatten
431+ slice_size = ( tests . size / ENV [ 'MATRIX_SIZE' ] . to_f ) . ceil
432+ only_testing = [ ]
433+ tests . each_slice ( slice_size ) { |test | only_testing << test }
434+ only_testing_batch = only_testing [ options [ :batch ] . to_i ]
435+ scan_options [ :only_testing ] = only_testing_batch
436+ UI . important ( "Tests in total: #{ only_testing . flatten . size } . Running #{ only_testing_batch . size } of them ⌛️" )
434437 end
435- end
436-
437- private_lane :parallelize_tests_on_ci do |options |
438- products_dir = File . expand_path ( "../#{ derived_data_path } /Build/Products" )
439- xctestrun = Dir . glob ( File . expand_path ( "#{ products_dir } /*.xctestrun" ) ) . first
440- tests = retrieve_xctest_names ( xctestrun : xctestrun ) . values . flatten
441- slice_size = options [ :cron ] ? tests . size : ( tests . size / ENV [ 'MATRIX_SIZE' ] . to_f ) . ceil
442- only_testing = [ ]
443- tests . each_slice ( slice_size ) { |test | only_testing << test }
444- only_testing_batch = only_testing [ options [ :batch ] . to_i ]
445438
446439 begin
447- UI . success ( "Tests in total: #{ only_testing . flatten . size } . Running #{ only_testing_batch . size } of them ⌛️" )
448- scan ( options [ :scan ] . merge ( only_testing : only_testing_batch ) )
440+ scan ( scan_options )
449441 rescue StandardError
450442 failed_tests = retreive_failed_tests
451443 UI . important ( "Re-running #{ failed_tests . size } failed tests ⌛️" )
452- scan ( options [ :scan ] . merge ( only_testing : failed_tests ) )
444+ scan ( scan_options . merge ( only_testing : failed_tests ) )
453445 end
454446end
455447
0 commit comments