fastlane-plugin-test_center 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac301734c581a9473c523f60ea05897a756aabe9
4
- data.tar.gz: db399e922c7eda6f9f88c0fcb02a235f92bc64ea
3
+ metadata.gz: e358292f8958ac882fcf7a1451e9cb8471ae195e
4
+ data.tar.gz: 2d70736d44380130d0f6b79bf5d5307ffc44f0fe
5
5
  SHA512:
6
- metadata.gz: e58069d4c3f89808d4163d5f23d0f5dcd40619b195de30f18ecec67e1d7205907a3c6e2fda69d6fb6542e28b1cbbdb423d7bcf33c71be74e2d50100539585ed2
7
- data.tar.gz: 61c9c61afb57eee86a1bdbd3a43880deec8221ec40d0e3a7babd23b6552bc5838a15b3681795a6742944d8275b20846f7f261c3fd02f6c3f8628dd456502749f
6
+ metadata.gz: 2e740176b0e29f4323975406ba7de2c0e1057f1147bc28c42b6f387d640aa692f39dc17cd051c9a1c60406cf3e8dba7f27d282bed52f334d1530893bdc6d0842
7
+ data.tar.gz: c4ded19826876cfef6c1a8eaaff02bc68ecce76767382ae0c49009293b99cc3a60145627b852381d40063bbeae19f6a3db5b8c61c5923591e8cd1aaae163c60b
@@ -1,6 +1,7 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  require 'fastlane/actions/scan'
4
+ require 'fastlane/plugin/merge_junit_report'
4
5
  require 'shellwords'
5
6
 
6
7
  class MultiScanAction < Action
@@ -8,10 +9,12 @@ module Fastlane
8
9
  try_count = 0
9
10
  scan_options = params.values.reject { |k| k == :try_count }
10
11
 
11
- FastlaneCore::PrintTable.print_values(
12
- config: params._values.reject { |k, v| scan_options.key?(k) },
13
- title: "Summary for mult_scan (test_center v#{Fastlane::TestCenter::VERSION})"
14
- )
12
+ unless Helper.test?
13
+ FastlaneCore::PrintTable.print_values(
14
+ config: params._values.reject { |k, v| scan_options.key?(k) },
15
+ title: "Summary for multi_scan (test_center v#{Fastlane::TestCenter::VERSION})"
16
+ )
17
+ end
15
18
 
16
19
  scan_options = config_with_junit_report(scan_options)
17
20
 
@@ -31,10 +34,30 @@ module Fastlane
31
34
  report_filepath = junit_report_filepath(scan_options)
32
35
  failed_tests = other_action.tests_from_junit(junit: report_filepath)[:failed]
33
36
  scan_options[:only_testing] = failed_tests.map(&:shellescape)
34
- increment_junit_report_filename(scan_options)
37
+ increment_report_filenames(scan_options)
35
38
  retry
36
39
  end
37
40
  end
41
+ collate_reports(scan_options)
42
+ end
43
+
44
+ def self.collate_reports(scan_options)
45
+ extension = junit_report_fileextension(scan_options)
46
+ report_files = Dir.glob("#{scan_options[:output_directory]}/*#{extension}").map do |relative_filepath|
47
+ File.absolute_path(relative_filepath)
48
+ end
49
+ if report_files.size > 1
50
+ r = Regexp.new("^(?<filename>.*)-(\\d+)\\.(junit|xml|html)")
51
+ final_report_name = junit_report_filename(scan_options)
52
+ match = r.match(final_report_name)
53
+ if match
54
+ final_report_name = "#{match[:filename]}#{extension}"
55
+ end
56
+ other_action.merge_junit_report(
57
+ input_files: report_files.reverse,
58
+ output_file: File.absolute_path(File.join(scan_options[:output_directory], final_report_name))
59
+ )
60
+ end
38
61
  end
39
62
 
40
63
  def self.build_for_testing(scan_options)
@@ -78,25 +101,35 @@ module Fastlane
78
101
  report_filename
79
102
  end
80
103
 
104
+ def self.junit_report_fileextension(config)
105
+ File.extname(junit_report_filename(config))
106
+ end
107
+
81
108
  def self.junit_report_filepath(config)
82
109
  File.absolute_path(File.join(config[:output_directory], junit_report_filename(config)))
83
110
  end
84
111
 
85
- def self.increment_junit_report_filename(config)
112
+ def self.increment_report_filename(filename)
86
113
  new_report_number = 2
87
- report_filename = junit_report_filename(config)
88
- if /^(?<report_filename_no_suffix>.*)-(?<report_number>\d+)\.xml/ =~ report_filename
89
- new_report_number = report_number.to_i + 1
90
- report_filename = report_filename_no_suffix
114
+ basename = File.basename(filename, '.*')
115
+ r = Regexp.new("^(?<filename>.*)-(?<report_number>\\d+)\\.(junit|xml|html)")
116
+ match = r.match(filename)
117
+ if match
118
+ new_report_number = match[:report_number].to_i + 1
119
+ basename = match[:filename]
91
120
  end
92
- new_report_filename = "#{File.basename(report_filename, '.*')}-#{new_report_number}.xml"
93
- if config[:custom_report_file_name]
94
- config[:custom_report_file_name] = new_report_filename
95
- else
96
- junit_index = config[:output_types].split(',').find_index('junit')
121
+ "#{basename}-#{new_report_number}#{File.extname(filename)}"
122
+ end
123
+
124
+ def self.increment_report_filenames(config)
125
+ if config[:output_files]
97
126
  output_files = config[:output_files].to_s.split(',')
98
- output_files[junit_index] = new_report_filename
127
+ output_files = output_files.map do |output_file|
128
+ increment_report_filename(output_file)
129
+ end
99
130
  config[:output_files] = output_files.join(',')
131
+ elsif config[:custom_report_file_name]
132
+ config[:custom_report_file_name] = increment_report_filename(config[:custom_report_file_name])
100
133
  end
101
134
  end
102
135
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TestCenter
3
- VERSION = "2.1.0"
3
+ VERSION = "2.2.0"
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: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyndsey Ferguson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-04 00:00:00.000000000 Z
11
+ date: 2018-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fastlane-plugin-merge_junit_report
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement