fastlane-plugin-try_scan 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
  SHA256:
3
- metadata.gz: f1cf8ffd4f2e1a0558797b6bdd7094d7b36f42306d28d10bea3172be11c42688
4
- data.tar.gz: c286e3609e7900a837322e36dc86ed3ead3a17fe0a32a3239a87de8feb8a742a
3
+ metadata.gz: 6423da17416a0d0718726d80c011463f8c11763bea4305c77db114fdca0bac98
4
+ data.tar.gz: a6650bda5beb09a03105ee929904c8c2b25b9df3faf69e4dbe3db9cccba97f90
5
5
  SHA512:
6
- metadata.gz: 27fea4e492a529eee6953d601914075b0042549345bfb4fc91e28bf0562fc514c943bbebdb929777c5973d863ec8b09795b9445e46c76cd3da142a14c42d08fa
7
- data.tar.gz: 12bab09a883ab80263e01a65b07ec9670df952a2800d1296a87688af7bf8736de240ebf35f05cf6f54df822d405cc3cf3c50f40b2c6ca3f908b0db69e1288d32
6
+ metadata.gz: e9e2661f541ba9b72aa57317e3d9b5cea705086b0360827cbd56722361bf1f56a480b23fdbcaad520070b2bdade410680af2ac6de2d3791cb3e77057d604f2a8
7
+ data.tar.gz: 22ced8f5d7bc59bfa915557f1febb8b9fdf46556feb555063210f15d6658f423f73d8fe79d9a2afc8b1182a0dafc4fcb0fb8efac6dfac0fabedca4edf58fa5f8
data/README.md CHANGED
@@ -2,36 +2,37 @@
2
2
 
3
3
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-try_scan)
4
4
 
