fastlane-plugin-test_center 0.4.0 → 0.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b600780bb2c5b5caee315b15be8366c0942a68be
4
- data.tar.gz: 7c3ec116614992c2589bf917656438b9a76cc511
3
+ metadata.gz: 40ba8db5eb5707650f3ddd74ceee5a58f1f44f5d
4
+ data.tar.gz: 3a3e481b05ae0b53bde7a942589449c6f0ba4aaa
5
5
  SHA512:
6
- metadata.gz: e2ded3e6c83f8a88427a2a3431c09c6eb2c1219fa32544970b4986ffaf83e0110cef240d9fe73f4d5ea3bc4fe7eb3e33befd0667208fea8d03575248e65c2ee8
7
- data.tar.gz: cd47605f1117968b9dc1d986e1d33b8e06a54ac2fd06a3ef27a6805d2780dd38cd94847aa658667aa454fa194cecf391c17bc842a39ec08a5bbd76fbb28faa7d
6
+ metadata.gz: 60cd6052f5245ce7fabe12c1594d7cfe923a4016107a79a8dbc123755f89f7aa7ea123e24e75a65ef48313a1457faf37ecb35ea422263276ac007a6b3522ed65
7
+ data.tar.gz: 9e93b53367284accaba1e28964ffbfd6ee79fbcee6f9fc5b20706d4fc35fac19d7d6fed544e72f144d42529b5cf2511da4cc476b3e77c63132060c2785b9e6be
@@ -0,0 +1,131 @@
1
+ module Fastlane
2
+ module Actions
3
+ require 'fastlane/actions/scan'
4
+
5
+ class MultiScanAction < Action
6
+ def self.run(params)
7
+ try_count = 0
8
+ scan_options = params.values.reject { |k| k == :try_count }
9
+
10
+ scan_options = config_with_junit_report(scan_options)
11
+
12
+ unless scan_options[:test_without_building]
13
+ build_for_testing(scan_options)
14
+ scan_options.delete(:build_for_testing)
15
+ scan_options[:test_without_building] = true
16
+ end
17
+
18
+ begin
19
+ try_count += 1
20
+ other_action.scan(scan_options)
21
+ rescue FastlaneCore::Interface::FastlaneTestFailure => e
22
+ UI.verbose("Scan failed with #{e}")
23
+ report_filepath = junit_report_filepath(scan_options)
24
+ scan_options[:only_testing] = other_action.tests_from_junit(junit: report_filepath)[:failed]
25
+ retry if try_count < params[:try_count]
26
+ end
27
+ end
28
+
29
+ def self.build_for_testing(scan_options)
30
+ scan_options.delete(:test_without_building)
31
+ scan_options[:build_for_testing] = true
32
+ other_action.scan(scan_options)
33
+ end
34
+
35
+ def self.config_has_junit_report(config)
36
+ output_types = config.fetch(:output_types, '').to_s.split(',')
37
+ output_filenames = config.fetch(:output_files, '').to_s.split(',')
38
+
39
+ output_type_file_count_match = output_types.size == output_filenames.size
40
+ output_types.include?('junit') && (output_type_file_count_match || config[:custom_report_file_name].to_s.strip.length > 0)
41
+ end
42
+
43
+ def self.config_with_junit_report(config)
44
+ return config if config_has_junit_report(config)
45
+
46
+ if config[:output_types].to_s.strip.empty? || config[:custom_report_file_name]
47
+ config[:custom_report_file_name] ||= 'report.xml'
48
+ config[:output_types] = 'junit'
49
+ elsif config[:output_types].strip == 'junit' && config[:output_files].to_s.strip.empty?
50
+ config[:custom_report_file_name] ||= 'report.xml'
51
+ elsif !config[:output_types].split(',').include?('junit')
52
+ config[:output_types] << ',junit'
53
+ config[:output_files] << ',report.xml'
54
+ elsif config[:output_files].nil?
55
+ config[:output_files] = config[:output_types].split(',').map { |type| "report.#{type}" }.join(',')
56
+ end
57
+ config
58
+ end
59
+
60
+ def self.junit_report_filepath(config)
61
+ report_filename = config[:custom_report_file_name]
62
+ if report_filename.nil?
63
+ junit_index = config[:output_types].split(',').find_index('junit')
64
+ report_filename = config[:output_files].to_s.split(',')[junit_index]
65
+ end
66
+ File.join(config[:output_directory], report_filename)
67
+ end
68
+
69
+ #####################################################
70
+ # @!group Documentation
71
+ #####################################################
72
+
73
+ def self.description
74
+ "A short description with <= 80 characters of what this action does"
75
+ end
76
+
77
+ def self.details
78
+ # Optional:
79
+ # this is your chance to provide a more detailed description of this action
80
+ "You can use this action to do cool things..."
81
+ end
82
+
83
+ def self.scan_options
84
+ ScanAction.available_options.reject { |config_item| config_item.key == :output_files }
85
+ end
86
+
87
+ def self.available_options
88
+ scan_options + [
89
+ FastlaneCore::ConfigItem.new(
90
+ key: :try_count,
91
+ env_name: "FL_MULTI_SCAN_TRY_COUNT", # The name of the environment variable
92
+ description: "The number of times to retry running tests via scan", # a short description of this parameter
93
+ type: Integer,
94
+ is_string: false,
95
+ default_value: 1
96
+ )
97
+ ]
98
+ end
99
+
100
+ def self.output
101
+ # Define the shared values you are going to provide
102
+ # Example
103
+ [
104
+ ['MULTI_SCAN_CUSTOM_VALUE', 'A description of what this value contains']
105
+ ]
106
+ end
107
+
108
+ def self.return_value
109
+ # If your method provides a return value, you can describe here what it does
110
+ end
111
+
112
+ def self.authors
113
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
114
+ ["Your GitHub/Twitter Name"]
115
+ end
116
+
117
+ def self.is_supported?(platform)
118
+ # you can do things like
119
+ #
120
+ # true
121
+ #
122
+ # platform == :ios
123
+ #
124
+ # [:ios, :mac].include?(platform)
125
+ #
126
+
127
+ platform == :ios
128
+ end
129
+ end
130
+ end
131
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TestCenter
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.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: 0.4.0
4
+ version: 0.5.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: 2017-11-06 00:00:00.000000000 Z
11
+ date: 2017-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,6 +131,7 @@ files:
131
131
  - LICENSE
132
132
  - README.md
133
133
  - lib/fastlane/plugin/test_center.rb
134
+ - lib/fastlane/plugin/test_center/actions/multi_scan.rb
134
135
  - lib/fastlane/plugin/test_center/actions/suppress_tests.rb
135
136
  - lib/fastlane/plugin/test_center/actions/suppress_tests_from_junit.rb
136
137
  - lib/fastlane/plugin/test_center/actions/suppressed_tests.rb