allure-report-publisher 3.0.0 → 3.1.0

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: 1f7655105dbfd46700acb9b6045fdb563542697d88891f2ac1983d6d6d9a2cc3
4
- data.tar.gz: d13ed56a3356b42060fa10ccc665765d2e3453cbd1090f483198b6c03a636555
3
+ metadata.gz: b57fedd5eddc21b48d4c01d4c8858cf4c3c2638d239973a195612fbc14e885f5
4
+ data.tar.gz: c3745051f24d11bbc89c229aaceddb2c8f4cb97fce2b8e6a8029c0c36099e353
5
5
  SHA512:
6
- metadata.gz: 7ff3f600d92b168111027c203e3b0d61b25aae3ba99cb01df372d0e0003ca6706fe3dfa5c07c2402f6d0e5f90eff19f95b790877a466d46e8627c90fc9177932
7
- data.tar.gz: 7799a9144ceb663551f461a0e503ec9051f9be0588bbf60598d8cf7953b67fd3771ea5eec68ab0aff259d15c7a67422a65d5739278a8215af9a8992a939f70d6
6
+ metadata.gz: bc55ecf458d787dc7813fe08bc8e12459cda59e73eeb8fe2de3ab6b52730382ba8e1af563d0181ac82eb612cc9f684795c4a1921e77b853834c6f7df4e078c45
7
+ data.tar.gz: 4e134f36135b30fd8e1185ea85091d5d477cb90b95082b606d490dba6fc519d38c6e7d4e5b4ab7ca6f2b656426822c97fc5e510daf1de12153a281a03e914c33
data/README.md CHANGED
@@ -47,6 +47,7 @@ Options:
47
47
  --prefix=VALUE # Optional prefix for report path. Required: false
48
48
  --update-pr=VALUE # Add report url to PR via comment or description update. Required: false: (comment/description/actions)
49
49
  --report-title=VALUE # Title for url section in PR comment/description. Required: false, default: "Allure Report"
50
+ --report-name=VALUE # Custom report name in final Allure report. Required: false
50
51
  --summary=VALUE # Additionally add summary table to PR comment or description. Required: false: (behaviors/suites/packages/total), default: "total"
51
52
  --summary-table-type=VALUE # Summary table type. Required: false: (ascii/markdown), default: "ascii"
52
53
  --base-url=VALUE # Use custom base url instead of default cloud provider one. Required: false
@@ -68,7 +69,7 @@ Examples:
68
69
 
69
70
  All named options can be configured via environment variables. Environment variables are prefixed with `ALLURE_` and uppercased.
70
71
 
71
- Example: `--results-glob` can be configured via `ALLURE_REPORT_RESULTS_GLOB`
72
+ Example: `--results-glob` can be configured via `ALLURE_RESULTS_GLOB`
72
73
 
73
74
  # Storage providers
74
75
 
@@ -156,6 +157,7 @@ Authentication for PR updates:
156
157
  Following environment variables can override default CI values:
157
158
 
158
159
  - `ALLURE_JOB_NAME`: overrides default `GITHUB_JOB` value which is used as name for report url section
160
+ - `ALLURE_RUN_ID`: overrides default `GITHUB_RUN_ID` value which is used as name for the run number
159
161
 
160
162
  ### allure-publish-action
161
163
 
@@ -176,6 +178,7 @@ Authentication for MR updates:
176
178
  Following environment variables can override default CI values:
177
179
 
178
180
  - `ALLURE_JOB_NAME`: overrides default `CI_JOB_NAME` value which is used as name for report url section
181
+ - `ALLURE_RUN_ID`: overrides default `CI_PIPELINE_ID` value which is used as name for the run number
179
182
 
180
183
  In case merge request triggers a downstream pipeline yet you want to update original merge request, overriding following environment variables might be useful:
181
184
 
@@ -29,6 +29,9 @@ module Publisher
29
29
  type: :string,
30
30
  default: "Allure Report",
31
31
  desc: "Title for url section in PR comment/description. Required: false"
32
+ option :report_name,
33
+ type: :string,
34
+ desc: "Custom report name in final Allure report. Required: false"
32
35
  option :summary,
33
36
  type: :string,
34
37
  desc: "Additionally add summary table to PR comment or description. Required: false",
@@ -109,7 +112,7 @@ module Publisher
109
112
  def uploader
110
113
  @uploader ||= uploaders(args[:type]).new(
111
114
  result_paths: @result_paths,
112
- **args.slice(:bucket, :prefix, :base_url, :copy_latest)
115
+ **args.slice(:bucket, :prefix, :base_url, :copy_latest, :report_name)
113
116
  )
114
117
  end
115
118
 
@@ -12,6 +12,7 @@ module Publisher
12
12
 
13
13
  def_delegators :"Publisher::Providers::Info::Gitlab.instance",
14
14
  :allure_project,
15
+ :mr_iid,
15
16
  :allure_mr_iid,
16
17
  :server_url,
17
18
  :build_name
@@ -68,13 +69,6 @@ module Publisher
68
69
  @project ||= allure_project || env("CI_MERGE_REQUEST_PROJECT_PATH") || env("CI_PROJECT_PATH")
69
70
  end
70
71
 
71
- # Merge request iid
72
- #
73
- # @return [Integer]
74
- def mr_iid
75
- @mr_iid ||= allure_mr_iid || env("CI_MERGE_REQUEST_IID")
76
- end
77
-
78
72
  # Commit sha url
79
73
  #
80
74
  # @return [String]
@@ -7,6 +7,7 @@ module Publisher
7
7
  #
8
8
  class Base
9
9
  ALLURE_JOB_NAME = "ALLURE_JOB_NAME".freeze
10
+ ALLURE_RUN_ID = "ALLURE_RUN_ID".freeze
10
11
 
11
12
  # :nocov:
12
13
 
@@ -34,7 +34,7 @@ module Publisher
34
34
  #
35
35
  # @return [String]
36
36
  def run_id
37
- @run_id ||= env("GITHUB_RUN_ID")
37
+ @run_id ||= env(ALLURE_RUN_ID) || env("GITHUB_RUN_ID")
38
38
  end
39
39
 
40
40
  # Server url
@@ -27,14 +27,14 @@ module Publisher
27
27
  #
28
28
  # @return [Boolean]
29
29
  def pr?
30
- !!(allure_project && allure_mr_iid) || ENV["CI_PIPELINE_SOURCE"] == "merge_request_event"
30
+ !!((allure_project && allure_mr_iid) || mr_iid)
31
31
  end
32
32
 
33
33
  # Get ci run ID without creating instance of ci provider
34
34
  #
35
35
  # @return [String]
36
36
  def run_id
37
- @run_id ||= ENV["CI_PIPELINE_ID"]
37
+ @run_id ||= env(ALLURE_RUN_ID) || ENV["CI_PIPELINE_ID"]
38
38
  end
39
39
 
40
40
  # Server url
@@ -58,6 +58,13 @@ module Publisher
58
58
  @allure_project ||= env("ALLURE_PROJECT_PATH")
59
59
  end
60
60
 
61
+ # Merge request iid
62
+ #
63
+ # @return [Integer]
64
+ def mr_iid
65
+ @mr_iid ||= allure_mr_iid || env("CI_MERGE_REQUEST_IID")
66
+ end
67
+
61
68
  # Custom mr iid name
62
69
  #
63
70
  # @return [String]
@@ -10,8 +10,9 @@ module Publisher
10
10
  class ReportGenerator
11
11
  include Helpers
12
12
 
13
- def initialize(result_paths)
13
+ def initialize(result_paths, report_name)
14
14
  @result_paths = result_paths.join(" ")
15
+ @report_name = report_name
15
16
  end
16
17
 
17
18
  # Generate allure report
@@ -44,14 +45,18 @@ module Publisher
44
45
 
45
46
  # @return [String] result paths string
46
47
  attr_reader :result_paths
48
+ # @return [String] custom report name
49
+ attr_reader :report_name
47
50
 
48
51
  # Generate allure report
49
52
  #
50
53
  # @return [void]
51
54
  def generate_report
52
55
  log_debug("Generating allure report")
53
- cmd = "allure generate --clean --output #{report_path} #{common_info_path} #{result_paths}"
54
- out = execute_shell(cmd)
56
+ cmd = ["allure generate --clean"]
57
+ cmd << "--report-name '#{report_name}'" if report_name
58
+ cmd << "--output #{report_path} #{common_info_path} #{result_paths}"
59
+ out = execute_shell(cmd.join(" "))
55
60
  log_debug("Generated allure report. #{out}".strip)
56
61
 
57
62
  deduplicate_executors
@@ -30,12 +30,14 @@ module Publisher
30
30
  # @option args [String] :prefix
31
31
  # @option args [String] :base_url
32
32
  # @option args [String] :copy_latest
33
+ # @option args [String] :report_name
33
34
  def initialize(**args)
34
35
  @result_paths = args[:result_paths]
35
36
  @bucket_name = args[:bucket]
36
37
  @prefix = args[:prefix]
37
38
  @base_url = args[:base_url]
38
39
  @copy_latest = ci_info && args[:copy_latest] # copy latest for ci only
40
+ @report_name = args[:report_name]
39
41
  end
40
42
 
41
43
  # Execute allure report generation and upload
@@ -94,7 +96,8 @@ module Publisher
94
96
  :bucket_name,
95
97
  :prefix,
96
98
  :base_url,
97
- :copy_latest
99
+ :copy_latest,
100
+ :report_name
98
101
 
99
102
  def_delegator :report_generator, :common_info_path
100
103
 
@@ -155,7 +158,7 @@ module Publisher
155
158
  #
156
159
  # @return [Publisher::ReportGenerator]
157
160
  def report_generator
158
- @report_generator ||= ReportGenerator.new(result_paths)
161
+ @report_generator ||= ReportGenerator.new(result_paths, report_name)
159
162
  end
160
163
 
161
164
  # Report path prefix
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Publisher
4
- VERSION = "3.0.0"
4
+ VERSION = "3.1.0"
5
5
  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: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrejs Cunskis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-08 00:00:00.000000000 Z
11
+ date: 2024-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 1.93.1
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 1.142.0
22
+ version: 1.143.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 1.93.1
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 1.142.0
32
+ version: 1.143.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: dry-cli
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -256,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
256
  - !ruby/object:Gem::Version
257
257
  version: '0'
258
258
  requirements: []
259
- rubygems_version: 3.4.10
259
+ rubygems_version: 3.4.19
260
260
  signing_key:
261
261
  specification_version: 4
262
262
  summary: Allure report uploader