allure-report-publisher 3.1.0 → 3.2.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: b57fedd5eddc21b48d4c01d4c8858cf4c3c2638d239973a195612fbc14e885f5
4
- data.tar.gz: c3745051f24d11bbc89c229aaceddb2c8f4cb97fce2b8e6a8029c0c36099e353
3
+ metadata.gz: d13fcb7c7d00d54bffa1cab27e27573332a4fd42fc0ff6f54c4e4f7985a2d57b
4
+ data.tar.gz: 917e091dea4e5f771e6b3386712684335c8cd15ee448f09b4e1a486e88cde874
5
5
  SHA512:
6
- metadata.gz: bc55ecf458d787dc7813fe08bc8e12459cda59e73eeb8fe2de3ab6b52730382ba8e1af563d0181ac82eb612cc9f684795c4a1921e77b853834c6f7df4e078c45
7
- data.tar.gz: 4e134f36135b30fd8e1185ea85091d5d477cb90b95082b606d490dba6fc519d38c6e7d4e5b4ab7ca6f2b656426822c97fc5e510daf1de12153a281a03e914c33
6
+ metadata.gz: 1b2cdb3075fbe04af803e5827a71f0eb6d89dc4a411a9479abb6bdce062e47efb6768a0465a1196184fe3254a0214e14aef3e92b5202acfafd32485251279279
7
+ data.tar.gz: 3065ba9869d235de689bae099513f0c3c8e074c5d0990521c492d1081f1d66b4aa733108d13af41a8de7c96c6cf02a9743624059cb29036161a4c9665b79e7a6
data/README.md CHANGED
@@ -51,6 +51,7 @@ Options:
51
51
  --summary=VALUE # Additionally add summary table to PR comment or description. Required: false: (behaviors/suites/packages/total), default: "total"
52
52
  --summary-table-type=VALUE # Summary table type. Required: false: (ascii/markdown), default: "ascii"
53
53
  --base-url=VALUE # Use custom base url instead of default cloud provider one. Required: false
54
+ --parallel=VALUE # Number of parallel threads to use for report file upload to cloud storage. Required: false, default: 8
54
55
  --[no-]flaky-warning-status # Mark run with a '!' status in PR comment/description if report contains flaky tests, default: false
55
56
  --[no-]collapse-summary # Create summary as a collapsible section, default: false
56
57
  --[no-]copy-latest # Keep copy of latest report at base prefix path, default: false
@@ -53,6 +53,10 @@ module Publisher
53
53
  option :base_url,
54
54
  type: :string,
55
55
  desc: "Use custom base url instead of default cloud provider one. Required: false"
56
+ option :parallel,
57
+ type: :integer,
58
+ desc: "Number of parallel threads to use for report file upload to cloud storage. Required: false",
59
+ default: 8
56
60
  option :flaky_warning_status,
57
61
  type: :boolean,
58
62
  default: false,
@@ -112,6 +116,7 @@ module Publisher
112
116
  def uploader
113
117
  @uploader ||= uploaders(args[:type]).new(
114
118
  result_paths: @result_paths,
119
+ parallel: parallel_threads,
115
120
  **args.slice(:bucket, :prefix, :base_url, :copy_latest, :report_name)
116
121
  )
117
122
  end
@@ -153,10 +158,23 @@ module Publisher
153
158
  error("Missing argument --results-glob!") unless args[:results_glob]
154
159
  error("Missing argument --bucket!") unless args[:bucket]
155
160
  URI.parse(args[:base_url]) if args[:base_url]
161
+ validate_parallel_args
156
162
  rescue URI::InvalidURIError
157
163
  error("Invalid --base-url value!")
158
164
  end
159
165
 
166
+ # Parallel threads
167
+ #
168
+ # @return [Integer]
169
+ def parallel_threads
170
+ @parallel_threads ||= Integer(args[:parallel]).tap do |threads|
171
+ raise ArgumentError if threads < 1
172
+ end
173
+ rescue ArgumentError
174
+ error("Invalid --parallel value, must be a positive number!")
175
+ end
176
+ alias validate_parallel_args parallel_threads
177
+
160
178
  # Scan for allure results paths
161
179
  #
162
180
  # @param [String] results_glob
@@ -5,8 +5,6 @@ module Publisher
5
5
  module Uploaders
6
6
  class HistoryNotFoundError < StandardError; end
7
7
 
8
- PARALLEL_THREADS = 8
9
-
10
8
  # Uploader implementation
11
9
  #
12
10
  class Uploader
@@ -31,6 +29,7 @@ module Publisher
31
29
  # @option args [String] :base_url
