allure-report-publisher 0.5.1 → 0.5.2
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: 41262f49694d870733005c690d1384d2f95493efe3dd1f4af0f57bdf27871c51
|
4
|
+
data.tar.gz: c4c115289ce0ad2f21adc359b96e6c61d06534227086f9e18808568dfd8dae69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8da58fa175adce43b0e8a5a06d7ade6157b99ab8c31f566da1e9cfbc082ee89251da8ba54a3c9bcd37bef72e8554456fd17cb3eecedf839e7864270b6558f3ae
|
7
|
+
data.tar.gz: cdfeefbee4ebdf742614e664e0ab691977b0f5ce4445928ef219bc071a9d98c2410b2ac7b0f69a6a3dd634cf3f3f3731fbf8af7f2a5221279423900176bd84e5
|
@@ -29,26 +29,30 @@ module Publisher
|
|
29
29
|
urls_block.match?(DESCRIPTION_PATTERN)
|
30
30
|
end
|
31
31
|
|
32
|
-
#
|
32
|
+
# PR description with allure report urls
|
33
33
|
#
|
34
|
-
# @param [String]
|
34
|
+
# @param [String] pr_description
|
35
35
|
# @return [String]
|
36
36
|
def updated_pr_description(pr_description)
|
37
|
-
|
38
|
-
|
37
|
+
stripped_description = (pr_description || "").strip
|
38
|
+
|
39
|
+
return url_section(separator: false) if stripped_description == ""
|
40
|
+
return "#{pr_description}\n\n#{url_section}" unless pr_description.match?(DESCRIPTION_PATTERN)
|
39
41
|
|
40
42
|
job_entries = jobs_section(pr_description)
|
41
|
-
pr_description.
|
43
|
+
non_empty = stripped_description != pr_description.match(DESCRIPTION_PATTERN)[0]
|
44
|
+
pr_description.gsub(DESCRIPTION_PATTERN, url_section(job_entries: job_entries, separator: non_empty))
|
42
45
|
end
|
43
46
|
|
44
|
-
#
|
47
|
+
# Comment body with allure report urls
|
45
48
|
#
|
49
|
+
# @param [String] pr_comment
|
46
50
|
# @return [String]
|
47
51
|
def comment_body(pr_comment = nil)
|
48
|
-
return
|
52
|
+
return url_section(separator: false) unless pr_comment
|
49
53
|
|
50
54
|
job_entries = jobs_section(pr_comment)
|
51
|
-
|
55
|
+
url_section(job_entries: job_entries, separator: false)
|
52
56
|
end
|
53
57
|
|
54
58
|
attr_reader :report_url,
|
@@ -59,22 +63,6 @@ module Publisher
|
|
59
63
|
|
60
64
|
private
|
61
65
|
|
62
|
-
# Allure report url pr description
|
63
|
-
#
|
64
|
-
# @return [String]
|
65
|
-
def body(job_entries = job_entry)
|
66
|
-
@body ||= <<~BODY.strip
|
67
|
-
<!-- allure -->
|
68
|
-
---
|
69
|
-
#{heading}
|
70
|
-
|
71
|
-
<!-- jobs -->
|
72
|
-
#{job_entries}
|
73
|
-
<!-- jobs -->
|
74
|
-
<!-- allurestop -->
|
75
|
-
BODY
|
76
|
-
end
|
77
|
-
|
78
66
|
# Url section heading
|
79
67
|
#
|
80
68
|
# @return [String]
|
@@ -110,6 +98,24 @@ module Publisher
|
|
110
98
|
@job_entry_pattern ||= /<!-- #{build_name} -->\n([\s\S]+)\n<!-- #{build_name} -->/
|
111
99
|
end
|
112
100
|
|
101
|
+
# Allure report url section
|
102
|
+
#
|
103
|
+
# @return [String]
|
104
|
+
def url_section(job_entries: job_entry, separator: true)
|
105
|
+
reports = <<~BODY.strip
|
106
|
+
<!-- allure -->
|
107
|
+
---
|
108
|
+
#{heading}
|
109
|
+
|
110
|
+
<!-- jobs -->
|
111
|
+
#{job_entries}
|
112
|
+
<!-- jobs -->
|
113
|
+
<!-- allurestop -->
|
114
|
+
BODY
|
115
|
+
|
116
|
+
separator ? reports : reports.gsub("---\n", "")
|
117
|
+
end
|
118
|
+
|
113
119
|
# Return updated jobs section
|
114
120
|
#
|
115
121
|
# @param [String] urls
|
@@ -120,14 +126,6 @@ module Publisher
|
|
120
126
|
|
121
127
|
"#{jobs}\n#{job_entry}"
|
122
128
|
end
|
123
|
-
|
124
|
-
# Strip separator from allure results section
|
125
|
-
#
|
126
|
-
# @param [String] body
|
127
|
-
# @return [String]
|
128
|
-
def strip_separator(body)
|
129
|
-
body.gsub("---\n", "")
|
130
|
-
end
|
131
129
|
end
|
132
130
|
end
|
133
131
|
end
|