fastlane-plugin-wpmreleasetoolkit 4.2.0 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_localize_libs_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_validate_lib_strings_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_preflight.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb +187 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotfix_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_send_app_size_metrics.rb +279 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb +15 -6
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_for_toolkit_updates_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/circleci_trigger_job_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/firebase_login.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_list_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/removebranchprotection_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setbranchprotection_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_apply_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_download_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_setup_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_validate_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_preflight.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_check_beta_deps.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_current_branch_is_hotfix.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_app_version.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_version.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotfix_prechecks.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_strings_files.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb +170 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_tag_build.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_validate_ci_build.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +2 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/app_size_metrics_helper.rb +95 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb +4 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_account.rb +19 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb +62 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_lab_result.rb +36 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_runner.rb +104 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit.rb +2 -2
- metadata +118 -81
@@ -0,0 +1,279 @@
|
|
1
|
+
require_relative '../../helper/app_size_metrics_helper'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class AndroidSendAppSizeMetricsAction < Action
|
6
|
+
# Keys used by the metrics payload
|
7
|
+
AAB_FILE_SIZE_KEY = 'AAB File Size'.freeze # value from `File.size` of the `.aab`
|
8
|
+
UNIVERSAL_APK_FILE_SIZE_KEY = 'Universal APK File Size'.freeze # value from `File.size` of the Universal `.apk`
|
9
|
+
UNIVERSAL_APK_SPLIT_NAME = 'Universal'.freeze # pseudo-name of the split representing the Universal `.apk`
|
10
|
+
APK_OPTIMIZED_FILE_SIZE_KEY = 'Optimized APK File Size'.freeze # value from `apkanalyzer apk file-size`
|
11
|
+
APK_OPTIMIZED_DOWNLOAD_SIZE_KEY = 'Download Size'.freeze # value from `apkanalyzer apk download-size`
|
12
|
+
|
13
|
+
def self.run(params)
|
14
|
+
# Check input parameters
|
15
|
+
api_url = URI(params[:api_url])
|
16
|
+
api_token = params[:api_token]
|
17
|
+
if (api_token.nil? || api_token.empty?) && !api_url.is_a?(URI::File)
|
18
|
+
UI.user_error!('An API token is required when using an `api_url` with a scheme other than `file://`')
|
19
|
+
end
|
20
|
+
if params[:aab_path].nil? && params[:universal_apk_path].nil?
|
21
|
+
UI.user_error!('You must provide at least an `aab_path` or an `universal_apk_path`, or both')
|
22
|
+
end
|
23
|
+
|
24
|
+
# Build the payload base
|
25
|
+
metrics_helper = Fastlane::Helper::AppSizeMetricsHelper.new(
|
26
|
+
Platform: 'Android',
|
27
|
+
'App Name': params[:app_name],
|
28
|
+
'App Version': params[:app_version_name],
|
29
|
+
'Version Code': params[:app_version_code],
|
30
|
+
'Product Flavor': params[:product_flavor],
|
31
|
+
'Build Type': params[:build_type],
|
32
|
+
Source: params[:source]
|
33
|
+
)
|
34
|
+
# Add AAB file size
|
35
|
+
metrics_helper.add_metric(name: AAB_FILE_SIZE_KEY, value: File.size(params[:aab_path])) unless params[:aab_path].nil?
|
36
|
+
# Add Universal APK file size
|
37
|
+
metrics_helper.add_metric(name: UNIVERSAL_APK_FILE_SIZE_KEY, value: File.size(params[:universal_apk_path])) unless params[:universal_apk_path].nil?
|
38
|
+
|
39
|
+
# Add optimized file and download sizes for each split `.apk` metrics to the payload if a `:include_split_sizes` is enabled
|
40
|
+
if params[:include_split_sizes]
|
41
|
+
apkanalyzer_bin = params[:apkanalyzer_binary] || find_apkanalyzer_binary!
|
42
|
+
unless params[:aab_path].nil?
|
43
|
+
generate_split_apks(aab_path: params[:aab_path]) do |apk|
|
44
|
+
split_name = File.basename(apk, '.apk')
|
45
|
+
add_apk_size_metrics(helper: metrics_helper, apkanalyzer_bin: apkanalyzer_bin, apk: apk, split_name: split_name)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
unless params[:universal_apk_path].nil?
|
49
|
+
add_apk_size_metrics(helper: metrics_helper, apkanalyzer_bin: apkanalyzer_bin, apk: params[:universal_apk_path], split_name: UNIVERSAL_APK_SPLIT_NAME)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Send the payload
|
54
|
+
metrics_helper.send_metrics(
|
55
|
+
to: api_url,
|
56
|
+
api_token: api_token,
|
57
|
+
use_gzip: params[:use_gzip_content_encoding]
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
#####################################################
|
62
|
+
# @!group Small helper methods
|
63
|
+
#####################################################
|
64
|
+
class << self
|
65
|
+
# @raise if `bundletool` can not be found in `$PATH`
|
66
|
+
def check_bundletool_installed!
|
67
|
+
Action.sh('command', '-v', 'bundletool', print_command: false, print_command_output: false)
|
68
|
+
rescue StandardError
|
69
|
+
UI.user_error!('`bundletool` is required to build the split APKs. Install it with `brew install bundletool`')
|
70
|
+
raise
|
71
|
+
end
|
72
|
+
|
73
|
+
# The path where the `apkanalyzer` binary was found, after searching it:
|
74
|
+
# - in priority in `$ANDROID_SDK_ROOT` (or `$ANDROID_HOME` for legacy setups), under `cmdline-tools/latest/bin/` or `cmdline-tools/tools/bin`
|
75
|
+
# - and falling back by trying to find it in `$PATH`
|
76
|
+
#
|
77
|
+
# @return [String,Nil] The path to `apkanalyzer`, or `nil` if it wasn't found in any of the above tested paths.
|
78
|
+
#
|
79
|
+
def find_apkanalyzer_binary
|
80
|
+
sdk_root = ENV['ANDROID_SDK_ROOT'] || ENV['ANDROID_HOME']
|
81
|
+
if sdk_root
|
82
|
+
pattern = File.join(sdk_root, 'cmdline-tools', '{latest,tools}', 'bin', 'apkanalyzer')
|
83
|
+
apkanalyzer_bin = Dir.glob(pattern).find { |path| File.executable?(path) }
|
84
|
+
end
|
85
|
+
apkanalyzer_bin || Action.sh('command', '-v', 'apkanalyzer', print_command_output: false) { |_| nil }
|
86
|
+
end
|
87
|
+
|
88
|
+
# The path where the `apkanalyzer` binary was found, after searching it:
|
89
|
+
# - in priority in `$ANDROID_SDK_ROOT` (or `$ANDROID_HOME` for legacy setups), under `cmdline-tools/latest/bin/` or `cmdline-tools/tools/bin`
|
90
|
+
# - and falling back by trying to find it in `$PATH`
|
91
|
+
#
|
92
|
+
# @return [String] The path to `apkanalyzer`
|
93
|
+
# @raise [FastlaneCore::Interface::FastlaneError] if it wasn't found in any of the above tested paths.
|
94
|
+
#
|
95
|
+
def find_apkanalyzer_binary!
|
96
|
+
apkanalyzer_bin = find_apkanalyzer_binary
|
97
|
+
UI.user_error!('Unable to find `apkanalyzer` executable in either `$PATH` or `$ANDROID_SDK_ROOT`. Make sure you installed the Android SDK Command-line Tools') if apkanalyzer_bin.nil?
|
98
|
+
apkanalyzer_bin
|
99
|
+
end
|
100
|
+
|
101
|
+
# Add the `file-size` and `download-size` values of an APK to the helper, as reported by the corresponding `apkanalyzer apk …` commands
|
102
|
+
#
|
103
|
+
# @param [Fastlane::Helper::AppSizeMetricsHelper] helper The helper to add the metrics to
|
104
|
+
# @param [String] apkanalyzer_bin The path to the `apkanalyzer` binary to use to extract those file and download sizes from the `.apk`
|
105
|
+
# @param [String] apk The path to the `.apk` file to extract the sizes from
|
106
|
+
# @param [String] split_name The name to use for the value of the `split` metadata key in the metrics being added
|
107
|
+
#
|
108
|
+
def add_apk_size_metrics(helper:, apkanalyzer_bin:, apk:, split_name:)
|
109
|
+
UI.message("[App Size Metrics] Computing file and download size of #{File.basename(apk)}...")
|
110
|
+
file_size = Action.sh(apkanalyzer_bin, 'apk', 'file-size', apk, print_command: false, print_command_output: false).chomp.to_i
|
111
|
+
download_size = Action.sh(apkanalyzer_bin, 'apk', 'download-size', apk, print_command: false, print_command_output: false).chomp.to_i
|
112
|
+
helper.add_metric(name: APK_OPTIMIZED_FILE_SIZE_KEY, value: file_size, metadata: { split: split_name })
|
113
|
+
helper.add_metric(name: APK_OPTIMIZED_DOWNLOAD_SIZE_KEY, value: download_size, metadata: { split: split_name })
|
114
|
+
end
|
115
|
+
|
116
|
+
# Generates all the split `.apk` files (typically one per device architecture) from a given `.aab` file, then yield for each apk produced.
|
117
|
+
#
|
118
|
+
# @note The split `.apk` files are generated in a temporary directory and are thus all deleted after each of them has been `yield`ed to the provided block.
|
119
|
+
# @param [String] aab_path The path to the `.aab` file to generate split `.apk` files for
|
120
|
+
# @yield [apk] Calls the provided block once for each split `.apk` that was generated from the `.aab`
|
121
|
+
# @yieldparam apk [String] The path to one of the split `.apk` temporary file generated from the `.aab`
|
122
|
+
#
|
123
|
+
def generate_split_apks(aab_path:, &block)
|
124
|
+
check_bundletool_installed!
|
125
|
+
UI.message("[App Size Metrics] Generating the various APK splits from #{aab_path}...")
|
126
|
+
Dir.mktmpdir('release-toolkit-android-app-size-metrics') do |tmp_dir|
|
127
|
+
Action.sh('bundletool', 'build-apks', '--bundle', aab_path, '--output-format', 'DIRECTORY', '--output', tmp_dir)
|
128
|
+
apks = Dir.glob('splits/*.apk', base: tmp_dir).map { |f| File.join(tmp_dir, f) }
|
129
|
+
UI.message("[App Size Metrics] Generated #{apks.length} APKs.")
|
130
|
+
apks.each(&block)
|
131
|
+
UI.message('[App Size Metrics] Done computing splits sizes.')
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
#####################################################
|
137
|
+
# @!group Documentation
|
138
|
+
#####################################################
|
139
|
+
|
140
|
+
def self.description
|
141
|
+
'Send Android app size metrics to our metrics server'
|
142
|
+
end
|
143
|
+
|
144
|
+
def self.details
|
145
|
+
<<~DETAILS
|
146
|
+
Send Android app size metrics to our metrics server.
|
147
|
+
|
148
|
+
See https://github.com/Automattic/apps-metrics for the API contract expected by the Metrics server you will send those metrics to.
|
149
|
+
|
150
|
+
Tip: If you provide a `file://` URL for the `api_url`, the action will write the payload on disk at the specified path instead of sending
|
151
|
+
the data to a endpoint over network. This can be useful e.g. to inspect the payload and debug it, or to store the metrics data as CI artefacts.
|
152
|
+
DETAILS
|
153
|
+
end
|
154
|
+
|
155
|
+
def self.available_options
|
156
|
+
[
|
157
|
+
FastlaneCore::ConfigItem.new(
|
158
|
+
key: :api_url,
|
159
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_API_URL',
|
160
|
+
description: 'The endpoint API URL to publish metrics to. (Note: you can also point to a `file://` URL to write the payload to a file instead)',
|
161
|
+
type: String,
|
162
|
+
optional: false
|
163
|
+
),
|
164
|
+
FastlaneCore::ConfigItem.new(
|
165
|
+
key: :api_token,
|
166
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_API_TOKEN',
|
167
|
+
description: 'The bearer token to call the API. Required, unless `api_url` is a `file://` URL',
|
168
|
+
type: String,
|
169
|
+
optional: true
|
170
|
+
),
|
171
|
+
FastlaneCore::ConfigItem.new(
|
172
|
+
key: :use_gzip_content_encoding,
|
173
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_USE_GZIP_CONTENT_ENCODING',
|
174
|
+
description: 'Specify that we should use `Content-Encoding: gzip` and gzip the body when sending the request',
|
175
|
+
type: FastlaneCore::Boolean,
|
176
|
+
default_value: true
|
177
|
+
),
|
178
|
+
FastlaneCore::ConfigItem.new(
|
179
|
+
key: :app_name,
|
180
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_APP_NAME',
|
181
|
+
description: 'The name of the app for which we are publishing metrics, to help filter by app in the dashboard',
|
182
|
+
type: String,
|
183
|
+
optional: false
|
184
|
+
),
|
185
|
+
FastlaneCore::ConfigItem.new(
|
186
|
+
key: :app_version_name,
|
187
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_APP_VERSION_NAME',
|
188
|
+
description: 'The version name of the app for which we are publishing metrics, to help filter by version in the dashboard',
|
189
|
+
type: String,
|
190
|
+
optional: false
|
191
|
+
),
|
192
|
+
FastlaneCore::ConfigItem.new(
|
193
|
+
key: :app_version_code,
|
194
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_APP_VERSION_CODE',
|
195
|
+
description: 'The version code of the app for which we are publishing metrics, to help filter by version in the dashboard',
|
196
|
+
type: Integer,
|
197
|
+
optional: true
|
198
|
+
),
|
199
|
+
FastlaneCore::ConfigItem.new(
|
200
|
+
key: :product_flavor,
|
201
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_PRODUCT_FLAVOR',
|
202
|
+
description: 'The product flavor for which we are publishing metrics, to help filter by flavor in the dashboard. E.g. `Vanilla`, `Jalapeno`, `Wasabi`',
|
203
|
+
type: String,
|
204
|
+
optional: true
|
205
|
+
),
|
206
|
+
FastlaneCore::ConfigItem.new(
|
207
|
+
key: :build_type,
|
208
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_BUILD_TYPE',
|
209
|
+
description: 'The build type for which we are publishing metrics, to help filter by build type in the dashboard. E.g. `Debug`, `Release`',
|
210
|
+
type: String,
|
211
|
+
optional: true
|
212
|
+
),
|
213
|
+
FastlaneCore::ConfigItem.new(
|
214
|
+
key: :source,
|
215
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_SOURCE',
|
216
|
+
description: 'The type of event at the origin of that build, to help filter data in the dashboard. E.g. `pr`, `beta`, `final-release`',
|
217
|
+
type: String,
|
218
|
+
optional: true
|
219
|
+
),
|
220
|
+
FastlaneCore::ConfigItem.new(
|
221
|
+
key: :aab_path,
|
222
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_AAB_PATH',
|
223
|
+
description: 'The path to the .aab to extract size information from',
|
224
|
+
type: String,
|
225
|
+
optional: true, # We can have `aab_path` only, or `universal_apk_path` only, or both (but not none)
|
226
|
+
verify_block: proc do |value|
|
227
|
+
UI.user_error!('You must provide an path to an existing `.aab` file') unless File.exist?(value)
|
228
|
+
end
|
229
|
+
),
|
230
|
+
FastlaneCore::ConfigItem.new(
|
231
|
+
key: :include_split_sizes,
|
232
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_INCLUDE_SPLIT_SIZES',
|
233
|
+
description: 'Indicate if we should use `bundletool` and `apkanalyzer` to also compute and send "split apk" sizes per architecture. ' \
|
234
|
+
+ 'Setting this to `true` adds a bit of extra time to generate the `.apk` and extract the data, but provides more detailed metrics',
|
235
|
+
type: FastlaneCore::Boolean,
|
236
|
+
default_value: true
|
237
|
+
),
|
238
|
+
FastlaneCore::ConfigItem.new(
|
239
|
+
key: :universal_apk_path,
|
240
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_UNIVERSAL_APK_PATH',
|
241
|
+
description: 'The path to the Universal `.apk` to extract size information from',
|
242
|
+
type: String,
|
243
|
+
optional: true, # We can have `aab_path` only, or `universal_apk_path` only, or both (but not none)
|
244
|
+
verify_block: proc do |value|
|
245
|
+
UI.user_error!('You must provide a path to an existing `.apk` file') unless File.exist?(value)
|
246
|
+
end
|
247
|
+
),
|
248
|
+
FastlaneCore::ConfigItem.new(
|
249
|
+
key: :apkanalyzer_binary,
|
250
|
+
env_name: 'FL_ANDROID_SEND_APP_SIZE_METRICS_APKANALYZER_BINARY',
|
251
|
+
description: 'The path to the `apkanalyzer` binary to use. If not provided explicitly, we will use `$PATH` and `$ANDROID_SDK_HOME` to try to find it',
|
252
|
+
type: String,
|
253
|
+
default_value: find_apkanalyzer_binary,
|
254
|
+
default_value_dynamic: true,
|
255
|
+
verify_block: proc do |value|
|
256
|
+
UI.user_error!('You must provide a path to an existing executable for `apkanalyzer`') unless File.executable?(value)
|
257
|
+
end
|
258
|
+
),
|
259
|
+
]
|
260
|
+
end
|
261
|
+
|
262
|
+
def self.return_type
|
263
|
+
:integer
|
264
|
+
end
|
265
|
+
|
266
|
+
def self.return_value
|
267
|
+
'The HTTP return code from the call. Expect a 201 when new metrics were received successfully and entries created in the database'
|
268
|
+
end
|
269
|
+
|
270
|
+
def self.authors
|
271
|
+
['Automattic']
|
272
|
+
end
|
273
|
+
|
274
|
+
def self.is_supported?(platform)
|
275
|
+
platform == :android
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
@@ -9,16 +9,18 @@ module Fastlane
|
|
9
9
|
pipeline_name = {
|
10
10
|
PIPELINE: params[:pipeline_file]
|
11
11
|
}
|
12
|
+
options = {
|
13
|
+
branch: params[:branch],
|
14
|
+
commit: params[:commit],
|
15
|
+
env: params[:environment].merge(pipeline_name),
|
16
|
+
message: params[:message]
|
17
|
+
}.compact # remove entries with `nil` values from the Hash, if any
|
12
18
|
|
13
19
|
client = Buildkit.new(token: params[:buildkite_token])
|
14
20
|
response = client.create_build(
|
15
21
|
params[:buildkite_organization],
|
16
22
|
params[:buildkite_pipeline],
|
17
|
-
|
18
|
-
branch: params[:branch],
|
19
|
-
commit: params[:commit],
|
20
|
-
env: params[:environment].merge(pipeline_name)
|
21
|
-
}
|
23
|
+
options
|
22
24
|
)
|
23
25
|
|
24
26
|
response.state == 'scheduled' ? UI.message('Done!') : UI.crash!("Failed to start job\nError: [#{response}]")
|
@@ -36,7 +38,7 @@ module Fastlane
|
|
36
38
|
[
|
37
39
|
FastlaneCore::ConfigItem.new(
|
38
40
|
key: :buildkite_token,
|
39
|
-
|
41
|
+
env_names: %w[BUILDKITE_TOKEN BUILDKITE_API_TOKEN],
|
40
42
|
description: 'Buildkite Personal Access Token',
|
41
43
|
type: String,
|
42
44
|
sensitive: true
|
@@ -64,6 +66,13 @@ module Fastlane
|
|
64
66
|
type: String,
|
65
67
|
default_value: 'HEAD'
|
66
68
|
),
|
69
|
+
FastlaneCore::ConfigItem.new(
|
70
|
+
key: :message,
|
71
|
+
description: 'A custom message to show for the build in Buildkite\'s UI',
|
72
|
+
type: String,
|
73
|
+
optional: true,
|
74
|
+
default_value: nil
|
75
|
+
),
|
67
76
|
FastlaneCore::ConfigItem.new(
|
68
77
|
key: :pipeline_file,
|
69
78
|
description: 'The name of the pipeline file in the project',
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class FirebaseLoginAction < Action
|
6
|
+
def self.run(params)
|
7
|
+
Fastlane::FirebaseAccount.activate_service_account_with_key_file(params[:key_file])
|
8
|
+
end
|
9
|
+
|
10
|
+
#####################################################
|
11
|
+
# @!group Documentation
|
12
|
+
#####################################################
|
13
|
+
def self.description
|
14
|
+
'Logs the local machine into Google Cloud using the provided key file'
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.details
|
18
|
+
description
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.available_options
|
22
|
+
[
|
23
|
+
FastlaneCore::ConfigItem.new(
|
24
|
+
key: :key_file,
|
25
|
+
description: 'The key file used to authorize with Google Cloud',
|
26
|
+
type: String,
|
27
|
+
verify_block: proc do |value|
|
28
|
+
UI.user_error!('The `:key_file` parameter is required') if value.empty?
|
29
|
+
UI.user_error!("No Google Cloud Key file found at: #{value}") unless File.exist?(value)
|
30
|
+
end
|
31
|
+
),
|
32
|
+
]
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.authors
|
36
|
+
['Automattic']
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.is_supported?(platform)
|
40
|
+
true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|