fastlane-plugin-android_reporter 0.1.28 → 0.1.33
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a4258c145bd5cdccc47f04bce44896d2e53b072c661442c6541fa4f8d719e4f
|
4
|
+
data.tar.gz: 0af6f30569fb8cbc194849295adb11e285beaed65971b8e6817aae2cd5306927
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6c4680f5188b2026e0642ba53848681be2e1edac86ca51aa6d603e6b2c4b67b3e6cc8b1dd23c9f43ee92eafdf04e8202d17b0d720569c837331655e5f6a1a5d
|
7
|
+
data.tar.gz: 3c9953eb4e494cda10b712bba5d32c34048fe4847419b2d49cfd5d19e3b0988641e5e8929590be4c31219bff6b3e50d82e44873e8b4dceb962d81f90db74150c
|
@@ -24,35 +24,9 @@ module Fastlane
|
|
24
24
|
isLogcatFileUploaded = false
|
25
25
|
isGradleDebugFileUploaded = false
|
26
26
|
isGradleErrorFileUploaded = false
|
27
|
+
buildName = "Current Build"
|
27
28
|
|
28
|
-
# 1.
|
29
|
-
if params[:is_delete_prev_files_enabled]
|
30
|
-
begin
|
31
|
-
File.open('logcat.txt', 'r') do |f|
|
32
|
-
File.delete(f)
|
33
|
-
end
|
34
|
-
rescue Errno::ENOENT
|
35
|
-
UI.message("Something Wrong When Delete Previus File [logcat.txt]")
|
36
|
-
end
|
37
|
-
|
38
|
-
begin
|
39
|
-
File.open('android-logs.txt', 'r') do |f|
|
40
|
-
File.delete(f)
|
41
|
-
end
|
42
|
-
rescue Errno::ENOENT
|
43
|
-
UI.message("Something Wrong When Delete Previus File [android-logs.txt]")
|
44
|
-
end
|
45
|
-
|
46
|
-
begin
|
47
|
-
File.open('android-error-logs.txt', 'r') do |f|
|
48
|
-
File.delete(f)
|
49
|
-
end
|
50
|
-
rescue Errno::ENOENT
|
51
|
-
UI.message("Something Wrong When Delete Previus File [android-error-logs.txt]")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
# 0. Checkout git to Current Branch to Run Tests on the Current Branch
|
29
|
+
# 1. Checkout git to Current Branch to Run Tests on the Current Branch
|
56
30
|
if params[:tests_branch_name].to_s.length > 0
|
57
31
|
begin
|
58
32
|
sh("git fetch")
|
@@ -62,7 +36,27 @@ module Fastlane
|
|
62
36
|
end
|
63
37
|
end
|
64
38
|
|
65
|
-
#
|
39
|
+
# 2. Get Build Version From Gradle.Props File
|
40
|
+
if params[:version_name_line_number].to_s.length > 0
|
41
|
+
UI.message("Step Read Version Name of the Build")
|
42
|
+
line_num = params[:version_name_line_number].to_i
|
43
|
+
text=File.open('gradle.properties').read
|
44
|
+
text.gsub!(/\r\n?/, "\n")
|
45
|
+
text.each_line.with_index do |line, index|
|
46
|
+
if (index + 1) == line_num
|
47
|
+
buildName = line
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# 3. Split The String and Get the Value Without Key
|
53
|
+
if params[:version_name_line_number].to_s.length > 0
|
54
|
+
buildName = buildName.split('=', -1)
|
55
|
+
buildName = buildName[1]
|
56
|
+
UI.message("Current Build Name : " + buildName)
|
57
|
+
end
|
58
|
+
|
59
|
+
# 4. Send Slack Message from Android Reporter Bot That Testing Task Has been Started ....
|
66
60
|
if is_slack_enabled
|
67
61
|
UI.message("Slack Messages Bot Started .... [Configuration Step]")
|
68
62
|
Slack.configure do |config|
|
@@ -75,6 +69,7 @@ module Fastlane
|
|
75
69
|
text: " ================================================================================== \n" +
|
76
70
|
" New UI Testing Task Started For Current Release : " + time + " \n " +
|
77
71
|
" Current Branch Build : " + sh("git rev-parse --abbrev-ref HEAD") +
|
72
|
+
" Current Build Version : " + buildName +
|
78
73
|
" ================================================================================== \n",
|
79
74
|
as_user: true
|
80
75
|
)
|
@@ -86,22 +81,26 @@ module Fastlane
|
|
86
81
|
end
|
87
82
|
end
|
88
83
|
|
89
|
-
#
|
90
|
-
#
|
84
|
+
# 5. List All Available AVD's in The Device
|
85
|
+
# 6. Run the Target AVD Name From Params
|
91
86
|
if params[:avd_name].to_s.length > 0
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
87
|
+
Thread.new do
|
88
|
+
UI.message("Android Reporting Started to Run AVD : (" + avd_name + ")")
|
89
|
+
sh(android_sdk_path + "/tools/bin/avdmanager", "list", "avd")
|
90
|
+
sh("cd", android_sdk_path)
|
91
|
+
sh(android_sdk_path + "/emulator/emulator", "-avd", avd_name)
|
92
|
+
end
|
96
93
|
end
|
97
94
|
|
98
|
-
#
|
95
|
+
# 7. Clear the Logcat Server Before Start
|
99
96
|
if params[:generate_adb_file]
|
100
|
-
|
97
|
+
Process.fork do
|
98
|
+
sh("adb logcat -c")
|
99
|
+
end
|
101
100
|
end
|
102
101
|
|
103
|
-
#
|
104
|
-
#
|
102
|
+
# 8. Start Clean Task with Target UI Task
|
103
|
+
# 9. If Gradle Task Success then Will Generate ADB Log File then Kill Server Connection inside ADB
|
105
104
|
begin
|
106
105
|
UI.message([
|
107
106
|
"Android Reporting Started to Run Gradle Testing Task ...",
|
@@ -118,17 +117,7 @@ module Fastlane
|
|
118
117
|
"Android Reporter Started to Save Logcat Logs From ADB Connection Server",
|
119
118
|
"ADB Reporting File : [logcat.txt]"
|
120
119
|
])
|
121
|
-
|
122
|
-
begin
|
123
|
-
sh("adb logcat -d > logcat.txt kill-server")
|
124
|
-
sh("adb kill-server")
|
125
|
-
rescue => error
|
126
|
-
if error
|
127
|
-
UI.error("Something Error with Logcat Debug Report File")
|
128
|
-
end
|
129
|
-
puts error.message
|
130
|
-
puts error.backtrace
|
131
|
-
end
|
120
|
+
sh("adb logcat -d > logcat.txt kill-server")
|
132
121
|
end
|
133
122
|
end
|
134
123
|
end
|
@@ -136,142 +125,142 @@ module Fastlane
|
|
136
125
|
rescue
|
137
126
|
UI.error("Gradle Task Finished With Error ...")
|
138
127
|
if params[:generate_adb_file]
|
139
|
-
|
140
|
-
|
141
|
-
rescue => error
|
142
|
-
if error
|
143
|
-
UI.error("Something Error with Logcat Error Report File")
|
144
|
-
end
|
145
|
-
puts error.message
|
146
|
-
puts error.backtrace
|
128
|
+
Process.fork do
|
129
|
+
sh("adb logcat -e > logcat.txt kill-server")
|
147
130
|
end
|
148
131
|
end
|
149
132
|
end
|
150
133
|
|
151
|
-
#
|
134
|
+
# 10. Generate Gradle Tasks (Failed and Success Files)
|
152
135
|
if params[:generate_gradle_files]
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
sh("./gradlew build > android-logs.txt 2> android-error-logs.txt -Dhttp.socketTimeout=60000 -Dhttp.connectionTimeout=60000 -Dorg.gradle.daemon.idletimeout=60000")
|
161
|
-
sh("./gradlew --stop")
|
162
|
-
rescue => error
|
163
|
-
if error
|
164
|
-
UI.error("Something Error with Generate Gradle Files")
|
165
|
-
end
|
166
|
-
puts error.message
|
167
|
-
puts error.backtrace
|
136
|
+
Process.fork do
|
137
|
+
sh("./gradlew build > android-logs.txt 2> android-error-logs.txt")
|
138
|
+
UI.message([
|
139
|
+
"Android Reporting Started to Generate Gradle Reports Files",
|
140
|
+
"Gradle Success Debug File : android-logs.txt",
|
141
|
+
"Gradle Failed Debug File : android-error-logs.txt"
|
142
|
+
])
|
168
143
|
end
|
169
144
|
end
|
170
145
|
|
171
|
-
#
|
146
|
+
# 11. Check Slack Option if Enabled or Not To Print The Message
|
172
147
|
if is_slack_enabled
|
173
148
|
UI.message("Slack Configuration Status : Started ...")
|
174
149
|
else
|
175
150
|
UI.message("Slack Configuration Status : Disabled ...")
|
176
151
|
end
|
177
152
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
UI.error("Something Error with Slack Upload File : [Step Upload Logcat.txt File to Slack]")
|
204
|
-
end
|
205
|
-
puts error.message
|
206
|
-
puts error.backtrace
|
207
|
-
end
|
208
|
-
|
209
|
-
begin
|
210
|
-
if(File.exist?("android-logs.txt"))
|
211
|
-
UI.message("android-logs.txt File exists ...")
|
212
|
-
client.files_upload(
|
213
|
-
channels: "#" + params[:slack_channel_name],
|
214
|
-
as_user: true,
|
215
|
-
file: Faraday::UploadIO.new('android-logs.txt', 'text/plain'),
|
216
|
-
title: "Android UI Testing (Gradle Debug File Result)",
|
217
|
-
filename: "android-logs.txt",
|
218
|
-
initial_comment: "Current UI Testing Build Result File Report [Gradle Debug Result]"
|
219
|
-
)
|
220
|
-
|
221
|
-
isGradleDebugFileUploaded = true
|
222
|
-
UI.message("Slack Step Upload [android-logs.txt]")
|
223
|
-
else
|
224
|
-
isGradleDebugFileUploaded = false
|
225
|
-
UI.error("File does not exist [android-logs.txt]")
|
226
|
-
end
|
227
|
-
rescue => error
|
228
|
-
if error
|
153
|
+
# 12. Upload Files to Slack if The Build Failed
|
154
|
+
if gradle_task_result == false
|
155
|
+
if is_slack_enabled
|
156
|
+
begin
|
157
|
+
UI.message("Slack Messages Bot Upload Files Tasks Started ....")
|
158
|
+
UI.message(__dir__)
|
159
|
+
if(File.exist?("logcat.txt"))
|
160
|
+
UI.message("logcat.txt File exists ...")
|
161
|
+
client.files_upload(
|
162
|
+
channels: "#" + params[:slack_channel_name],
|
163
|
+
as_user: true,
|
164
|
+
file: Faraday::UploadIO.new('logcat.txt', 'text/plain'),
|
165
|
+
title: "Android UI Testing (ADB Logcat Result)",
|
166
|
+
filename: "logcat.txt",
|
167
|
+
initial_comment: "Current UI Testing Build Result File Report [logcat.txt]"
|
168
|
+
)
|
169
|
+
|
170
|
+
isLogcatFileUploaded = true
|
171
|
+
UI.message("Slack Step Upload [logcat.txt]")
|
172
|
+
else
|
173
|
+
isLogcatFileUploaded = false
|
174
|
+
UI.error("File does not exist [logcat.txt]")
|
175
|
+
end
|
176
|
+
rescue => error
|
177
|
+
if error
|
229
178
|
UI.error("Something Error with Slack Upload File : [Step Upload Logcat.txt File to Slack]")
|
230
|
-
|
179
|
+
end
|
231
180
|
puts error.message
|
232
181
|
puts error.backtrace
|
233
|
-
|
182
|
+
end
|
234
183
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
184
|
+
begin
|
185
|
+
if(File.exist?("android-logs.txt"))
|
186
|
+
UI.message("android-logs.txt File exists ...")
|
187
|
+
client.files_upload(
|
188
|
+
channels: "#" + params[:slack_channel_name],
|
189
|
+
as_user: true,
|
190
|
+
file: Faraday::UploadIO.new('android-logs.txt', 'text/plain'),
|
191
|
+
title: "Android UI Testing (Gradle Debug File Result)",
|
192
|
+
filename: "android-logs.txt",
|
193
|
+
initial_comment: "Current UI Testing Build Result File Report [Gradle Debug Result]"
|
194
|
+
)
|
195
|
+
|
196
|
+
isGradleDebugFileUploaded = true
|
197
|
+
UI.message("Slack Step Upload [android-logs.txt]")
|
198
|
+
else
|
199
|
+
isGradleDebugFileUploaded = false
|
200
|
+
UI.error("File does not exist [android-logs.txt]")
|
201
|
+
end
|
202
|
+
rescue => error
|
203
|
+
if error
|
204
|
+
UI.error("Something Error with Slack Upload File : [Step Upload Logcat.txt File to Slack]")
|
205
|
+
end
|
206
|
+
puts error.message
|
207
|
+
puts error.backtrace
|
208
|
+
end
|
260
209
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
210
|
+
begin
|
211
|
+
if(File.exist?("android-error-logs.txt"))
|
212
|
+
UI.message("android-error-logs.txt File exists ...")
|
213
|
+
client.files_upload(
|
214
|
+
channels: "#" + params[:slack_channel_name],
|
215
|
+
as_user: true,
|
216
|
+
file: Faraday::UploadIO.new('android-error-logs.txt', 'text/plain'),
|
217
|
+
title: "Android UI Testing (Gradle Error File Result)",
|
218
|
+
filename: "android-error-logs.txt",
|
219
|
+
initial_comment: "Current UI Testing Build Result File Report [Gradle Error Result]"
|
220
|
+
)
|
221
|
+
|
222
|
+
isGradleErrorFileUploaded = true
|
223
|
+
UI.message("Slack Step Upload [android-error-logs.txt]")
|
224
|
+
else
|
225
|
+
isGradleErrorFileUploaded = false
|
226
|
+
UI.error("File does not exist [android-error-logs.txt]")
|
227
|
+
end
|
228
|
+
rescue => error
|
229
|
+
if error
|
230
|
+
UI.error("Something Error with Slack Upload File : [Step Upload Logcat.txt File to Slack]")
|
231
|
+
end
|
232
|
+
puts error.message
|
233
|
+
puts error.backtrace
|
234
|
+
end
|
265
235
|
|
266
|
-
|
267
|
-
slackFinalMessageContent
|
268
|
-
|
236
|
+
# 13. Send Message With Files Summery
|
237
|
+
slackFinalMessageContent = "Files Status : With Time : " + time + " : \n"
|
238
|
+
if isGradleDebugFileUploaded
|
239
|
+
slackFinalMessageContent += "Gradle Debug File Uploaded \n"
|
240
|
+
end
|
241
|
+
|
242
|
+
if isGradleErrorFileUploaded
|
243
|
+
slackFinalMessageContent += "Gradle Error File Uploaded \n"
|
244
|
+
end
|
245
|
+
|
246
|
+
if isLogcatFileUploaded
|
247
|
+
slackFinalMessageContent += "Logcat ADB Logging File Uploaded \n"
|
248
|
+
end
|
249
|
+
|
250
|
+
client.chat_postMessage(channel: "#" + params[:slack_channel_name], text: slackFinalMessageContent, as_user: true)
|
269
251
|
|
270
|
-
if isLogcatFileUploaded
|
271
|
-
slackFinalMessageContent += "Logcat ADB Logging File Uploaded \n"
|
272
252
|
end
|
273
253
|
|
274
|
-
|
254
|
+
end
|
255
|
+
|
256
|
+
# 14. If the Gradle Task Success Then Run Specific Lane Else Send Slack Message The Build Failed
|
257
|
+
if gradle_task_result
|
258
|
+
if params[:target_lane_name].to_s.length > 0
|
259
|
+
sh("fastlane", params[:target_lane_name])
|
260
|
+
end
|
261
|
+
else
|
262
|
+
UI.message("Gradle Task Result Failed ...")
|
263
|
+
client.chat_postMessage(channel: "#" + params[:slack_channel_name], text: "Gradle Testing Task Failed Logs File Should be Uploaded", as_user: true)
|
275
264
|
end
|
276
265
|
|
277
266
|
end
|
@@ -340,13 +329,6 @@ module Fastlane
|
|
340
329
|
optional: true,
|
341
330
|
type: Boolean
|
342
331
|
),
|
343
|
-
FastlaneCore::ConfigItem.new(
|
344
|
-
key: :is_delete_prev_files_enabled,
|
345
|
-
env_name: "ANDROID_GENERATED_PREV_FILES_ENABLED",
|
346
|
-
description: "",
|
347
|
-
optional: true,
|
348
|
-
type: Boolean
|
349
|
-
),
|
350
332
|
FastlaneCore::ConfigItem.new(
|
351
333
|
key: :slack_api_key,
|
352
334
|
env_name: "SLACK_API_TOKEN",
|
@@ -370,6 +352,22 @@ module Fastlane
|
|
370
352
|
optional: true,
|
371
353
|
type: String,
|
372
354
|
sensitive: true
|
355
|
+
),
|
356
|
+
FastlaneCore::ConfigItem.new(
|
357
|
+
key: :target_lane_name,
|
358
|
+
env_name: "TARGET_LANE_NAME",
|
359
|
+
description: "Target Lane Name To Execute Once Tests Task Successfully Built",
|
360
|
+
optional: true,
|
361
|
+
type: String,
|
362
|
+
sensitive: true
|
363
|
+
),
|
364
|
+
FastlaneCore::ConfigItem.new(
|
365
|
+
key: :version_name_line_number,
|
366
|
+
env_name: "VERSION_NAME_LINE_NUMBER",
|
367
|
+
description: "Target Lane Name To Execute Once Tests Task Successfully Built",
|
368
|
+
optional: true,
|
369
|
+
type: String,
|
370
|
+
sensitive: true
|
373
371
|
)
|
374
372
|
]
|
375
373
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-android_reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.33
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yazan Tarifi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|