32
30
  # @option args [String] :copy_latest
33
31
  # @option args [String] :report_name
32
+ # @option args [Integer] :parallel
34
33
  def initialize(**args)
35
34
  @result_paths = args[:result_paths]
36
35
  @bucket_name = args[:bucket]
@@ -38,6 +37,7 @@ module Publisher
38
37
  @base_url = args[:base_url]
39
38
  @copy_latest = ci_info && args[:copy_latest] # copy latest for ci only
40
39
  @report_name = args[:report_name]
40
+ @parallel = args[:parallel]
41
41
  end
42
42
 
43
43
  # Execute allure report generation and upload
@@ -97,7 +97,8 @@ module Publisher
97
97
  :prefix,
98
98
  :base_url,
99
99
  :copy_latest,
100
- :report_name
100
+ :report_name,
101
+ :parallel
101
102
 
102
103
  def_delegator :report_generator, :common_info_path
103
104
 
@@ -75,7 +75,7 @@ module Publisher
75
75
  # it's not possible to overwrite whole directory so we clean out unique data files from last run
76
76
  log_debug("Cleaning data files")
77
77
  data_files = bucket.files(prefix: key(prefix, "data"))
78
- Parallel.each(data_files, in_threads: PARALLEL_THREADS, &:delete)
78
+ Parallel.each(data_files, in_threads: parallel, &:delete)
79
79
 
80
80
  log_debug("Copying report files")
81
81
  args = report_files.map do |file|
@@ -84,7 +84,7 @@ module Publisher
84
84
  destination: key(prefix, file.relative_path_from(report_path))
85
85
  }
86
86
  end
87
- Parallel.each(args, in_threads: PARALLEL_THREADS) do |obj|
87
+ Parallel.each(args, in_threads: parallel) do |obj|
88
88
  obj[:source_file].copy(obj[:destination], force_copy_metadata: true) do |f|
89
89
  f.cache_control = "public, max-age=60"
90
90
  end
@@ -106,8 +106,8 @@ module Publisher
106
106
  }
107
107
  end
108
108
 
109
- log_debug("Uploading '#{args.size}' files in '#{PARALLEL_THREADS}' threads")
110
- Parallel.each(args, in_threads: PARALLEL_THREADS) do |obj|
109
+ log_debug("Uploading '#{args.size}' files in '#{parallel}' threads")
110
+ Parallel.each(args, in_threads: parallel) do |obj|
111
111
  bucket.create_file(*obj.slice(:file, :path).values, cache_control: "public, max-age=3600")
112
112
  end
113
113
  log_debug("Finished upload successfully")
@@ -103,7 +103,7 @@ module Publisher
103
103
  cache_control: "max-age=60"
104
104
  }
105
105
  end
106
- Parallel.each(args, in_threads: PARALLEL_THREADS) { |obj| client.copy_object(obj) }
106
+ Parallel.each(args, in_threads: parallel) { |obj| client.copy_object(obj) }
107
107
  log_debug("Finished latest report copy successfully")
108
108
  end
109
109
 
@@ -115,7 +115,7 @@ module Publisher
115
115
  def upload_to_s3(files, key_prefix)
116
116
  args = files.map do |file|
117
117
  {
118
- body: File.new(file),
118
+ body: file.to_s,
119
119
  bucket: bucket_name,
120
120
  key: key(key_prefix, file.relative_path_from(report_path)),
121
121
  content_type: MiniMime.lookup_by_filename(file).content_type,
@@ -123,8 +123,10 @@ module Publisher
123
123
  }
124
124
  end
125
125
 
126
- log_debug("Uploading '#{args.size}' files in '#{PARALLEL_THREADS}' threads")
127
- Parallel.each(args, in_threads: PARALLEL_THREADS) { |obj| client.put_object(obj) }
126
+ log_debug("Uploading '#{args.size}' files in '#{parallel}' threads")
127
+ Parallel.each(args, in_threads: parallel) do |obj|
128
+ client.put_object(obj.tap { |o| o[:body] = File.read(o[:body]) })
129
+ end
128
130
  log_debug("Finished upload successfully")
129
131
  end
130
132
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Publisher
4
- VERSION = "3.1.0"
4
+ VERSION = "3.2.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.1.0
4
+ version: 3.2.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: 2024-01-25 00:00:00.000000000 Z
11
+ date: 2024-03-07 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.143.0
22
+ version: 1.144.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.143.0
32
+ version: 1.144.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: dry-cli
35
35
  requirement: !ruby/object:Gem::Requirement