fastlane-plugin-android_testlab_script_swit 0.1.933 → 0.1.934

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: 98327db5dc73a4fcfd461f5a436ca9b449fe7e94dd41b01655782acd0c146c3f
4
- data.tar.gz: ed4b920cb831ff2ba7319e0c4d757249967800359dff30faac6156a7905ff0a8
3
+ metadata.gz: 579b713c5bf62659dff113faaa2b1600e0e287a60df2769201118c67daba9387
4
+ data.tar.gz: b638242e6863d0577879d93408cff3721c06e09a9a24f7fa99c58d3a640f317b
5
5
  SHA512:
6
- metadata.gz: 72bb8822e1da662b01a72aefb36cd03753a8f59d5b7ebc85f793693a707564eec78a103d0cee0ea979c47b8c75548257758e760b4643c89953fc4d27962feef9
7
- data.tar.gz: 2060b04b4189f035665cfc24a0c4019f24630b1886515748973a8854a72ac5e2095ae3f041a62909014e474862d9dccdeb63426f3a7b25f3be530e014985fba5
6
+ metadata.gz: be110cfae9d3e8345bd1322f34b6672b0ea5d651c072b07d7121fa0fdd5a76b31a96064a5cc652f1f890f126c5d87d523c54338de75e35e44cc17e9db337ca55
7
+ data.tar.gz: 5f18864b2b3f364b935bd21acb246e53a703fd488013a82f8e4a9859e37bda1c1ee1c205c6b1080db88a233b1905ef04efb3c929cea31148c8d0c55796c8ecab
@@ -7,16 +7,6 @@ require 'httparty'
7
7
  module Fastlane
8
8
  module Actions
9
9
  class AndroidTestlabScriptSwitAction < Action
10
-
11
- def self.measure_time
12
- start_time = Time.now
13
- yield
14
- end_time = Time.now
15
- duration_sec_total = (end_time - start_time).round(1)
16
- duration_min = (duration_sec_total / 60).round(1)
17
- duration_sec = duration_sec_total % 60
18
- return "총 #{duration_min}분 테스트"
19
- end
20
10
 
21
11
  # actions run
22
12
  def self.run(params)
@@ -24,99 +14,44 @@ module Fastlane
24
14
  UI.message("Start Action")
25
15
  UI.message("********************************")
26
16
 
27
- # TestLab 작업 작업 소요시간 측정
28
- duration = measure_time do
29
-
30
- # Result Bucket & Dir
31
- results_bucket = params[:firebase_test_lab_results_bucket] || "#{params[:project_id]}_test_results"
32
- results_dir = params[:firebase_test_lab_results_dir] || "firebase_test_result_#{DateTime.now.strftime('%Y-%m-%d-%H:%M:%S')}"
17
+ # Result Bucket & Dir
18
+ results_bucket = params[:firebase_test_lab_results_bucket] || "#{params[:project_id]}_test_results"
19
+ results_dir = params[:firebase_test_lab_results_dir] || "firebase_test_result_#{DateTime.now.strftime('%Y-%m-%d-%H:%M:%S')}"
33
20
 
34
- # Set Target Project ID
35
- Helper.config(params[:project_id])
21
+ # Set Target Project ID
22
+ Helper.config(params[:project_id])
36
23
 
37
- # Activate service account
38
- Helper.authenticate(params[:gcloud_key_file])
24
+ # Activate service account
25
+ Helper.authenticate(params[:gcloud_key_file])
39
26
 
40
- # RoboScriptOption
41
- robo_script_option = params[:robo_script_path].nil? ? "" : "--robo-script #{params[:robo_script_path]} "
42
-
43
- # Run Firebase Test Lab
44
- Helper.run_tests(params[:gcloud_components_channel], "--type #{params[:type]} "\
45
- "--app #{params[:app_apk]} "\
46
- "#{"--test #{params[:app_test_apk]} " unless params[:app_test_apk].nil?}"\
47
- "#{"--use-orchestrator " if params[:type] == "instrumentation" && params[:use_orchestrator]}"\
48
- "#{params[:devices].map { |d| "--device model=#{d[:model]},version=#{d[:version]},locale=#{d[:locale]},orientation=#{d[:orientation]} " }.join}"\
49
- "--timeout #{params[:timeout]} "\
50
- "--results-bucket #{results_bucket} "\
51
- "--results-dir #{results_dir} "\
52
- "#{params[:extra_options]} "\
53
- "#{robo_script_option}"\
54
- "--format=json 1>#{Helper.if_need_dir(params[:console_log_file_name])}"
55
- )
56
-
57
- # Fetch results
58
- download_dir = params[:download_dir]
59
- if download_dir
60
- UI.message("Fetch results from Firebase Test Lab results bucket")
61
- json.each do |status|
62
- axis = status["axis_value"]
63
- Helper.if_need_dir("#{download_dir}/#{axis}")
64
- Helper.copy_from_gcs("#{results_bucket}/#{results_dir}/#{axis}", download_dir)
65
- Helper.set_public("#{results_bucket}/#{results_dir}/#{axis}")
66
- end
67
- end
68
-
69
- end
27
+ # RoboScriptOption
28
+ robo_script_option = params[:robo_script_path].nil? ? "" : "--robo-script #{params[:robo_script_path]} "
70
29
 
71
- # Swit Result PayLoad
72
- swit_device_payload = ""
73
-
74
- # Swit Send PayLoad - 테스트 시간 추가
75
- swit_webhook_payload = params[:swit_webhook_payload][0..-5] + ','
76
- swit_device_payload += "{\"type\":\"rt_section\",\"indent\":1,\"elements\":[{\"type\":\"rt_text\",\"content\":\"테스트 시간 : \"},{\"type\":\"rt_text\",\"content\":\"#{duration}\",\"styles\":{\"bold\":true}}]},"
77
-
78
- # Firebase Test Lab Result Json
79
- resultJson = File.read(params[:console_log_file_name])
80
-
81
- swit_device_payload = resultJson.map.with_index do |item, device_index|
82
- axis_value_parts = item["axis_value"].split('-')
83
- outcome = item["outcome"]
84
-
85
- model = axis_value_parts[0]
86
- version = axis_value_parts[1]
87
- locale = axis_value_parts[2]
88
- orientation = axis_value_parts[3]
89
-
90
- # 디바이스 정보
91
- device_payload =
92
- "[{\"type\":\"rt_section\",\"indent\":1,\"elements\":[{\"type\":\"rt_text\",\"content\":\"#{model}\"}]}, " +
93
- "{\"type\":\"rt_section\",\"indent\":2,\"elements\":[{\"type\":\"rt_text\", \"content\": \"OS: #{version} / Locale: #{locale} / Orientation: #{orientation}\"}]}, "
94
-
95
- # 성공 여부
96
- if outcome == 'Passed'
97
- device_payload +=
98
- "{\"type\":\"rt_section\",\"elements\":[{\"type\":\"rt_text\",\"content\":\"결과 : \"},{\"type\":\"rt_emoji\",\"name\":\":tada:\"},{\"type\":\"rt_text\",\"content\":\" Passed \"},{\"type\":\"rt_emoji\",\"name\":\":tada:\"}]}"
99
- elsif outcome == 'Failed'
100
- device_payload +=
101
- "{\"type\":\"rt_section\",\"elements\":[{\"type\":\"rt_text\",\"content\":\"결과 : \"},{\"type\":\"rt_emoji\",\"name\":\":interrobang:\"},{\"type\":\"rt_text\",\"content\":\" Failed \"},{\"type\":\"rt_emoji\",\"name\": \":interrobang:\"}]}"
102
- else # Skip or other outcomes
103
- device_payload +=
104
- "{\"type\":\"rt_section\",\"elements\":[{\"type\":{\"name\": \":bulb:\"}},{\"text\":{\"content\": \" Skipped or other outcomes \"}}, {\"emoji\":{\"name\": \":bulb:\"}}]}"
105
- end
106
-
107
- device_payload += "]"
108
-
109
- end.join(',')
110
-
111
- swit_device_payload.chomp!(',')
112
-
113
- # Swit PayLoad 병합
114
- swit_webhook_payload += swit_device_payload + ']}]}'
30
+ # Run Firebase Test Lab
31
+ Helper.run_tests(params[:gcloud_components_channel], "--type #{params[:type]} "\
32
+ "--app #{params[:app_apk]} "\
33
+ "#{"--test #{params[:app_test_apk]} " unless params[:app_test_apk].nil?}"\
34
+ "#{"--use-orchestrator " if params[:type] == "instrumentation" && params[:use_orchestrator]}"\
35
+ "#{params[:devices].map { |d| "--device model=#{d[:model]},version=#{d[:version]},locale=#{d[:locale]},orientation=#{d[:orientation]} " }.join}"\
36
+ "--timeout #{params[:timeout]} "\
37
+ "--results-bucket #{results_bucket} "\
38
+ "--results-dir #{results_dir} "\
39
+ "#{params[:extra_options]} "\
40
+ "#{robo_script_option}"\
41
+ "--format=json 1>#{Helper.if_need_dir(params[:console_log_file_name])}"
42
+ )
115
43
 
116
- UI.message(swit_webhook_payload)
117
-
118
- # Swit WebHook
119
- HTTParty.post(params[:swit_webhook_url], body: { body_text: swit_webhook_payload }.to_json, headers: { 'Content-Type' => 'application/json' })
44
+ # Fetch results
45
+ download_dir = params[:download_dir]
46
+ if download_dir
47
+ UI.message("Fetch results from Firebase Test Lab results bucket")
48
+ json.each do |status|
49
+ axis = status["axis_value"]
50
+ Helper.if_need_dir("#{download_dir}/#{axis}")
51
+ Helper.copy_from_gcs("#{results_bucket}/#{results_dir}/#{axis}", download_dir)
52
+ Helper.set_public("#{results_bucket}/#{results_dir}/#{axis}")
53
+ end
54
+ end
120
55
 
121
56
  UI.message("********************************")
122
57
  UI.message("Finish Action")
@@ -215,20 +150,6 @@ module Fastlane
215
150
  type: String,
216
151
  optional: false),
217
152
 
218
- # swit_webhook url (false)
219
- FastlaneCore::ConfigItem.new(key: :swit_webhook_url,
220
- env_name: "SWIT_WEBHOOK_URL",
221
- description: "The Swit WebHOOK URL",
222
- type: String,
223
- optional: true),
224
-
225
- # swit_webhook payload (false)
226
- FastlaneCore::ConfigItem.new(key: :swit_webhook_payload,
227
- env_name: "SWIT_WEBHOOK_PAYLOAD",
228
- description: "The Swit WebHOOK PAYLOAD",
229
- type: String,
230
- optional: true),
231
-
232
153
  # test apk (false)
233
154
  FastlaneCore::ConfigItem.new(key: :app_test_apk,
234
155
  env_name: "APP_TEST_APK",
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AndroidTestlabScriptSwit
3
- VERSION = "0.1.933"
3
+ VERSION = "0.1.934"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-android_testlab_script_swit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.933
4
+ version: 0.1.934
5
5
  platform: ruby
6
6
  authors:
7
7
  - 나비이쁜이
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-29 00:00:00.000000000 Z
11
+ date: 2023-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler