fastlane-plugin-test_center 3.6.3.parallelizing.pre.alpha.pre.1 → 3.6.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,6 @@ module TestCenter
5
5
  require 'plist'
6
6
 
7
7
  class TestCollector
8
- attr_reader :xctestrun_path
9
-
10
8
  def initialize(options)
11
9
  unless options[:xctestrun] || options[:derived_data_path]
12
10
  options[:derived_data_path] = default_derived_data_path(options)
@@ -17,7 +15,6 @@ module TestCenter
17
15
  end
18
16
  @only_testing = options[:only_testing]
19
17
  @skip_testing = options[:skip_testing]
20
- @batch_count = options[:batch_count]
21
18
  end
22
19
 
23
20
  def default_derived_data_path(options)
@@ -37,9 +34,7 @@ module TestCenter
37
34
  if @only_testing
38
35
  @testables ||= only_testing_to_testables_tests.keys
39
36
  else
40
- @testables ||= Plist.parse_xml(@xctestrun_path).keys.reject do |key|
41
- key == '__xctestrun_metadata__'
42
- end
37
+ @testables ||= Plist.parse_xml(@xctestrun_path).keys
43
38
  end
44
39
  end
45
40
  @testables
@@ -54,30 +49,13 @@ module TestCenter
54
49
  tests
55
50
  end
56
51
 
57
- def xctestrun_known_tests
58
- config = FastlaneCore::Configuration.create(::Fastlane::Actions::TestsFromXctestrunAction.available_options, xctestrun: @xctestrun_path)
59
- ::Fastlane::Actions::TestsFromXctestrunAction.run(config)
60
- end
61
-
62
52
  def testables_tests
63
53
  unless @testables_tests
64
54
  if @only_testing
65
- known_tests = nil
66
55
  @testables_tests = only_testing_to_testables_tests
67
-
68
- @testables_tests.each do |testable, tests|
69
- tests.each_with_index do |test, index|
70
- if test.count('/') < 2
71
- known_tests ||= xctestrun_known_tests[testable]
72
- test_components = test.split('/')
73
- testsuite = test_components.size == 1 ? test_components[0] : test_components[1]
74
- @testables_tests[testable][index] = known_tests.select { |known_test| known_test.include?(testsuite) }
75
- end
76
- end
77
- @testables_tests[testable].flatten!
78
- end
79
56
  else
80
- @testables_tests = xctestrun_known_tests
57
+ config = FastlaneCore::Configuration.create(::Fastlane::Actions::TestsFromXctestrunAction.available_options, xctestrun: @xctestrun_path)
58
+ @testables_tests = ::Fastlane::Actions::TestsFromXctestrunAction.run(config)
81
59
  if @skip_testing
82
60
  skipped_testable_tests = Hash.new { |h, k| h[k] = [] }
83
61
  @skip_testing.sort.each do |skipped_test_identifier|
@@ -90,30 +68,8 @@ module TestCenter
90
68
  end
91
69
  end
92
70
  end
93
-
94
71
  @testables_tests
95
72
  end
96
-
97
- def test_batches
98
- if @batches.nil?
99
- @batches = []
100
- testables.each do |testable|
101
- testable_tests = testables_tests[testable]
102
- next if testable_tests.empty?
103
-
104
- if @batch_count > 1
105
- slice_count = [(testable_tests.length / @batch_count.to_f).ceil, 1].max
106
- testable_tests.each_slice(slice_count).to_a.each do |tests_batch|
107
- @batches << tests_batch
108
- end
109
- else
110
- @batches << testable_tests
111
- end
112
- end
113
- end
114
-
115
- @batches
116
- end
117
73
  end
118
74
  end
119
75
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TestCenter
3
- VERSION = "3.6.3.parallelizing-alpha-1"
3
+ VERSION = "3.6.3"
4
4
  end
5
5
  end
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.6.3.parallelizing.pre.alpha.pre.1
4
+ version: 3.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyndsey Ferguson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-15 00:00:00.000000000 Z
11
+ date: 2019-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -67,13 +67,13 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.1.7
69
69
  - !ruby/object:Gem::Dependency
70
- name: colorize
70
+ name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
- type: :runtime
76
+ type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: bundler
84
+ name: colorize
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 2.108.0
103
+ version: 2.56.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 2.108.0
110
+ version: 2.56.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -235,26 +235,16 @@ files:
235
235
  - lib/fastlane/plugin/test_center/actions/collate_junit_reports.rb
236
236
  - lib/fastlane/plugin/test_center/actions/collate_test_result_bundles.rb
237
237
  - lib/fastlane/plugin/test_center/actions/multi_scan.rb
238
- - lib/fastlane/plugin/test_center/actions/restart_core_simulator_service.rb
239
238
  - lib/fastlane/plugin/test_center/actions/suppress_tests.rb
240
239
  - lib/fastlane/plugin/test_center/actions/suppress_tests_from_junit.rb
241
240
  - lib/fastlane/plugin/test_center/actions/suppressed_tests.rb
242
241
  - lib/fastlane/plugin/test_center/actions/tests_from_junit.rb
243
242
  - lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb
243
+ - lib/fastlane/plugin/test_center/helper/correcting_scan_helper.rb
244
244
  - lib/fastlane/plugin/test_center/helper/junit_helper.rb
245
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager.rb
246
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/device_manager.rb
247
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/interstitial.rb
248
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/report_collator.rb
249
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan.rb
250
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan_helper.rb
251
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/runner.rb
252
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb
253
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_manager.rb
254
245
  - lib/fastlane/plugin/test_center/helper/reportname_helper.rb
255
246
  - lib/fastlane/plugin/test_center/helper/test_collector.rb
256
247
  - lib/fastlane/plugin/test_center/helper/xcodebuild_string.rb
257
- - lib/fastlane/plugin/test_center/helper/xctestrun_info.rb
258
248
  - lib/fastlane/plugin/test_center/version.rb
259
249
  homepage: https://github.com/lyndsey-ferguson/fastlane-plugin-test_center
260
250
  licenses:
@@ -271,9 +261,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
261
  version: '0'
272
262
  required_rubygems_version: !ruby/object:Gem::Requirement
273
263
  requirements:
274
- - - ">"
264
+ - - ">="
275
265
  - !ruby/object:Gem::Version
276
- version: 1.3.1
266
+ version: '0'
277
267
  requirements: []
278
268
  rubygems_version: 3.0.2
279
269
  signing_key:
@@ -1,37 +0,0 @@
1
- module Fastlane
2
- module Actions
3
- class RestartCoreSimulatorServiceAction < Action
4
- def self.run(params)
5
- launchctl_list_count = 0
6
- while Actions.sh('launchctl list | grep com.apple.CoreSimulator.CoreSimulatorService || true', log: false) != ''
7
- UI.crash!('Unable to quit com.apple.CoreSimulator.CoreSimulatorService after 10 tries') if (launchctl_list_count += 1) > 10
8
- commands << Actions.sh('launchctl stop com.apple.CoreSimulator.CoreSimulatorService &> /dev/null || true', log: false)
9
- UI.verbose('Waiting for com.apple.CoreSimulator.CoreSimulatorService to quit')
10
- sleep(0.25)
11
- end
12
- commands << Actions.sh('launchctl start com.apple.CoreSimulator.CoreSimulatorService &> /dev/null || true', log: false)
13
- end
14
-
15
- #####################################################
16
- # @!group Documentation
17
- #####################################################
18
-
19
- def self.description
20
- "Restarts the com.apple.CoreSimulator.CoreSimulatorService."
21
- end
22
-
23
- def self.details
24
- "Sometimes the com.apple.CoreSimulator.CoreSimulatorService can hang. " \
25
- "Use this action to force-restart it."
26
- end
27
-
28
- def self.authors
29
- ["lyndsey-ferguson/@lyndseydf"]
30
- end
31
-
32
- def self.is_supported?(platform)
33
- platform == :ios
34
- end
35
- end
36
- end
37
- end
@@ -1,5 +0,0 @@
1
- require_relative 'multi_scan_manager/interstitial'
2
- require_relative 'multi_scan_manager/report_collator'
3
- require_relative 'multi_scan_manager/simulator_manager'
4
- require_relative 'multi_scan_manager/runner'
5
- require_relative 'xctestrun_info'
@@ -1,26 +0,0 @@
1
- module FastlaneCore
2
- class DeviceManager
3
- class Device
4
- def clone
5
- raise 'Can only clone iOS Simulators' unless self.is_simulator
6
- Device.new(
7
- name: self.name,
8
- udid: `xcrun simctl clone #{self.udid} '#{self.name}'`.chomp,
9
- os_type: self.os_type,
10
- os_version: self.os_version,
11
- state: self.state,
12
- is_simulator: self.is_simulator
13
- )
14
- end
15
-
16
- def rename(newname)
17
- `xcrun simctl rename #{self.udid} '#{newname}'`
18
- self.name = newname
19
- end
20
-
21
- def boot
22
- `xcrun simctl boot #{self.udid}`
23
- end
24
- end
25
- end
26
- end
@@ -1,143 +0,0 @@
1
- module TestCenter
2
- module Helper
3
- module MultiScanManager
4
- class Interstitial
5
-
6
- attr_writer :output_directory
7
- attr_writer :batch
8
-
9
- def initialize(options)
10
- @output_directory = options[:output_directory]
11
- @testrun_completed_block = options[:testrun_completed_block]
12
- @result_bundle = options[:result_bundle]
13
- @scheme = options[:scheme]
14
- @batch = options[:batch]
15
- @reportnamer = options[:reportnamer]
16
- @xcpretty_json_file_output = ENV['XCPRETTY_JSON_FILE_OUTPUT']
17
- @parallelize = options[:parallelize]
18
-
19
- before_all
20
- end
21
-
22
- # TODO: Should we be creating a new interstitial for each batch? yes.
23
- # Should we clear out the result bundles before each batch? --> should
24
- # it not be done before all batches? Same with env var for json resports.
25
- def before_all
26
- if @result_bundle
27
- remove_preexisting_test_result_bundles
28
- end
29
- set_json_env_if_necessary
30
- if @parallelize
31
- @original_derived_data_path = ENV['SCAN_DERIVED_DATA_PATH']
32
- FileUtils.mkdir_p(@output_directory)
33
- ENV['SCAN_DERIVED_DATA_PATH'] = Dir.mktmpdir(nil, @output_directory)
34
- end
35
- end
36
-
37
- def after_all
38
- FastlaneCore::UI.message("resetting JSON ENV var to #{@xcpretty_json_file_output}")
39
- ENV['XCPRETTY_JSON_FILE_OUTPUT'] = @xcpretty_json_file_output
40
- if @parallelize
41
- ENV['SCAN_DERIVED_DATA_PATH'] = @original_derived_data_path
42
- end
43
- end
44
-
45
- def remove_preexisting_test_result_bundles
46
- glob_pattern = "#{@output_directory}/.*\.test_result"
47
- preexisting_test_result_bundles = Dir.glob(glob_pattern)
48
- FileUtils.rm_rf(preexisting_test_result_bundles)
49
- end
50
-
51
- def move_test_result_bundle_for_next_run
52
- if @result_bundle
53
- built_test_result, moved_test_result = test_result_bundlepaths
54
- FileUtils.mv(built_test_result, moved_test_result)
55
- end
56
- end
57
-
58
- def test_result_bundlepaths
59
- [
60
- File.join(@output_directory, @scheme) + '.test_result',
61
- File.join(@output_directory, @scheme) + "_#{@reportnamer.report_count}.test_result"
62
- ]
63
- end
64
-
65
- def reset_simulators
66
- destinations = Scan.config[:destination]
67
- simulators = FastlaneCore::DeviceManager.simulators('iOS')
68
- simulator_ids_to_reset = []
69
- destinations.each do |destination|
70
- destination.split(',').each do |destination_pair|
71
- key, value = destination_pair.split('=')
72
- if key == 'id'
73
- simulator_ids_to_reset << value
74
- end
75
- end
76
- end
77
- simulators_to_reset = simulators.each.select { |simulator| simulator_ids_to_reset.include?(simulator.udid) }
78
- simulators_to_reset.each do |simulator|
79
- simulator.reset
80
- end
81
- end
82
-
83
- def send_info_for_try(try_count)
84
- puts "in send_info_for_try for #{@batch}"
85
- return unless @testrun_completed_block
86
-
87
- report_filepath = File.join(@output_directory, @reportnamer.junit_last_reportname)
88
-
89
- config = FastlaneCore::Configuration.create(
90
- Fastlane::Actions::TestsFromJunitAction.available_options,
91
- {
92
- junit: File.absolute_path(report_filepath)
93
- }
94
- )
95
- junit_results = Fastlane::Actions::TestsFromJunitAction.run(config)
96
- info = {
97
- failed: junit_results[:failed],
98
- passing: junit_results[:passing],
99
- batch: @batch,
100
- try_count: try_count,
101
- report_filepath: report_filepath
102
- }
103
-
104
- if @reportnamer.includes_html?
105
- html_report_filepath = File.join(@output_directory, @reportnamer.html_last_reportname)
106
- info[:html_report_filepath] = html_report_filepath
107
- end
108
- if @reportnamer.includes_json?
109
- json_report_filepath = File.join(@output_directory, @reportnamer.json_last_reportname)
110
- info[:json_report_filepath] = json_report_filepath
111
- end
112
- if @result_bundle
113
- test_result_suffix = '.test_result'
114
- test_result_suffix.prepend("-#{@reportnamer.report_count}") unless @reportnamer.report_count.zero?
115
- test_result_bundlepath = File.join(@output_directory, @scheme) + test_result_suffix
116
- info[:test_result_bundlepath] = test_result_bundlepath
117
- end
118
- puts "interstitial about to call #{@testrun_completed_block} for batch #{@batch}"
119
- @testrun_completed_block.call(info)
120
- end
121
-
122
- def set_json_env_if_necessary
123
- if @reportnamer && @reportnamer.includes_json?
124
- ENV['XCPRETTY_JSON_FILE_OUTPUT'] = File.join(
125
- @output_directory,
126
- @reportnamer.json_last_reportname
127
- )
128
- end
129
- end
130
-
131
- def finish_try(try_count)
132
- send_info_for_try(try_count)
133
- reset_simulators
134
- ENV['SCAN_DERIVED_DATA_PATH'] = Dir.mktmpdir(nil, @output_directory) if @parallelize
135
- move_test_result_bundle_for_next_run
136
- set_json_env_if_necessary
137
- @reportnamer && @reportnamer.increment
138
- end
139
- end
140
- end
141
- end
142
- end
143
-
@@ -1,113 +0,0 @@
1
- module TestCenter
2
- module Helper
3
- module MultiScanManager
4
- class ReportCollator
5
- CollateJunitReportsAction = Fastlane::Actions::CollateJunitReportsAction
6
- CollateHtmlReportsAction = Fastlane::Actions::CollateHtmlReportsAction
7
- CollateJsonReportsAction = Fastlane::Actions::CollateJsonReportsAction
8
- CollateTestResultBundlesAction = Fastlane::Actions::CollateTestResultBundlesAction
9
-
10
- def initialize(params)
11
- @source_reports_directory_glob = params[:source_reports_directory_glob]
12
- @output_directory = params[:output_directory]
13
- @reportnamer = params[:reportnamer]
14
- @scheme = params[:scheme]
15
- @result_bundle = params[:result_bundle]
16
- @suffix = params[:suffix] || ''
17
- end
18
-
19
- def collate
20
- collate_junit_reports
21
- collate_html_reports
22
- collate_json_reports
23
- collate_test_result_bundles
24
- end
25
-
26
- def sort_globbed_files(glob)
27
- files = Dir.glob(glob).map do |relative_filepath|
28
- File.absolute_path(relative_filepath)
29
- end
30
- files.sort! { |f1, f2| File.mtime(f1) <=> File.mtime(f2) }
31
- end
32
-
33
- def delete_globbed_intermediatefiles(glob)
34
- retried_reportfiles = Dir.glob(glob)
35
- FileUtils.rm_f(retried_reportfiles)
36
- end
37
-
38
- def create_config(klass, options)
39
- FastlaneCore::Configuration.create(klass.available_options, options)
40
- end
41
-
42
- def collate_junit_reports
43
- glob = "#{@source_reports_directory_glob}/#{@reportnamer.junit_fileglob}"
44
- report_files = sort_globbed_files(glob)
45
- if report_files.size > 1
46
- config = create_config(
47
- CollateJunitReportsAction,
48
- {
49
- reports: report_files,
50
- collated_report: File.absolute_path(File.join(@output_directory, @reportnamer.junit_reportname(@suffix)))
51
- }
52
- )
53
- CollateJunitReportsAction.run(config)
54
- delete_globbed_intermediatefiles("#{@source_reports_directory_glob}/#{@reportnamer.junit_numbered_fileglob}")
55
- end
56
- end
57
-
58
- def collate_html_reports
59
- return unless @reportnamer.includes_html?
60
-
61
- report_files = sort_globbed_files("#{@source_reports_directory_glob}/#{@reportnamer.html_fileglob}")
62
- if report_files.size > 1
63
- config = create_config(
64
- CollateJunitReportsAction,
65
- {
66
- reports: report_files,
67
- collated_report: File.absolute_path(File.join(@output_directory, @reportnamer.html_reportname(@suffix)))
68
- }
69
- )
70
- CollateHtmlReportsAction.run(config)
71
- delete_globbed_intermediatefiles("#{@source_reports_directory_glob}/#{@reportnamer.html_numbered_fileglob}")
72
- end
73
- end
74
-
75
- def collate_json_reports
76
- return unless @reportnamer.includes_json?
77
-
78
- report_files = sort_globbed_files("#{@source_reports_directory_glob}/#{@reportnamer.json_fileglob}")
79
-
80
- if report_files.size > 1
81
- config = create_config(
82
- CollateJsonReportsAction,
83
- {
84
- reports: report_files,
85
- collated_report: File.absolute_path(File.join(@output_directory, @reportnamer.json_reportname(@suffix)))
86
- }
87
- )
88
- CollateJsonReportsAction.run(config)
89
- delete_globbed_intermediatefiles("#{@source_reports_directory_glob}/#{@reportnamer.json_numbered_fileglob}")
90
- end
91
- end
92
-
93
- def collate_test_result_bundles
94
- return unless @result_bundle
95
-
96
- test_result_bundlepaths = sort_globbed_files("#{@source_reports_directory_glob}/#{@scheme}*.test_result")
97
-
98
- if test_result_bundlepaths.size > 1
99
- config = create_config(
100
- CollateTestResultBundlesAction,
101
- {
102
- bundles: test_result_bundlepaths,
103
- collated_bundle: "#{File.join(@output_directory, @scheme)}.test_result'"
104
- }
105
- )
106
- CollateTestResultBundlesAction.run(config)
107
- delete_globbed_intermediatefiles("#{@source_reports_directory_glob}/#{@scheme}-[1-9]*.test_result")
108
- end
109
- end
110
- end
111
- end
112
- end
113
- end