fastlane-plugin-try_scan 0.5.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +14 -2
- data/lib/fastlane/plugin/try_scan/actions/try_scan_action.rb +28 -1
- data/lib/fastlane/plugin/try_scan/helper/scan_helper.rb +21 -0
- data/lib/fastlane/plugin/try_scan/helper/try_scan_runner.rb +38 -10
- data/lib/fastlane/plugin/try_scan/version.rb +1 -1
- metadata +16 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8dbabd07feebaef1f230a9c2afd3dd991a3a3de7
|
4
|
+
data.tar.gz: ed9495eec01b730ab3476c7c76ddd935fe573e6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8741546e7347f4f8f7e92c80c7543a9453b72e2a597f0a400168490e6e78709a31ebf99a196037021053bcae05cee765a0326a7d4847c06aed225cb0701b42c2
|
7
|
+
data.tar.gz: 331ac99fbcda25606b17ef06c19bb8f32227213ba146511f719b5dc94abcf6b5183c834fc1803e61ed95d662170b720ac27e9335f9d0b1870d6cf14453c42e69
|
data/README.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## Important Announcement ⚠️
|
2
|
+
|
3
|
+
**Xcode 13** provides test repetitions out of the box. For more details check out [WWDC21](https://developer.apple.com/videos/play/wwdc2021/10296).
|
4
|
+
|
5
|
+
---
|
6
|
+
|
1
7
|
# try_scan plugin
|
2
8
|
|
3
9
|
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-try_scan)
|
@@ -14,6 +20,9 @@ Under the hood `try_scan` uses official [`fastlane scan action`](https://docs.fa
|
|
14
20
|
| try_parallel | Should first run be executed in parallel? Equivalent to `-parallel-testing-enabled` | true |
|
15
21
|
| retry_parallel | Should subsequent runs be executed in parallel? Required `try_parallel: true` | true |
|
16
22
|
| parallel_workers | Specify the exact number of test runners that will be spawned during parallel testing. Equivalent to `-parallel-testing-worker-count` and `concurrent_workers` | |
|
23
|
+
| retry_build | Should building be retried after failure? | false |
|
24
|
+
| retry_strategy | What would you like to retry after failure: test, class or suite? | test |
|
25
|
+
| backup | Back up an output of each execution to a separate folder | false |
|
17
26
|
|
18
27
|
## Requirements
|
19
28
|
|
@@ -32,7 +41,10 @@ $ fastlane add_plugin try_scan
|
|
32
41
|
```ruby
|
33
42
|
try_scan(
|
34
43
|
workspace: "Example.xcworkspace",
|
35
|
-
|
36
|
-
try_count: 3
|
44
|
+
device: "iPhone 11 Pro Max",
|
45
|
+
try_count: 3,
|
46
|
+
parallel_workers: 2,
|
47
|
+
try_parallel: true,
|
48
|
+
retry_parallel: false
|
37
49
|
)
|
38
50
|
```
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Fastlane
|
2
2
|
module Actions
|
3
|
-
|
4
3
|
require 'json'
|
5
4
|
require 'fastlane/actions/scan'
|
6
5
|
require_relative '../helper/scan_helper'
|
@@ -66,6 +65,34 @@ module Fastlane
|
|
66
65
|
type: Integer,
|
67
66
|
is_string: false,
|
68
67
|
optional: true
|
68
|
+
),
|
69
|
+
FastlaneCore::ConfigItem.new(
|
70
|
+
key: :retry_build,
|
71
|
+
env_name: "FL_TRY_SCAN_RETRY_BUILD",
|
72
|
+
description: "Should building be retried after failure?",
|
73
|
+
is_string: false,
|
74
|
+
optional: true,
|
75
|
+
default_value: false
|
76
|
+
),
|
77
|
+
FastlaneCore::ConfigItem.new(
|
78
|
+
key: :retry_strategy,
|
79
|
+
env_name: "FL_TRY_SCAN_RETRY_STRATEGY",
|
80
|
+
description: "What would you like to retry after failure: test, class or suite?",
|
81
|
+
is_string: true,
|
82
|
+
optional: true,
|
83
|
+
default_value: 'test',
|
84
|
+
verify_block: proc do |strategy|
|
85
|
+
possible_strategies = ['test', 'class', 'suite']
|
86
|
+
UI.user_error!("Error: :retry_strategy must equal to one of the following values: #{possible_strategies}") unless possible_strategies.include?(strategy)
|
87
|
+
end
|
88
|
+
),
|
89
|
+
FastlaneCore::ConfigItem.new(
|
90
|
+
key: :backup,
|
91
|
+
env_name: "FL_TRY_SCAN_BACKUP",
|
92
|
+
description: "Back up an output of each execution to a separate folder",
|
93
|
+
is_string: false,
|
94
|
+
optional: true,
|
95
|
+
default_value: false
|
69
96
|
)
|
70
97
|
]
|
71
98
|
end
|
@@ -66,6 +66,27 @@ module TryScanManager
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
69
|
+
|
70
|
+
def self.backup_output_folder(attempt)
|
71
|
+
output_files = report_options.instance_variable_get(:@output_files)
|
72
|
+
output_directory = report_options.instance_variable_get(:@output_directory)
|
73
|
+
|
74
|
+
unless output_files.empty?
|
75
|
+
FastlaneCore::UI.verbose("Back up an output folder")
|
76
|
+
backup = "#{output_directory}_#{attempt}"
|
77
|
+
FileUtils.mkdir_p(backup)
|
78
|
+
FileUtils.copy_entry(output_directory, backup)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.clean_up_backup
|
83
|
+
output_directory = report_options.instance_variable_get(:@output_directory)
|
84
|
+
|
85
|
+
Dir["#{output_directory}_*"].each do |backup|
|
86
|
+
FastlaneCore::UI.verbose("Removing backup: #{backup}")
|
87
|
+
FileUtils.rm_rf(backup)
|
88
|
+
end
|
89
|
+
end
|
69
90
|
end
|
70
91
|
end
|
71
92
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module TryScanManager
|
2
2
|
class Runner
|
3
|
-
|
4
3
|
FastlaneScanHelper = TryScanManager::Helper::FastlaneScanHelper
|
5
4
|
|
6
5
|
def initialize(options = {})
|
@@ -12,6 +11,7 @@ module TryScanManager
|
|
12
11
|
def run
|
13
12
|
configure_xcargs
|
14
13
|
prepare_scan_config(@options)
|
14
|
+
FastlaneScanHelper.clean_up_backup
|
15
15
|
print_summary
|
16
16
|
@attempt = 1
|
17
17
|
begin
|
@@ -23,13 +23,14 @@ module TryScanManager
|
|
23
23
|
rescue FastlaneCore::Interface::FastlaneTestFailure => _
|
24
24
|
failed_tests = failed_tests_from_xcresult_report
|
25
25
|
print_try_scan_result(failed_tests_count: failed_tests.size)
|
26
|
+
backup_output_folder if @options[:backup]
|
26
27
|
return false if finish?
|
27
28
|
|
28
29
|
@attempt += 1
|
29
30
|
update_scan_options(failed_tests)
|
30
31
|
retry
|
31
32
|
rescue FastlaneCore::Interface::FastlaneBuildFailure => _
|
32
|
-
return false if finish?
|
33
|
+
return false if finish? || !@options[:retry_build]
|
33
34
|
|
34
35
|
@attempt += 1
|
35
36
|
retry
|
@@ -70,7 +71,7 @@ module TryScanManager
|
|
70
71
|
def print_try_scan_result(failed_tests_count: 0)
|
71
72
|
FastlaneCore::UI.important("TryScan: result after #{ordinalized_attempt} shot 👇")
|
72
73
|
FastlaneCore::PrintTable.print_values(
|
73
|
-
config: {"Number of tests" => tests_count_from_xcresult_report, "Number of failures" => failed_tests_count},
|
74
|
+
config: { "Number of tests" => tests_count_from_xcresult_report, "Number of failures" => failed_tests_count },
|
74
75
|
title: "Test Results"
|
75
76
|
)
|
76
77
|
end
|
@@ -112,14 +113,18 @@ module TryScanManager
|
|
112
113
|
@options[:build_for_testing] = nil
|
113
114
|
end
|
114
115
|
|
115
|
-
|
116
|
-
|
116
|
+
xcargs = []
|
117
|
+
if @options[:try_parallel]
|
118
|
+
xcargs << '-parallel-testing-enabled YES'
|
117
119
|
if @options[:parallel_workers] || @options[:concurrent_workers]
|
118
120
|
workers_count = [@options[:parallel_workers].to_i, @options[:concurrent_workers].to_i].max
|
119
121
|
xcargs << "-parallel-testing-worker-count #{workers_count}"
|
122
|
+
@options[:concurrent_workers] = nil
|
120
123
|
end
|
121
|
-
|
124
|
+
else
|
125
|
+
xcargs << '-parallel-testing-enabled NO'
|
122
126
|
end
|
127
|
+
@options[:xcargs] = "#{@options[:xcargs]} #{xcargs.join(' ')}"
|
123
128
|
end
|
124
129
|
|
125
130
|
def update_scan_options(failed_tests)
|
@@ -137,10 +142,22 @@ module TryScanManager
|
|
137
142
|
next if val.nil?
|
138
143
|
|
139
144
|
Scan.config.set(key, val)
|
140
|
-
FastlaneCore::UI.verbose("\tSetting #{key
|
145
|
+
FastlaneCore::UI.verbose("\tSetting #{key} to #{val}")
|
141
146
|
end
|
142
147
|
end
|
143
148
|
|
149
|
+
def retry_failed_test?
|
150
|
+
@options[:retry_strategy] == 'test'
|
151
|
+
end
|
152
|
+
|
153
|
+
def retry_failed_class?
|
154
|
+
@options[:retry_strategy] == 'class'
|
155
|
+
end
|
156
|
+
|
157
|
+
def retry_failed_suite?
|
158
|
+
@options[:retry_strategy] == 'suite'
|
159
|
+
end
|
160
|
+
|
144
161
|
def parse_xcresult_report
|
145
162
|
report_options = FastlaneScanHelper.report_options
|
146
163
|
output_directory = report_options.instance_variable_get(:@output_directory)
|
@@ -159,17 +176,28 @@ module TryScanManager
|
|
159
176
|
begin
|
160
177
|
test_class = test_path.split('.').first
|
161
178
|
test_name = test_path.split('.')[1].split('(').first
|
162
|
-
rescue
|
179
|
+
rescue
|
163
180
|
test_class = test_path.split('[')[1].split(' ').first
|
164
181
|
test_name = test_path.split(' ')[1].split(']').first
|
165
182
|
end
|
166
|
-
only_testing <<
|
183
|
+
only_testing <<
|
184
|
+
if retry_failed_test?
|
185
|
+
"#{suite_name}/#{test_class}/#{test_name}"
|
186
|
+
elsif retry_failed_class?
|
187
|
+
"#{suite_name}/#{test_class}"
|
188
|
+
elsif retry_failed_suite?
|
189
|
+
suite_name
|
190
|
+
end
|
167
191
|
end
|
168
|
-
only_testing
|
192
|
+
only_testing.uniq
|
169
193
|
end
|
170
194
|
|
171
195
|
def tests_count_from_xcresult_report
|
172
196
|
parse_xcresult_report['metrics']['testsCount']['_value']
|
173
197
|
end
|
198
|
+
|
199
|
+
def backup_output_folder
|
200
|
+
FastlaneScanHelper.backup_output_folder(@attempt)
|
201
|
+
end
|
174
202
|
end
|
175
203
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-try_scan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Alter-Pesotskiy
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -39,21 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec_junit_formatter
|
42
|
+
name: rake
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - ">="
|
@@ -67,19 +53,19 @@ dependencies:
|
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: fasterer
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- -
|
59
|
+
- - '='
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: 0.8.3
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- -
|
66
|
+
- - '='
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: 0.8.3
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rubocop
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,8 +122,8 @@ dependencies:
|
|
136
122
|
- - ">="
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: 2.144.0
|
139
|
-
description:
|
140
|
-
email:
|
125
|
+
description:
|
126
|
+
email: a.alterpesotskiy@mail.ru
|
141
127
|
executables: []
|
142
128
|
extensions: []
|
143
129
|
extra_rdoc_files: []
|
@@ -154,7 +140,7 @@ licenses:
|
|
154
140
|
- MIT
|
155
141
|
metadata:
|
156
142
|
allowed_push_host: https://rubygems.org
|
157
|
-
post_install_message:
|
143
|
+
post_install_message:
|
158
144
|
rdoc_options: []
|
159
145
|
require_paths:
|
160
146
|
- lib
|
@@ -169,8 +155,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
155
|
- !ruby/object:Gem::Version
|
170
156
|
version: '0'
|
171
157
|
requirements: []
|
172
|
-
|
173
|
-
|
158
|
+
rubyforge_project:
|
159
|
+
rubygems_version: 2.6.8
|
160
|
+
signing_key:
|
174
161
|
specification_version: 4
|
175
|
-
summary:
|
162
|
+
summary: The easiest way to retry your fastlane scan action
|
176
163
|
test_files: []
|