fastlane-plugin-test_center 3.11.3 → 3.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/test_center/actions/multi_scan.rb +1 -1
- data/lib/fastlane/plugin/test_center/actions/test_options_from_testplan.rb +1 -0
- data/lib/fastlane/plugin/test_center/actions/testplans_from_scheme.rb +36 -16
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan.rb +5 -0
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan_helper.rb +5 -1
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/runner.rb +3 -0
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb +24 -15
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/test_batch_worker_pool.rb +6 -0
- data/lib/fastlane/plugin/test_center/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cad9b8dc9f0a32d294ac1d2a854ed5245992ef5b42ab354387c8b3dba6c5571a
|
|
4
|
+
data.tar.gz: 6112ba8a64cf378c96c5997be419f13b57a75c156f5781b9f1d755a09d8559c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d158818861f01c4e1d59f2625dbc40cb73df7327566f5ad933eab199530217e5bd2f97a7684e21e9fd29e0df18ad9f8c6ac0648b5d8619d81c913d2eb8427dde
|
|
7
|
+
data.tar.gz: 8b70dfc5f9e97937177edccbc708c3ac13a1b74be9b5035dab31fbd76cb195ad86c8ddc62a1b3efcacb052dc0d4a7fe010514d4ed48c5e8b1217189ce5f1ba21
|
|
@@ -232,7 +232,7 @@ module Fastlane
|
|
|
232
232
|
end
|
|
233
233
|
|
|
234
234
|
def self.prepare_scan_options_for_build_for_testing(scan_options)
|
|
235
|
-
build_options = scan_options.merge(build_for_testing: true).reject { |k| %i[test_without_building, testplan].include?(k) }
|
|
235
|
+
build_options = scan_options.merge(build_for_testing: true).reject { |k| %i[test_without_building, testplan, include_simulator_logs].include?(k) }
|
|
236
236
|
Scan.config = FastlaneCore::Configuration.create(
|
|
237
237
|
Fastlane::Actions::ScanAction.available_options,
|
|
238
238
|
ScanHelper.scan_options_from_multi_scan_options(build_options)
|
|
@@ -14,6 +14,7 @@ module Fastlane
|
|
|
14
14
|
if test_target.key?('selectedTests')
|
|
15
15
|
UI.verbose(" Found selectedTests")
|
|
16
16
|
test_identifiers = test_target['selectedTests'].each do |selected_test|
|
|
17
|
+
selected_test.delete!('()')
|
|
17
18
|
UI.verbose(" Found test: '#{selected_test}'")
|
|
18
19
|
only_testing << "#{testable}/#{selected_test.sub('\/', '/')}"
|
|
19
20
|
end
|
|
@@ -2,25 +2,15 @@ module Fastlane
|
|
|
2
2
|
module Actions
|
|
3
3
|
class TestplansFromSchemeAction < Action
|
|
4
4
|
def self.run(params)
|
|
5
|
-
|
|
6
|
-
scheme_filepaths = schemes_from_project(params[:xcodeproj], scheme) || schemes_from_workspace(params[:workspace], scheme)
|
|
7
|
-
if scheme_filepaths.length.zero?
|
|
8
|
-
UI.user_error!("Error: cannot find any schemes in the Xcode project") if params[:xcodeproj]
|
|
9
|
-
UI.user_error!("Error: cannot find any schemes in the Xcode workspace") if params[:workspace]
|
|
10
|
-
end
|
|
5
|
+
scheme_filepaths = schemes(params)
|
|
11
6
|
testplan_paths = []
|
|
12
7
|
scheme_filepaths.each do |scheme_filepath|
|
|
13
8
|
UI.verbose("Looking in Scheme '#{scheme_filepath}' for any testplans")
|
|
14
9
|
xcscheme = Xcodeproj::XCScheme.new(scheme_filepath)
|
|
15
|
-
next
|
|
16
|
-
|
|
17
|
-
next if xcscheme.test_action.testables[0].buildable_references.to_a.empty?
|
|
18
|
-
next if xcscheme.test_action.test_plans.to_a.empty?
|
|
19
|
-
|
|
20
|
-
xcodeproj = xcscheme.test_action.testables[0].buildable_references[0].target_referenced_container.sub('container:', '')
|
|
21
|
-
container_dir = scheme_filepath.sub(/#{xcodeproj}.*/, '')
|
|
10
|
+
next unless scheme_has_testplans?(xcscheme)
|
|
11
|
+
scheme_container_dir = File.absolute_path(scheme_filepath).sub(%r{/[^/]*\.(xcworkspace|xcodeproj)/.*}, '')
|
|
22
12
|
xcscheme.test_action.test_plans.each do |testplan|
|
|
23
|
-
testplan_path = File.absolute_path(File.join(
|
|
13
|
+
testplan_path = File.absolute_path(File.join(scheme_container_dir, testplan.target_referenced_container.sub('container:', '')))
|
|
24
14
|
UI.verbose(" found testplan '#{testplan_path}'")
|
|
25
15
|
testplan_paths << testplan_path
|
|
26
16
|
end
|
|
@@ -28,6 +18,29 @@ module Fastlane
|
|
|
28
18
|
testplan_paths
|
|
29
19
|
end
|
|
30
20
|
|
|
21
|
+
def self.scheme_has_testplans?(xcscheme)
|
|
22
|
+
return !(
|
|
23
|
+
xcscheme.test_action.nil? ||
|
|
24
|
+
xcscheme.test_action.testables.to_a.empty? ||
|
|
25
|
+
xcscheme.test_action.testables[0].buildable_references.to_a.empty? ||
|
|
26
|
+
xcscheme.test_action.test_plans.to_a.empty?
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.schemes(params)
|
|
31
|
+
scheme = params[:scheme]
|
|
32
|
+
scheme_filepaths = schemes_from_project(params[:xcodeproj], scheme) || schemes_from_workspace(params[:workspace], scheme)
|
|
33
|
+
if scheme_filepaths.length.zero?
|
|
34
|
+
scheme_detail_message = ''
|
|
35
|
+
if scheme
|
|
36
|
+
scheme_detail_message = "named '#{scheme}' "
|
|
37
|
+
end
|
|
38
|
+
UI.user_error!("Error: cannot find any schemes #{scheme_detail_message}in the Xcode project") if params[:xcodeproj]
|
|
39
|
+
UI.user_error!("Error: cannot find any schemes #{scheme_detail_message}in the Xcode workspace") if params[:workspace]
|
|
40
|
+
end
|
|
41
|
+
scheme_filepaths
|
|
42
|
+
end
|
|
43
|
+
|
|
31
44
|
def self.schemes_from_project(project_path, scheme)
|
|
32
45
|
return nil unless project_path
|
|
33
46
|
|
|
@@ -37,9 +50,16 @@ module Fastlane
|
|
|
37
50
|
def self.schemes_from_workspace(workspace_path, scheme)
|
|
38
51
|
return nil unless workspace_path
|
|
39
52
|
|
|
40
|
-
xcworkspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
|
|
41
53
|
scheme_filepaths = []
|
|
42
|
-
|
|
54
|
+
scheme_filepaths.concat(schemes_from_project(workspace_path, scheme))
|
|
55
|
+
return scheme_filepaths unless scheme_filepaths.empty?
|
|
56
|
+
|
|
57
|
+
xcworkspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
|
|
58
|
+
xcodeprojects = xcworkspace.file_references.select do |file_reference|
|
|
59
|
+
file_reference.path.end_with?('xcodeproj')
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
xcodeprojects.each do |file_reference|
|
|
43
63
|
next if file_reference.path.include?('Pods/Pods.xcodeproj')
|
|
44
64
|
|
|
45
65
|
project_path = file_reference.absolute_path(File.dirname(workspace_path))
|
|
@@ -47,6 +47,11 @@ module TestCenter
|
|
|
47
47
|
scan_config.set(k,v) unless v.nil?
|
|
48
48
|
FastlaneCore::UI.verbose("\tSetting #{k.to_s} to #{v}")
|
|
49
49
|
end
|
|
50
|
+
if @options[:scan_devices_override]
|
|
51
|
+
scan_device_names = @options[:scan_devices_override].map { |device| device.name }
|
|
52
|
+
FastlaneCore::UI.verbose("\tSetting Scan.devices to #{scan_device_names}")
|
|
53
|
+
Scan.devices.replace(@options[:scan_devices_override])
|
|
54
|
+
end
|
|
50
55
|
end
|
|
51
56
|
|
|
52
57
|
# :nocov:
|
|
@@ -337,8 +337,12 @@ module TestCenter
|
|
|
337
337
|
|
|
338
338
|
glob_pattern = "#{output_directory}/system_logs-*.{log,logarchive}"
|
|
339
339
|
logs = Dir.glob(glob_pattern)
|
|
340
|
+
batch_prefix = ''
|
|
341
|
+
if @options[:batch]
|
|
342
|
+
batch_prefix = "batch-#{@options[:batch]}-"
|
|
343
|
+
end
|
|
340
344
|
logs.each do |log_filepath|
|
|
341
|
-
new_logname = "try-#{testrun_count}-#{File.basename(log_filepath)}"
|
|
345
|
+
new_logname = "#{batch_prefix}try-#{testrun_count}-#{File.basename(log_filepath)}"
|
|
342
346
|
new_log_filepath = "#{File.dirname(log_filepath)}/#{new_logname}"
|
|
343
347
|
FastlaneCore::UI.verbose("Moving simulator log '#{log_filepath}' to '#{new_log_filepath}'")
|
|
344
348
|
File.rename(log_filepath, new_log_filepath)
|
|
@@ -284,6 +284,9 @@ module TestCenter
|
|
|
284
284
|
scheme: @options[:scheme],
|
|
285
285
|
result_bundle: @options[:result_bundle]
|
|
286
286
|
).collate
|
|
287
|
+
logs_glog_pattern = "#{source_reports_directory_glob}/*system_logs-*.{log,logarchive}"
|
|
288
|
+
logs = Dir.glob(logs_glog_pattern)
|
|
289
|
+
FileUtils.mv(logs, absolute_output_directory)
|
|
287
290
|
FileUtils.rm_rf(Dir.glob(source_reports_directory_glob))
|
|
288
291
|
symlink_result_bundle_to_xcresult(absolute_output_directory, report_name_helper)
|
|
289
292
|
true
|
|
@@ -12,34 +12,43 @@ module TestCenter
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
+
def simulator_matches_destination(simulator, destination)
|
|
16
|
+
match = destination.match(/id=(?<udid>[^,]+)/)
|
|
17
|
+
if match
|
|
18
|
+
found_match = (match[:udid] == simulator.udid)
|
|
19
|
+
else
|
|
20
|
+
match = destination.match(/name=(?<name>[^,]+)/)
|
|
21
|
+
name = match[:name] || ''
|
|
22
|
+
match = destination.match(/OS=(?<os_version>[^,]+)/)
|
|
23
|
+
os_version = match[:os_version] || ''
|
|
24
|
+
|
|
25
|
+
found_match = (name == simulator.name && os_version == simulator.os_version)
|
|
26
|
+
end
|
|
27
|
+
found_match
|
|
28
|
+
end
|
|
29
|
+
|
|
15
30
|
def clone_destination_simulators
|
|
16
31
|
cloned_simulators = []
|
|
17
32
|
|
|
18
33
|
run_count = @options[:parallel_testrun_count] || 0
|
|
34
|
+
destinations = Scan.config[:destination].clone
|
|
19
35
|
original_simulators = FastlaneCore::DeviceManager.simulators('iOS').find_all do |simulator|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
else
|
|
26
|
-
match = destination.match(/name=(?<name>[^,]+)/)
|
|
27
|
-
name = match[:name] || ''
|
|
28
|
-
match = destination.match(/OS=(?<os_version>[^,]+)/)
|
|
29
|
-
os_version = match[:os_version] || ''
|
|
30
|
-
|
|
31
|
-
found_match = (name == simulator.name && os_version == simulator.os_version)
|
|
32
|
-
end
|
|
36
|
+
found_simulator = destinations.find do |destination|
|
|
37
|
+
simulator_matches_destination(simulator, destination)
|
|
38
|
+
end
|
|
39
|
+
if found_simulator
|
|
40
|
+
destinations.delete(found_simulator)
|
|
33
41
|
end
|
|
34
|
-
|
|
42
|
+
|
|
43
|
+
!found_simulator.nil?
|
|
35
44
|
end
|
|
36
45
|
original_simulators.each(&:shutdown)
|
|
37
46
|
(0...run_count).each do |batch_index|
|
|
38
47
|
cloned_simulators << []
|
|
39
48
|
original_simulators.each do |simulator|
|
|
40
|
-
FastlaneCore::UI.verbose("Cloning simulator")
|
|
41
49
|
cloned_simulator = simulator.clone
|
|
42
50
|
new_first_name = simulator.name.sub(/( ?\(.*| ?$)/, " Clone #{batch_index + 1}")
|
|
51
|
+
FastlaneCore::UI.verbose("Cloned simulator #{simulator.name} to (name=#{new_first_name}, udid=#{cloned_simulator.udid}, OS=#{cloned_simulator.ios_version})")
|
|
43
52
|
new_last_name = "#{self.class.name}<#{self.object_id}>"
|
|
44
53
|
cloned_simulator.rename("#{new_first_name} #{new_last_name}")
|
|
45
54
|
|
|
@@ -46,6 +46,11 @@ module TestCenter
|
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
+
def simulator_devices_for_worker(worker_index)
|
|
50
|
+
return nil unless @options[:platform] == :ios_simulator
|
|
51
|
+
@clones[worker_index]
|
|
52
|
+
end
|
|
53
|
+
|
|
49
54
|
def setup_parallel_workers
|
|
50
55
|
setup_cloned_simulators
|
|
51
56
|
desired_worker_count = @options[:parallel_testrun_count]
|
|
@@ -58,6 +63,7 @@ module TestCenter
|
|
|
58
63
|
def parallel_scan_options(worker_index)
|
|
59
64
|
options = @options.reject { |key| %i[device devices].include?(key) }
|
|
60
65
|
options[:destination] = destination_for_worker(worker_index)
|
|
66
|
+
options[:scan_devices_override] = simulator_devices_for_worker(worker_index)
|
|
61
67
|
options[:buildlog_path] = buildlog_path_for_worker(worker_index) if @options[:buildlog_path]
|
|
62
68
|
options[:derived_data_path] = derived_data_path_for_worker(worker_index)
|
|
63
69
|
options[:batch_index] = worker_index
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fastlane-plugin-test_center
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.11.
|
|
4
|
+
version: 3.11.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lyndsey Ferguson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-06-
|
|
11
|
+
date: 2020-06-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -309,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
309
309
|
- !ruby/object:Gem::Version
|
|
310
310
|
version: '0'
|
|
311
311
|
requirements: []
|
|
312
|
-
rubygems_version: 3.0.
|
|
312
|
+
rubygems_version: 3.0.3
|
|
313
313
|
signing_key:
|
|
314
314
|
specification_version: 4
|
|
315
315
|
summary: Makes testing your iOS app easier
|