allure-report-publisher 1.3.0 → 1.4.1

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: 60bffdf8cfaef83d728fa0f0ddb3d5f87227f5fd3f3af1df048ac5859a7e21c7
4
- data.tar.gz: d3a83dd85d3c3586db99d0c26bf6c5323e4bdc23beff83d80beae12ae0dfcdca
3
+ metadata.gz: 9aa8d4aeec603193bb1d2dcc253ef1ad8f22d9bac900ba393b46ace96498cf7b
4
+ data.tar.gz: a567fc75fcf837f7131d3e86d84106f04da7d571c8e0c91ebff64ca40afb5cae
5
5
  SHA512:
6
- metadata.gz: 1811d5892f98e633ab10585425c359839da9bdef5828389b18c7e10591031b2dae88b920f7d291d72ddcf7b2894ad457ff975769e74e03f84e4baa0bd94a88ab
7
- data.tar.gz: e27359fd763ce52f1ce55522681e06d446c44d815980b0e2777c9181073a5270d78148f1820afff893406483bd24732e778c0ccbff512d0537511efe00234e6e
6
+ metadata.gz: 54a8b3516af69699e3e2a2cb32c44a5a54c26905a5de2e0542a40ba14da3feb2517d5bde871ddae6bce9ac89a228a0dc5bebdaea70f3b993c3432703ada3e342
7
+ data.tar.gz: 9cd184caae6f8a6480ccf7226324f07972430c309943797881b4d95310032438e141bb657249ff7f139aab289c19b1cd36a3f811df2cf7be3b316d2260fa3148
data/README.md CHANGED
@@ -49,7 +49,8 @@ Options:
49
49
  --update-pr=VALUE # Add report url to PR via comment or description update. Required: false: (comment/description/actions)
50
50
  --summary=VALUE # Additionally add summary table to PR comment or description. Required: false: (behaviors/suites/packages/total)
51
51
  --summary-table-type=VALUE # Summary table type. Required: false: (ascii/markdown), default: :ascii
52
- --[no-]collapse-summary # Create summary as a collapsable section, default: false
52
+ --base-url=VALUE # Use custom base url instead of default cloud provider one. Required: false
53
+ --[no-]collapse-summary # Create summary as a collapsible section, default: false
53
54
  --[no-]copy-latest # Keep copy of latest report at base prefix path, default: false
54
55
  --[no-]color # Force color output
55
56
  --[no-]ignore-missing-results # Ignore missing allure results, default: false
@@ -1,3 +1,5 @@
1
+ require "uri"
2
+
1
3
  module Publisher
2
4
  module Commands
3
5
  # Upload allure report
@@ -40,10 +42,13 @@ module Publisher
40
42
  Publisher::Helpers::Summary::ASCII,
41
43
  Publisher::Helpers::Summary::MARKDOWN
42
44
  ]
45
+ option :base_url,
46
+ type: :string,
47
+ desc: "Use custom base url instead of default cloud provider one. Required: false"
43
48
  option :collapse_summary,
44
49
  type: :boolean,
45
50
  default: false,
46
- desc: "Create summary as a collapsable section"
51
+ desc: "Create summary as a collapsible section"
47
52
  option :copy_latest,
48
53
  type: :boolean,
49
54
  default: false,
@@ -95,6 +100,7 @@ module Publisher
95
100
  **args.slice(
96
101
  :bucket,
97
102
  :prefix,
103
+ :base_url,
98
104
  :copy_latest,
99
105
  :update_pr,
100
106
  :collapse_summary,
@@ -120,6 +126,9 @@ module Publisher
120
126
  def validate_args
121
127
  error("Missing argument --results-glob!") unless args[:results_glob]
122
128
  error("Missing argument --bucket!") unless args[:bucket]
129
+ URI.parse(args[:base_url]) if args[:base_url]
130
+ rescue URI::InvalidURIError
131
+ error("Invalid --base-url value!")
123
132
  end
124
133
 
125
134
  # Scan for allure results paths
@@ -28,6 +28,7 @@ module Publisher
28
28
  # @option args [Array] :result_paths
29
29
  # @option args [String] :bucket
30
30
  # @option args [String] :prefix
31
+ # @option args [String] :base_url
31
32
  # @option args [Boolean] :update_pr
32
33
  # @option args [String] :summary_type
33
34
  # @option args [Symbol] :summary_table_type
@@ -37,6 +38,7 @@ module Publisher
37
38
  @result_paths = args[:result_paths]
38
39
  @bucket_name = args[:bucket]
39
40
  @prefix = args[:prefix]
41
+ @base_url = args[:base_url]
40
42
  @update_pr = args[:update_pr]
41
43
  @summary_type = args[:summary_type]
42
44
  @summary_table_type = args[:summary_table_type]
@@ -104,6 +106,7 @@ module Publisher
104
106
  attr_reader :result_paths,
105
107
  :bucket_name,
106
108
  :prefix,
109
+ :base_url,
107
110
  :update_pr,
108
111
  :copy_latest,
109
112
  :summary_type,
@@ -72,13 +72,18 @@ module Publisher
72
72
  def upload_latest_copy
73
73
  log_debug("Copying report as latest")
74
74
 
75
+ # it's not possible to overwrite whole directory so we clean out unique data files from last run
76
+ log_debug("Cleaning data files")
77
+ data_files = bucket.files(prefix: key(prefix, "data"))
78
+ Parallel.each(data_files, in_threads: PARALLEL_THREADS, &:delete)
79
+
80
+ log_debug("Copying report files")
75
81
  args = report_files.map do |file|
76
82
  {
77
83
  source_file: bucket.file(key(full_prefix, file.relative_path_from(report_path))),
78
84
  destination: key(prefix, file.relative_path_from(report_path))
79
85
  }
80
86
  end
81
-
82
87
  Parallel.each(args, in_threads: PARALLEL_THREADS) do |obj|
83
88
  obj[:source_file].copy(obj[:destination], force_copy_metadata: true) do |f|
84
89
  f.cache_control = "public, max-age=60"
@@ -121,7 +126,7 @@ module Publisher
121
126
  # @param [String] path_prefix
122
127
  # @return [String]
123
128
  def url(path_prefix)
124
- ["https://storage.googleapis.com", bucket_name, path_prefix, "index.html"].compact.join("/")
129
+ [base_url || "https://storage.googleapis.com", bucket_name, path_prefix, "index.html"].compact.join("/")
125
130
  end
126
131
  end
127
132
  end
@@ -83,6 +83,18 @@ module Publisher
83
83
  def upload_latest_copy
84
84
  log_debug("Copying report as latest")
85
85
 
86
+ # it's not possible to overwrite whole directory so we clean out unique data files from last run
87
+ log_debug("Cleaning data files")
88
+ client.list_objects_v2(bucket: bucket_name, prefix: key(prefix, "data")).each do |resp|
89
+ client.delete_objects({
90
+ bucket: bucket_name,
91
+ delete: {
92
+ objects: resp.contents.map { |obj| { key: obj.key } }
93
+ }
94
+ })
95
+ end
96
+
97
+ log_debug("Copying report files")
86
98
  args = report_files.map do |file|
87
99
  {
88
100
  bucket: bucket_name,
@@ -93,7 +105,6 @@ module Publisher
93
105
  cache_control: "max-age=60"
94
106
  }
95
107
  end
96
-
97
108
  Parallel.each(args, in_threads: PARALLEL_THREADS) { |obj| client.copy_object(obj) }
98
109
  log_debug("Finished latest report copy successfully")
99
110
  end
@@ -132,7 +143,7 @@ module Publisher
132
143
  # @param [String] path_prefix
133
144
  # @return [String]
134
145
  def url(path_prefix)
135
- ["http://#{bucket_name}.s3.amazonaws.com", path_prefix, "index.html"].compact.join("/")
146
+ [base_url || "http://#{bucket_name}.s3.amazonaws.com", path_prefix, "index.html"].compact.join("/")
136
147
  end
137
148
  end
138
149
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Publisher
4
- VERSION = "1.3.0"
4
+ VERSION = "1.4.1"
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: 1.3.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrejs Cunskis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-07 00:00:00.000000000 Z
11
+ date: 2022-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '0.6'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '0.8'
42
+ version: '1.1'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '0.6'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '0.8'
52
+ version: '1.1'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: faraday-retry
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -222,14 +222,14 @@ dependencies:
222
222
  requirements:
223
223
  - - "~>"
224
224
  - !ruby/object:Gem::Version
225
- version: 2.18.0
225
+ version: 2.20.0
226
226
  type: :development
227
227
  prerelease: false
228
228
  version_requirements: !ruby/object:Gem::Requirement
229
229
  requirements:
230
230
  - - "~>"
231
231
  - !ruby/object:Gem::Version
232
- version: 2.18.0
232
+ version: 2.20.0
233
233
  - !ruby/object:Gem::Dependency
234
234
  name: climate_control
235
235
  requirement: !ruby/object:Gem::Requirement
@@ -382,14 +382,14 @@ dependencies:
382
382
  requirements:
383
383
  - - "~>"
384
384
  - !ruby/object:Gem::Version
385
- version: 0.47.0
385
+ version: 0.48.0
386
386
  type: :development
387
387
  prerelease: false
388
388
  version_requirements: !ruby/object:Gem::Requirement
389
389
  requirements:
390
390
  - - "~>"
391
391
  - !ruby/object:Gem::Version
392
- version: 0.47.0
392
+ version: 0.48.0
393
393
  description: Upload allure reports to different file storage providers
394
394
  email:
395
395
  - andrejs.cunskis@gmail.com