fastlane-plugin-wpmreleasetoolkit 5.3.0 → 5.5.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
  SHA256:
3
- metadata.gz: 3a29c8bfbf5d7754cf59109a7dcf521efc91fab3b4314027db41f08a95390c7b
4
- data.tar.gz: c4abdb17c40e79e17ce13a630ac9496768364b479a2496aa26fd9e4c633cae0c
3
+ metadata.gz: 858fcaeb7ccaa13b2b3990d36aa1c9aa15f9f9cb90c7ee7bb6941442f2c97847
4
+ data.tar.gz: '067942032d28224600deae4333b427e3eda6af56d65fb83eefb5ef4e3c07b868'
5
5
  SHA512:
6
- metadata.gz: d1050f9832b07111a7a8c1740e3ec95c2d59372449b84d901d8ec97f01f1f2ab47abf1383f743569f77666f04d76440e4d167a5d02b1e457da788b67ff8088a8
7
- data.tar.gz: 8986d9c68fd931d1a384f8735b9d661bd7523fef0b88d18d0371379a61bbc3f25b6ede7b287d2b2b89dc6e2a315121a80324aacd1b127c64bdd996bc8e203fd8
6
+ metadata.gz: eb6a9f16072c66b7458d4a0787b300cdddd0d87ae99cc886ecc5d64a733d11f046a27c6167b7150fd73c358d9f6c3c85e03b10d4b5c76202fa5273560b5b523e
7
+ data.tar.gz: ca606aef9d929fe6ae3c1f821575e07fc4b672929b61ad7174a1f7e43dea8c2698ed63c696c62506beca226581f726fccadc01930e15b5e8088aa7908e2f0a6c
@@ -33,6 +33,7 @@ module Fastlane
33
33
  apk_path: params[:apk_path],
34
34
  test_apk_path: params[:test_apk_path],
35
35
  device: device,
36
+ test_targets: params[:test_targets],
36
37
  type: params[:type]
37
38
  )
38
39
 
@@ -106,6 +107,13 @@ module Fastlane
106
107
  UI.user_error!("Invalid test APK: #{value}") unless File.exist?(value)
107
108
  end
108
109
  ),
110
+ FastlaneCore::ConfigItem.new(
111
+ key: :test_targets,
112
+ description: 'A list of one or more test target filters to apply',
113
+ type: String,
114
+ optional: true,
115
+ default_value: nil
116
+ ),
109
117
  FastlaneCore::ConfigItem.new(
110
118
  key: :model,
111
119
  description: 'The device model to use to run the test',
@@ -58,7 +58,7 @@ module Fastlane
58
58
 
59
59
  def self.details
60
60
  # Optional:
61
- 'Creates a release and uploads the provided assets'
61
+ 'Given a file containing release notes and a version, extracts the notes for that version into a dedicated file.'
62
62
  end
63
63
 
64
64
  def self.available_options
@@ -19,14 +19,14 @@ module Fastlane
19
19
 
20
20
  params[:locales].each do |loc|
21
21
  if loc.is_a?(Array)
22
- puts "Downloading language: #{loc[1]}"
23
- complete_url = "#{params[:project_url]}#{loc[0]}/default/export-translations?filters[status]=current&format=json"
22
+ UI.message "Downloading language: #{loc[1]}"
23
+ complete_url = "#{params[:project_url]}#{loc[0]}/default/export-translations/?filters[status]=current&format=json"
24
24
  downloader.download(loc[1], complete_url, loc[1] == params[:source_locale])
25
25
  end
26
26
 
27
27
  if loc.is_a?(String)
28
- puts "Downloading language: #{loc}"
29
- complete_url = "#{params[:project_url]}#{loc}/default/export-translations?filters[status]=current&format=json"
28
+ UI.message "Downloading language: #{loc}"
29
+ complete_url = "#{params[:project_url]}#{loc}/default/export-translations/?filters[status]=current&format=json"
30
30
  downloader.download(loc, complete_url, loc == params[:source_locale])
31
31
  end
32
32
  end
@@ -33,7 +33,6 @@ module Fastlane
33
33
  raise
34
34
  end
35
35
 
36
- Action.sh('rake dependencies:pod:clean')
37
36
  other_action.cocoapods()
38
37
  end
39
38
 
@@ -291,6 +291,7 @@ module Fastlane
291
291
  uri.open(options) { |f| Nokogiri::XML(f.read.gsub("\t", ' '), nil, Encoding::UTF_8.to_s) }
292
292
  rescue StandardError => e
293
293
  UI.error "Error downloading #{locale} - #{e.message}"
294
+ retry if e.is_a?(OpenURI::HTTPError) && UI.confirm("Retry downloading `#{locale}`?")
294
295
  return nil
295
296
  end
296
297
  end
@@ -152,6 +152,7 @@ module Fastlane
152
152
  IO.copy_stream(uri.open(options), destination)
153
153
  rescue StandardError => e
154
154
  UI.error "Error downloading locale `#{locale}` — #{e.message} (#{uri})"
155
+ retry if e.is_a?(OpenURI::HTTPError) && UI.confirm("Retry downloading `#{locale}`?")
155
156
  return nil
156
157
  end
157
158
  end
@@ -16,12 +16,7 @@ module Fastlane
16
16
  def download(target_locale, glotpress_url, is_source)
17
17
  uri = URI(glotpress_url)
18
18
  response = Net::HTTP.get_response(uri)
19
- response = Net::HTTP.get_response(URI.parse(response.header['location'])) if response.code == '301'
20
-
21
- @alternates.clear
22
- loc_data = JSON.parse(response.body) rescue loc_data = nil
23
- parse_data(target_locale, loc_data, is_source)
24
- reparse_alternates(target_locale, loc_data, is_source) unless @alternates.length == 0
19
+ handle_glotpress_download(response: response, locale: target_locale, is_source: is_source)
25
20
  end
26
21
 
27
22
  # Parse JSON data and update the local files
@@ -100,6 +95,34 @@ module Fastlane
100
95
  def get_target_file_path(locale, file_name)
101
96
  "#{@target_folder}/#{locale}/#{file_name}"
102
97
  end
98
+
99
+ private
100
+
101
+ def handle_glotpress_download(response:, locale:, is_source:)
102
+ case response.code
103
+ when '200'
104
+ # All good, parse the result
105
+ UI.success("Successfully downloaded `#{locale}`.")
106
+ @alternates.clear
107
+ loc_data = JSON.parse(response.body) rescue loc_data = nil
108
+ parse_data(locale, loc_data, is_source)
109
+ reparse_alternates(target_locale, loc_data, is_source) unless @alternates.length == 0
110
+ when '301'
111
+ # Follow the redirect
112
+ UI.message("Received 301 for `#{locale}`. Following redirect...")
113
+ download(locale, response.header['location'], is_source)
114
+ when '429'
115
+ # We got rate-limited, offer to try again
116
+ if UI.confirm("Retry downloading `#{locale}` after receiving 429 from the API?")
117
+ download(locale, response.uri, is_source)
118
+ else
119
+ UI.error("Abandoning `#{locale}` download as requested.")
120
+ end
121
+ else
122
+ message = "Received unexpected #{response.code} from request to URI #{response.uri}."
123
+ UI.abort_with_message!(message) unless UI.confirm("#{message} Continue anyway?")
124
+ end
125
+ end
103
126
  end
104
127
  end
105
128
  end
@@ -20,20 +20,21 @@ module Fastlane
20
20
  # @param [FirebaseDevice] device The virtual device to run tests on.
21
21
  # @param [String] type The type of test to run.
22
22
  #
23
- def self.run_tests(project_id:, apk_path:, test_apk_path:, device:, type: 'instrumentation')
23
+ def self.run_tests(project_id:, apk_path:, test_apk_path:, device:, test_targets: nil, type: 'instrumentation')
24
24
  raise "Unable to find apk: #{apk_path}" unless File.file?(apk_path)
25
25
  raise "Unable to find apk: #{test_apk_path}" unless File.file?(test_apk_path)
26
26
  raise "Invalid Type: #{type}" unless VALID_TEST_TYPES.include?(type)
27
27
 
28
- command = Shellwords.join [
29
- 'gcloud', 'firebase', 'test', 'android', 'run',
30
- '--project', project_id,
31
- '--type', type,
32
- '--app', apk_path,
33
- '--test', test_apk_path,
34
- '--device', device.to_s,
35
- '--verbosity', 'info',
36
- ]
28
+ params = {
29
+ project: project_id,
30
+ type: type,
31
+ app: apk_path,
32
+ test: test_apk_path,
33
+ 'test-targets': test_targets,
34
+ device: device.to_s,
35
+ verbosity: 'info'
36
+ }.compact.flat_map { |k, v| ["--#{k}", v] }
37
+ command = Shellwords.join(['gcloud', 'firebase', 'test', 'android', 'run', *params])
37
38
 
38
39
  log_file_path = Fastlane::Actions.lane_context[:FIREBASE_TEST_LOG_FILE_PATH]
39
40
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Wpmreleasetoolkit
3
- VERSION = '5.3.0'
3
+ VERSION = '5.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-wpmreleasetoolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 5.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Automattic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-11 00:00:00.000000000 Z
11
+ date: 2022-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport