Skip to content

Commit 7fb391d

Browse files
committed
Add source metadata/ConfigItem and reorder metas
1 parent 49b0342 commit 7fb391d

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ def self.run(params)
1414

1515
# Build the payload base
1616
payload = Fastlane::WPMRT::AppSizeMetricsPayload.new(
17+
'Platform': 'iOS',
1718
'App Name': params[:app_name],
18-
'Build Type': params[:build_type],
1919
'App Version': params[:app_version],
20-
'Platform': 'iOS'
20+
'Build Type': params[:build_type],
21+
'Source': params[:source],
2122
)
2223
payload.add_metric(name: 'File Size', value: File.size(params[:ipa_path]))
2324

@@ -100,19 +101,26 @@ def self.available_options
100101
type: String,
101102
optional: false
102103
),
104+
FastlaneCore::ConfigItem.new(
105+
key: :app_version,
106+
env_name: 'FL_IOS_SEND_APP_SIZE_METRICS_APP_VERSION',
107+
description: 'The version of the app for which we are publishing metrics, to help filter by app in the dashboard',
108+
type: String,
109+
optional: false
110+
),
103111
FastlaneCore::ConfigItem.new(
104112
key: :build_type,
105113
env_name: 'FL_IOS_SEND_APP_SIZE_METRICS_BUILD_TYPE',
106-
description: 'The build type for which we are publishing metrics, to help filter by app in the dashboard. Typically one of: `pr`, `beta`, `release`',
114+
description: 'The build configuration for which we are publishing metrics, to help filter by app in the dashboard. E.g. `Debug`, `Release`',
107115
type: String,
108-
optional: false
116+
optional: true
109117
),
110118
FastlaneCore::ConfigItem.new(
111-
key: :app_version,
112-
env_name: 'FL_IOS_SEND_APP_SIZE_METRICS_APP_VERSION',
113-
description: 'The version of the app for which we are publishing metrics, to help filter by app in the dashboard',
119+
key: :source,
120+
env_name: 'FL_IOS_SEND_APP_SIZE_METRICS_SOURCE',
121+
description: 'The type of build at the origin of that build, to help filter by app in the dashboard. E.g. `pr`, `beta`, `final-release`',
114122
type: String,
115-
optional: false
123+
optional: true
116124
),
117125
FastlaneCore::ConfigItem.new(
118126
key: :ipa_path,

spec/ios_send_app_size_metrics_spec.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ def test_app_size_action(fake_ipa_size:, expected_json:, **other_action_args)
5454
it 'sends the right payload from just an ipa file' do
5555
expected_json = {
5656
meta: [
57+
{ name: 'Platform', value: 'iOS' },
5758
{ name: 'App Name', value: 'my-app' },
58-
{ name: 'Build Type', value: 'beta' },
5959
{ name: 'App Version', value: '1.2.3' },
60-
{ name: 'Platform', value: 'iOS' },
60+
{ name: 'Build Type', value: 'beta' },
61+
{ name: 'Source', value: 'unit-test' },
6162
],
6263
metrics: [
6364
{ name: 'File Size', value: 123_456 },
@@ -69,7 +70,8 @@ def test_app_size_action(fake_ipa_size:, expected_json:, **other_action_args)
6970
expected_json: expected_json,
7071
app_name: 'my-app',
7172
build_type: 'beta',
72-
app_version: '1.2.3'
73+
app_version: '1.2.3',
74+
source: 'unit-test'
7375
)
7476
end
7577

spec/test-data/app_size_metrics/ios-metrics-payload.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"meta": [
33
{
4-
"name": "App Name",
5-
"value": "wordpress"
4+
"name": "Platform",
5+
"value": "iOS"
66
},
77
{
8-
"name": "Build Type",
9-
"value": "internal"
8+
"name": "App Name",
9+
"value": "wordpress"
1010
},
1111
{
1212
"name": "App Version",
1313
"value": "19.8.0.2"
1414
},
1515
{
16-
"name": "Platform",
17-
"value": "iOS"
16+
"name": "Build Type",
17+
"value": "internal"
1818
}
1919
],
2020
"metrics": [

0 commit comments

Comments
 (0)