allure-report-publisher 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/allure_report_publisher/commands/upload.rb +12 -3
- data/lib/allure_report_publisher/lib/providers/_provider.rb +9 -9
- data/lib/allure_report_publisher/lib/providers/github.rb +7 -7
- data/lib/allure_report_publisher/lib/providers/gitlab.rb +7 -7
- data/lib/allure_report_publisher/lib/report_generator.rb +4 -7
- data/lib/allure_report_publisher/lib/uploaders/_uploader.rb +58 -46
- data/lib/allure_report_publisher/lib/uploaders/gcs.rb +1 -1
- data/lib/allure_report_publisher/lib/uploaders/s3.rb +1 -1
- data/lib/allure_report_publisher/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be6f833714e1ff2ad413a9b5148cebd6454b23db763f567586b9e91222513524
|
4
|
+
data.tar.gz: 6984e37c220f693288037522a86716079f3a235634c3ccbdd360056fd186f83c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d11ad18cdfb6c1955e521d8aae653b823f5defcfae4b095ae27f9bc9d1d0c89bca0336ab647c543b4c5d2cb92d2bffcd2c23343266b254aa1331984ac02abae9
|
7
|
+
data.tar.gz: 023da790f7233de7da68520ea85e2e0388e6c840d3950ba004118a754f46d4c2c0c4570c76ca29add86cf97cc0dc40d859094df430627f4cf57316df89df6bf7
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
[](https://rubygems.org/gems/allure-report-publisher)
|
2
2
|
[](https://hub.docker.com/r/andrcuns/allure-report-publisher)
|
3
3
|

|
4
|
+
[](http://allure-reports-andrcuns.s3.amazonaws.com/allure-report-publisher/refs/heads/main/index.html)
|
4
5
|
[](https://codeclimate.com/github/andrcuns/allure-report-publisher/maintainability)
|
5
6
|
[](https://codeclimate.com/github/andrcuns/allure-report-publisher/test_coverage)
|
6
7
|
|
@@ -42,9 +42,18 @@ module Publisher
|
|
42
42
|
validate_result_files(args[:results_glob])
|
43
43
|
Helpers.pastel(force_color: args[:color] || nil)
|
44
44
|
|
45
|
-
uploaders(args[:type])
|
46
|
-
|
47
|
-
|
45
|
+
uploader = uploaders(args[:type]).new(**args.slice(:results_glob, :bucket, :prefix, :copy_latest, :update_pr))
|
46
|
+
|
47
|
+
log("Generating allure report")
|
48
|
+
Spinner.spin("generating") { uploader.generate_report }
|
49
|
+
|
50
|
+
log("Uploading allure report to #{args[:type]}")
|
51
|
+
Spinner.spin("uploading") { uploader.upload }
|
52
|
+
uploader.report_urls.each { |k, v| log("#{k}: #{v}", :green) }
|
53
|
+
return unless args[:update_pr] && uploader.pr?
|
54
|
+
|
55
|
+
log("Updating pull request description")
|
56
|
+
Spinner.spin("updating", exit_on_error: false) { uploader.add_url_to_pr }
|
48
57
|
end
|
49
58
|
|
50
59
|
private
|
@@ -52,12 +52,19 @@ module Publisher
|
|
52
52
|
update_pr_description("#{pr_description}\n\n#{description_template}".strip)
|
53
53
|
end
|
54
54
|
|
55
|
+
# :nocov:
|
56
|
+
|
57
|
+
# Pull request run
|
58
|
+
#
|
59
|
+
# @return [Boolean]
|
60
|
+
def pr?
|
61
|
+
raise("Not implemented!")
|
62
|
+
end
|
63
|
+
|
55
64
|
private
|
56
65
|
|
57
66
|
attr_reader :results_path, :report_url
|
58
67
|
|
59
|
-
# :nocov:
|
60
|
-
|
61
68
|
# Get executor info
|
62
69
|
#
|
63
70
|
# @return [Hash]
|
@@ -65,13 +72,6 @@ module Publisher
|
|
65
72
|
raise("Not implemented!")
|
66
73
|
end
|
67
74
|
|
68
|
-
# Pull request run
|
69
|
-
#
|
70
|
-
# @return [Boolean]
|
71
|
-
def pr?
|
72
|
-
raise("Not implemented!")
|
73
|
-
end
|
74
|
-
|
75
75
|
# Current pull request description
|
76
76
|
#
|
77
77
|
# @return [String]
|
@@ -12,6 +12,13 @@ module Publisher
|
|
12
12
|
@run_id ||= ENV["GITHUB_RUN_ID"]
|
13
13
|
end
|
14
14
|
|
15
|
+
# Pull request run
|
16
|
+
#
|
17
|
+
# @return [Boolean]
|
18
|
+
def pr?
|
19
|
+
ENV["GITHUB_EVENT_NAME"] == "pull_request"
|
20
|
+
end
|
21
|
+
|
15
22
|
private
|
16
23
|
|
17
24
|
# Executor info
|
@@ -41,13 +48,6 @@ module Publisher
|
|
41
48
|
end
|
42
49
|
end
|
43
50
|
|
44
|
-
# Pull request run
|
45
|
-
#
|
46
|
-
# @return [Boolean]
|
47
|
-
def pr?
|
48
|
-
ENV["GITHUB_EVENT_NAME"] == "pull_request"
|
49
|
-
end
|
50
|
-
|
51
51
|
# Pull request description
|
52
52
|
#
|
53
53
|
# @return [String]
|
@@ -12,6 +12,13 @@ module Publisher
|
|
12
12
|
@run_id ||= ENV["CI_PIPELINE_ID"]
|
13
13
|
end
|
14
14
|
|
15
|
+
# Pull request run
|
16
|
+
#
|
17
|
+
# @return [Boolean]
|
18
|
+
def pr?
|
19
|
+
ENV["CI_PIPELINE_SOURCE"] == "merge_request_event"
|
20
|
+
end
|
21
|
+
|
15
22
|
# Get executor info
|
16
23
|
#
|
17
24
|
# @return [Hash]
|
@@ -57,13 +64,6 @@ module Publisher
|
|
57
64
|
end
|
58
65
|
end
|
59
66
|
|
60
|
-
# Pull request run
|
61
|
-
#
|
62
|
-
# @return [Boolean]
|
63
|
-
def pr?
|
64
|
-
ENV["CI_PIPELINE_SOURCE"] == "merge_request_event"
|
65
|
-
end
|
66
|
-
|
67
67
|
# Merge request iid
|
68
68
|
#
|
69
69
|
# @return [Integer]
|
@@ -20,11 +20,8 @@ module Publisher
|
|
20
20
|
#
|
21
21
|
# @return [void]
|
22
22
|
def generate
|
23
|
-
|
24
|
-
|
25
|
-
aggregate_results
|
26
|
-
generate_report
|
27
|
-
end
|
23
|
+
aggregate_results
|
24
|
+
generate_report
|
28
25
|
end
|
29
26
|
|
30
27
|
private
|
@@ -36,7 +33,7 @@ module Publisher
|
|
36
33
|
# @return [void]
|
37
34
|
def aggregate_results
|
38
35
|
results = Dir.glob(results_glob)
|
39
|
-
|
36
|
+
raise(NoAllureResultsError, "Missing allure results") if results.empty?
|
40
37
|
|
41
38
|
FileUtils.cp(results, results_dir)
|
42
39
|
end
|
@@ -48,7 +45,7 @@ module Publisher
|
|
48
45
|
out, _err, status = Open3.capture3(
|
49
46
|
"allure generate --clean --output #{report_dir} #{results_dir}"
|
50
47
|
)
|
51
|
-
|
48
|
+
raise(AllureError, out) unless status.success?
|
52
49
|
end
|
53
50
|
end
|
54
51
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Publisher
|
2
2
|
module Uploaders
|
3
|
+
class HistoryNotFoundError < StandardError; end
|
4
|
+
|
3
5
|
# Uploader implementation
|
4
6
|
#
|
5
7
|
class Uploader
|
@@ -25,13 +27,52 @@ module Publisher
|
|
25
27
|
#
|
26
28
|
# @return [void]
|
27
29
|
def execute
|
28
|
-
|
29
|
-
|
30
|
-
generate
|
30
|
+
generate_report
|
31
31
|
upload
|
32
32
|
add_url_to_pr
|
33
|
-
|
34
|
-
|
33
|
+
end
|
34
|
+
|
35
|
+
# Generate allure report
|
36
|
+
#
|
37
|
+
# @return [void]
|
38
|
+
def generate_report
|
39
|
+
add_history
|
40
|
+
add_executor_info
|
41
|
+
|
42
|
+
ReportGenerator.new(results_glob, results_dir, report_dir).generate
|
43
|
+
end
|
44
|
+
|
45
|
+
# Upload report to storage provider
|
46
|
+
#
|
47
|
+
# @return [void]
|
48
|
+
def upload
|
49
|
+
run_uploads
|
50
|
+
end
|
51
|
+
|
52
|
+
# Add allure report url to pull request description
|
53
|
+
#
|
54
|
+
# @return [void]
|
55
|
+
def add_url_to_pr
|
56
|
+
return unless update_pr && ci_provider
|
57
|
+
|
58
|
+
ci_provider.add_report_url
|
59
|
+
end
|
60
|
+
|
61
|
+
# Uploaded report urls
|
62
|
+
#
|
63
|
+
# @return [Hash<String, String>] uploaded report urls
|
64
|
+
def report_urls
|
65
|
+
urls = { "Report url" => report_url }
|
66
|
+
urls["Latest report url"] = latest_report_url if copy_latest
|
67
|
+
|
68
|
+
urls
|
69
|
+
end
|
70
|
+
|
71
|
+
# Executed in PR pipeline
|
72
|
+
#
|
73
|
+
# @return [Boolean]
|
74
|
+
def pr?
|
75
|
+
ci_provider&.pr?
|
35
76
|
end
|
36
77
|
|
37
78
|
private
|
@@ -54,6 +95,13 @@ module Publisher
|
|
54
95
|
raise("Not Implemented!")
|
55
96
|
end
|
56
97
|
|
98
|
+
# Latest report url
|
99
|
+
#
|
100
|
+
# @return [String]
|
101
|
+
def latest_report_url
|
102
|
+
raise("Not Implemented!")
|
103
|
+
end
|
104
|
+
|
57
105
|
# Download allure history
|
58
106
|
#
|
59
107
|
# @return [void]
|
@@ -87,11 +135,10 @@ module Publisher
|
|
87
135
|
#
|
88
136
|
# @return [void]
|
89
137
|
def add_history
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
138
|
+
create_history_dir
|
139
|
+
download_history
|
140
|
+
rescue HistoryNotFoundError
|
141
|
+
nil
|
95
142
|
end
|
96
143
|
|
97
144
|
# Add CI executor info
|
@@ -100,30 +147,7 @@ module Publisher
|
|
100
147
|
def add_executor_info
|
101
148
|
return unless ci_provider
|
102
149
|
|
103
|
-
|
104
|
-
Helpers::Spinner.spin("adding executor") do
|
105
|
-
ci_provider.write_executor_info
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
# Generate allure report
|
110
|
-
#
|
111
|
-
# @return [void]
|
112
|
-
def generate
|
113
|
-
add_history
|
114
|
-
add_executor_info
|
115
|
-
|
116
|
-
ReportGenerator.new(results_glob, results_dir, report_dir).generate
|
117
|
-
end
|
118
|
-
|
119
|
-
# Upload report to storage provider
|
120
|
-
#
|
121
|
-
# @return [void]
|
122
|
-
def upload
|
123
|
-
log("Uploading report")
|
124
|
-
Helpers::Spinner.spin("uploading report") { run_uploads }
|
125
|
-
log("Run report: #{report_url}", :green)
|
126
|
-
log("Latest report: #{latest_report_url}", :green) if copy_latest
|
150
|
+
ci_provider.write_executor_info
|
127
151
|
end
|
128
152
|
|
129
153
|
# Run upload commands
|
@@ -135,18 +159,6 @@ module Publisher
|
|
135
159
|
upload_latest_copy if copy_latest
|
136
160
|
end
|
137
161
|
|
138
|
-
# Add allure report url to pull request description
|
139
|
-
#
|
140
|
-
# @return [void]
|
141
|
-
def add_url_to_pr
|
142
|
-
return unless update_pr && ci_provider
|
143
|
-
|
144
|
-
log("Adding allure report link to pr description")
|
145
|
-
Helpers::Spinner.spin("adding link", exit_on_error: false) do
|
146
|
-
ci_provider.add_report_url
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
162
|
# Get run id
|
151
163
|
#
|
152
164
|
# @return [String]
|
@@ -41,7 +41,7 @@ module Publisher
|
|
41
41
|
def download_history
|
42
42
|
HISTORY.each do |file_name|
|
43
43
|
file = bucket.file(key(prefix, "history", file_name))
|
44
|
-
raise("Allure history from previous runs not found!") unless file
|
44
|
+
raise(HistoryNotFoundError, "Allure history from previous runs not found!") unless file
|
45
45
|
|
46
46
|
file.download(path(results_dir, "history", file_name))
|
47
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allure-report-publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrejs Cunskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|