5
+ ## About try_scan
6
+
7
+ The easiest way to rerun tests of your iOS and Mac app 🚀
8
+
9
+ Under the hood `try_scan` uses official [`fastlane scan action`](https://docs.fastlane.tools/actions/scan/), it means that you are able to provide any `scan` options and use `Scanfile` as before — everything will work like a charm, `try_scan` just brings couple of new amazing options:
10
+
11
+ | Option | Description | Default |
12
+ | ------- |------------ | ------- |
13
+ | try_count | Number of times to try to get your tests green | 1 |
14
+ | try_parallel | Should first run be executed in parallel? Equivalent to `-parallel-testing-enabled` | true |
15
+ | retry_parallel | Should subsequent runs be executed in parallel? Required `try_parallel: true` | true |
16
+ | 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` | |
17
+
18
+ ## Requirements
19
+
20
+ * Xcode 11.x or greater. Download it at the [Apple Developer - Downloads](https://developer.apple.com/downloads) or the [Mac App Store](https://apps.apple.com/us/app/xcode/id497799835?mt=12).
21
+
5
22
  ## Getting Started
6
23
 
7
- This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `try_scan`, add it to your project by running:
24
+ To get started with `try_scan`, add it to your project by running:
8
25
 
9
26
  ```bash
10
- fastlane add_plugin try_scan
27
+ $ fastlane add_plugin try_scan
11
28
  ```
12
29
 
13
- ## About try_scan
14
-
15
- Simple way to retry your scan action 🚀
16
-
17
30
  ## Usage
18
31
 
19
32
  ```ruby
20
33
  try_scan(
21
34
  workspace: "Example.xcworkspace",
22
- devices: ["iPhone 6s", "iPad Air"],
35
+ devices: ["iPhone 7", "iPad Air"],
23
36
  try_count: 3
24
37
  )
25
38
  ```
26
-
27
- ## Issues and Feedback
28
-
29
- For any other issues and feedback about this plugin, please submit it to this repository.
30
-
31
- ## Troubleshooting
32
-
33
- If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
34
-
35
- ## About _fastlane_
36
-
37
- _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -11,8 +11,7 @@ module Fastlane
11
11
  class TryScanAction < Action
12
12
  def self.run(params)
13
13
  if Helper.xcode_at_least?('11.0.0')
14
- prepare_scan_config(params.values)
15
- prepare_destination(params)
14
+ params[:destination] = [params[:destination]] if params[:destination] && !params[:destination].kind_of?(Array)
16
15
  success = TryScanManager::Runner.new(params.values).run
17
16
 
18
17
  raise FastlaneCore::UI.test_failure!('Tests have failed') if params[:fail_build] && !success
@@ -21,20 +20,6 @@ module Fastlane
21
20
  end
22
21
  end
23
22
 
24
- def self.prepare_scan_config(scan_options)
25
- Scan.config = FastlaneCore::Configuration.create(
26
- Fastlane::Actions::ScanAction.available_options,
27
- FastlaneScanHelper.scan_options_from_try_scan_options(scan_options)
28
- )
29
- end
30
-
31
- def self.prepare_destination(params)
32
- destination = params[:destination] || Scan.config[:destination] || []
33
- unless destination.kind_of?(Array)
34
- params[:destination] = Scan.config[:destination] = [destination]
35
- end
36
- end
37
-
38
23
  #####################################################
39
24
  # Documentation #
40
25
  #####################################################
@@ -52,10 +37,35 @@ module Fastlane
52
37
  FastlaneCore::ConfigItem.new(
53
38
  key: :try_count,
54
39
  env_name: "FL_TRY_SCAN_TRY_COUNT",
55
- description: "The number of times to retry running tests via scan",
40
+ description: "Number of times to try to get your tests green",
56
41
  type: Integer,
57
42
  is_string: false,
43
+ optional: true,
58
44
  default_value: 1
45
+ ),
46
+ FastlaneCore::ConfigItem.new(
47
+ key: :try_parallel,
48
+ env_name: "FL_TRY_SCAN_TRY_PARALLEL",
49
+ description: "Should first run be executed in parallel? Equivalent to -parallel-testing-enabled",
50
+ is_string: false,
51
+ optional: true,
52
+ default_value: true
53
+ ),
54
+ FastlaneCore::ConfigItem.new(
55
+ key: :retry_parallel,
56
+ env_name: "FL_TRY_SCAN_RETRY_PARALLEL",
57
+ description: "Should subsequent runs be executed in parallel? Required :try_parallel: true",
58
+ is_string: false,
59
+ optional: true,
60
+ default_value: true
61
+ ),
62
+ FastlaneCore::ConfigItem.new(
63
+ key: :parallel_workers,
64
+ env_name: "FL_TRY_SCAN_PARALLEL_WORKERS",
65
+ description: "Specify the exact number of test runners that will be spawned during parallel testing. Equivalent to -parallel-testing-worker-count and :concurrent_workers",
66
+ type: Integer,
67
+ is_string: false,
68
+ optional: true
59
69
  )
60
70
  ]
61
71
  end
@@ -65,7 +75,7 @@ module Fastlane
65
75
  end
66
76
 
67
77
  def self.is_supported?(platform)
68
- [:ios].include?(platform)
78
+ [:ios, :mac].include?(platform)
69
79
  end
70
80
  end
71
81
  end
@@ -6,13 +6,15 @@ module TryScanManager
6
6
  def initialize(options = {})
7
7
  @options = options
8
8
  @options[:try_count] = 1 if @options[:try_count] < 1
9
+ @options[:result_bundle] = true
9
10
  end
10
11
 
11
12
  def run
13
+ configure_xcargs
14
+ prepare_scan_config(@options)
12
15
  print_summary
13
16
  @attempt = 1
14
17
  begin
15
- essential_scan_config_updates
16
18
  warn_of_performing_attempts
17
19
  clear_preexisting_data
18
20
  Scan::Runner.new.run
@@ -86,12 +88,50 @@ module TryScanManager
86
88
  end
87
89
  end
88
90
 
91
+ def prepare_scan_config(scan_options)
92
+ Scan.config = FastlaneCore::Configuration.create(
93
+ Fastlane::Actions::ScanAction.available_options,
94
+ FastlaneScanHelper.scan_options_from_try_scan_options(scan_options)
95
+ )
96
+ end
97
+
98
+ def configure_xcargs
99
+ if @options[:xcargs]&.include?('-parallel-testing-enabled')
100
+ FastlaneCore::UI.important("TryScan overwrites `-parallel-testing-enabled` in :xcargs, use :try_parallel option instead")
101
+ @options[:xcargs].gsub!(/-parallel-testing-enabled(=|\s+)(YES|NO)/, '')
102
+ end
103
+
104
+ if @options[:xcargs]&.include?('-parallel-testing-worker-count')
105
+ FastlaneCore::UI.important("TryScan overwrites `-parallel-testing-worker-count` in :xcargs, use :concurrent_workers option instead")
106
+ @options[:xcargs].gsub!(/-parallel-testing-worker-count(=|\s+)(\d+)/, '')
107
+ end
108
+
109
+ if @options[:xcargs]&.include?('build-for-testing') || @options[:build_for_testing]
110
+ FastlaneCore::UI.important("TryScan rejects `build-for-testing` request, use it in a separate scan lane")
111
+ @options[:xcargs].slice!('build-for-testing')
112
+ @options[:build_for_testing] = nil
113
+ end
114
+
115
+ if @options[:try_parallel] && !@options[:disable_concurrent_testing]
116
+ xcargs = ['-parallel-testing-enabled YES']
117
+ if @options[:parallel_workers] || @options[:concurrent_workers]
118
+ workers_count = [@options[:parallel_workers].to_i, @options[:concurrent_workers].to_i].max
119
+ xcargs << "-parallel-testing-worker-count #{workers_count}"
120
+ end
121
+ @options[:xcargs] = "#{@options[:xcargs].to_s} #{xcargs.join(' ')}"
122
+ end
123
+ end
124
+
89
125
  def update_scan_options(failed_tests)
90
126
  scan_options = FastlaneScanHelper.scan_options_from_try_scan_options(@options)
91
127
  scan_options[:only_testing] = failed_tests
92
128
  scan_options[:skip_build] = true
93
- scan_options[:test_without_building] = true
94
129
  scan_options.delete(:skip_testing)
130
+ if @options[:try_parallel] && !@options[:retry_parallel]
131
+ scan_options[:xcargs].gsub!(/-parallel-testing-enabled(=|\s+)(YES|NO)/, '-parallel-testing-enabled NO')
132
+ scan_options[:xcargs].gsub!(/-parallel-testing-worker-count(=|\s+)(\d+)/, '')
133
+ end
134
+
95
135
  Scan.cache.clear
96
136
  scan_options.each do |key, val|
97
137
  next if val.nil?
@@ -101,12 +141,6 @@ module TryScanManager
101
141
  end
102
142
  end
103
143
 
104
- def essential_scan_config_updates
105
- Scan.config[:result_bundle] = true
106
- Scan.config[:build_for_testing] = nil if Scan.config[:build_for_testing]
107
- Scan.config[:xcargs].slice!('build-for-testing') if Scan.config[:xcargs]&.include?('build-for-testing')
108
- end
109
-
110
144
  def parse_xcresult_report
111
145
  report_options = FastlaneScanHelper.report_options
112
146
  output_directory = report_options.instance_variable_get(:@output_directory)
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TryScan
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-try_scan
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
  - Alexey Alter-Pesotskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-21 00:00:00.000000000 Z
11
+ date: 2020-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: pry
29
15
  requirement: !ruby/object:Gem::Requirement