allure-report-publisher 0.2.1 → 0.3.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: 676e5c29b0fb534f66b54f22f06e5a9c7c3f429d7c2923fd6285139234cd563d
4
- data.tar.gz: f68177fdde3a101fb501b47fb82897f7b48ba8e5669a1d1ee5f4a631364505a4
3
+ metadata.gz: 0f5c4eb0b467125c36d80b35b99f7ec44ff1561a21bcc305d78a9afc4eaace1d
4
+ data.tar.gz: a525a10cae5378628ebf74d0a128ae9561db9f13b0ed023b992a404376b8ea1e
5
5
  SHA512:
6
- metadata.gz: 826a881f81782358f580c4c5565c62d8b3dd06156bf224174d58149053c74a5d1e9456040c3dd6a136151ba0c091cf0fe74bcd3e945112dbe3a60eba4e05d6ba
7
- data.tar.gz: 50da6a0a16eeb2bd24b1473003515c9fbd58fc28dfc171994129d9a13a796a5fbd2cef76a46358f7736385c6c67fa4dc097abd6f06ed494bc5c27e48b03c236f
6
+ metadata.gz: c51b6b05861023942c761e80c0f777609dd0287f9f0724a4bc0246d7faa28a52ee05b394e85ddae66ea3441aa4a35372a88e2fe9b34c052776af3500570f19c1
7
+ data.tar.gz: bf3deb92f34c1899fc0c3bdce08cb6fa96652eac0493799b595894c3219baf200acf9a5f784a5ada92d24fe41ced54a9ac043678c82f850206a80d737e9a8909
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ # allure-report-publisher
2
+
1
3
  [![Gem Version](https://img.shields.io/gem/v/allure-report-publisher?color=red)](https://rubygems.org/gems/allure-report-publisher)
2
4
  [![Gem Pulls](https://img.shields.io/gem/dt/allure-report-publisher)](https://rubygems.org/gems/allure-report-publisher)
3
5
  [![Docker Image Version (latest semver)](https://img.shields.io/docker/v/andrcuns/allure-report-publisher?color=blue&label=docker&sort=semver)](https://hub.docker.com/r/andrcuns/allure-report-publisher)
@@ -7,31 +9,25 @@
7
9
  [![Maintainability](https://api.codeclimate.com/v1/badges/210eaa4f74588fb08313/maintainability)](https://codeclimate.com/github/andrcuns/allure-report-publisher/maintainability)
8
10
  [![Test Coverage](https://api.codeclimate.com/v1/badges/210eaa4f74588fb08313/test_coverage)](https://codeclimate.com/github/andrcuns/allure-report-publisher/test_coverage)
9
11
 
10
- # allure-report-publisher
11
-
12
12
  Upload your report to a file storage of your choice.
13
13
 
14
14
  ![Demo](demo.gif)
15
15
 
16
- ## Installation
16
+ # Installation
17
17
 
18
- ### Rubygems
18
+ ## Rubygems
19
19
 
20
20
  ```shell
21
21
  gem install allure-report-uploader
22
22
  ```
23
23
 
24
- ### Docker
24
+ ## Docker
25
25
 
26
26
  ```shell
27
27
  docker pull andrcuns/allure-report-publisher:latest
28
28
  ```
29
29
 
30
- ## Usage
31
-
32
- allure-report-publisher will automatically detect if used in CI environment and add relevant executor info and history
33
-
34
- - `--update-pr=(comment|description)`: requires `GITHUB_AUTH_TOKEN` or `GITLAB_AUTH_TOKEN` in order to update pull request with links to allure reports
30
+ # Usage
35
31
 
36
32
  ```shell
37
33
  $ (allure-report-publisher|docker run --rm andrcuns/allure-report-publisher:latest) upload --help
@@ -61,11 +57,15 @@ Examples:
61
57
  allure-report-publisher upload gcs --results-glob='path/to/allure-result/**/*' --bucket=my-bucket --prefix=my-project/prs
62
58
  ```
63
59
 
64
- ### AWS S3
60
+ # Storage providers
61
+
62
+ Multiple cloud storage providers are supported
63
+
64
+ ## AWS S3
65
65
 
66
66
  Requires environment variables `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` or credentials file `~/.aws/credentials`
67
67
 
68
- ### Google Cloud Storage
68
+ ## Google Cloud Storage
69
69
 
70
70
  Requires on of the following environment variables.
71
71
 
@@ -86,20 +86,77 @@ credentials.json contents:
86
86
  - `GOOGLE_CLOUD_KEYFILE_JSON`
87
87
  - `GCLOUD_KEYFILE_JSON`
88
88
 
89
- ## Development
89
+ # CI
90
+
91
+ `allure-report-publisher` will automatically detect if used in CI environment and add relevant executor info and history.
92
+
93
+ Following CI providers are supported:
94
+
95
+ - Github Actions
96
+ - Gitlab CI
97
+
98
+ ## Pull requests
99
+
100
+ It is possible to update pull requests with urls to published reports.
101
+
102
+ - `--update-pr=(comment|description)`: post report urls in pr description or as a comment
103
+
104
+ Example:
105
+
106
+ ---
107
+
108
+ `# Allure report`
109
+
110
+ `allure-report-publisher` generated test report for [1b756f48](https://github.com/andrcuns/allure-report-publisher/commit/HEAD)!
111
+
112
+ **rspec**: 📝 [test report](https://storage.googleapis.com/allure-test-reports/allure-report-publisher/refs/heads/main/index.html)
113
+
114
+ ---
115
+
116
+ ## Github Actions
117
+
118
+ Additional configuration is done via environment variables
119
+
120
+ Authentication for PR updates:
121
+
122
+ - `GITHUB_AUTH_TOKEN`: github auth token with api access
123
+
124
+ Following environment variables can override default CI values:
125
+
126
+ - `ALLURE_JOB_NAME`: overrides default `GITHUB_JOB` value which is used as name for report url section
127
+
128
+ ## Gitlab CI
129
+
130
+ Additional configuration is done via environment variables
131
+
132
+ Authentication for MR updates:
133
+
134
+ - `GITLAB_AUTH_TOKEN`: gitlab access token with api access
135
+
136
+ Following environment variables can override default CI values:
137
+
138
+ - `ALLURE_JOB_NAME`: overrides default `CI_JOB_NAME` value which is used as name for report url section
139
+
140
+ In case merge request triggers a downstream pipeline yet you want to update original merge request, overriding following environment variables might be useful:
141
+
142
+ - `ALLURE_PROJECT_PATH`: overrides default `CI_PROJECT_PATH` value
143
+ - `ALLURE_MERGE_REQUEST_IID`: overrides default `CI_MERGE_REQUEST_IID` value
144
+ - `ALLURE_COMMIT_SHA`: overrides default `CI_MERGE_REQUEST_SOURCE_BRANCH_SHA` or `CI_COMMIT_SHA` values
145
+
146
+ # Development
90
147
 
91
148
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
92
149
 
93
150
  To install this gem onto your local machine, run `bundle exec rake install`.
94
151
 
95
- ## Contributing
152
+ # Contributing
96
153
 
97
154
  Bug reports and pull requests are welcome on GitHub at <https://github.com/andrcuns/allure-report-publisher>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/andrcuns/allure-report-publisher/blob/main/CODE_OF_CONDUCT.md).
98
155
 
99
- ## License
156
+ # License
100
157
 
101
158
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
102
159
 
103
- ## Code of Conduct
160
+ # Code of Conduct
104
161
 
105
162
  Everyone interacting in the allure-report-publisher project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/andrcuns/allure-report-publisher/blob/main/CODE_OF_CONDUCT.md).
@@ -16,7 +16,7 @@ module Publisher
16
16
  #
17
17
  # @return [Boolean]
18
18
  def pr?
19
- ENV["CI_PIPELINE_SOURCE"] == "merge_request_event"
19
+ (allure_project && allure_mr_iid) || ENV["CI_PIPELINE_SOURCE"] == "merge_request_event"
20
20
  end
21
21
 
22
22
  # Get executor info
@@ -83,11 +83,39 @@ module Publisher
83
83
  end
84
84
  end
85
85
 
86
+ # Custom repository name
87
+ #
88
+ # @return [String]
89
+ def allure_project
90
+ @allure_project ||= ENV["ALLURE_PROJECT_PATH"]
91
+ end
92
+
93
+ # Custom mr iid name
94
+ #
95
+ # @return [String]
96
+ def allure_mr_iid
97
+ @allure_mr_iid ||= ENV["ALLURE_MERGE_REQUEST_IID"]
98
+ end
99
+
100
+ # Custom sha
101
+ #
102
+ # @return [String]
103
+ def allure_sha
104
+ @allure_sha ||= ENV["ALLURE_COMMIT_SHA"]
105
+ end
106
+
107
+ # Gitlab project path
108
+ #
109
+ # @return [String]
110
+ def project
111
+ @project ||= allure_project || ENV["CI_PROJECT_PATH"]
112
+ end
113
+
86
114
  # Merge request iid
87
115
  #
88
116
  # @return [Integer]
89
117
  def mr_iid
90
- @mr_iid ||= ENV["CI_MERGE_REQUEST_IID"]
118
+ @mr_iid ||= allure_mr_iid || ENV["CI_MERGE_REQUEST_IID"]
91
119
  end
92
120
 
93
121
  # Server url
@@ -111,18 +139,11 @@ module Publisher
111
139
  @build_name ||= ENV[ALLURE_JOB_NAME] || ENV["CI_JOB_NAME"]
112
140
  end
113
141
 
114
- # Gitlab repository
115
- #
116
- # @return [String]
117
- def project
118
- @project ||= ENV["CI_PROJECT_PATH"]
119
- end
120
-
121
142
  # Commit sha url
122
143
  #
123
144
  # @return [String]
124
145
  def sha_url
125
- sha = ENV["CI_MERGE_REQUEST_SOURCE_BRANCH_SHA"] || ENV["CI_COMMIT_SHA"]
146
+ sha = allure_sha || ENV["CI_MERGE_REQUEST_SOURCE_BRANCH_SHA"] || ENV["CI_COMMIT_SHA"]
126
147
  short_sha = sha[0..7]
127
148
 
128
149
  "[#{short_sha}](#{server_url}/#{project}/-/merge_requests/#{mr_iid}/diffs?commit_id=#{sha})"
@@ -65,7 +65,7 @@ module Publisher
65
65
  #
66
66
  # @return [String]
67
67
  def heading
68
- @heading ||= "# Allure report\n`allure-report-publisher` generated allure report for #{sha_url}!"
68
+ @heading ||= "# Allure report\n`allure-report-publisher` generated test report for #{sha_url}!"
69
69
  end
70
70
 
71
71
  # Return updated jobs section
@@ -83,14 +83,14 @@ module Publisher
83
83
  #
84
84
  # @return [String]
85
85
  def job_entry
86
- @job_entry ||= "**#{build_name}**: 📝 [allure report](#{report_url})<br />"
86
+ @job_entry ||= "**#{build_name}**: 📝 [test report](#{report_url})<br />"
87
87
  end
88
88
 
89
89
  # Job entry pattern
90
90
  #
91
91
  # @return [RegExp]
92
92
  def job_entry_pattern
93
- @job_entry_pattern ||= %r{^\*\*#{build_name}\*\*:.*\[allure report\]\(.*\)<br />$}
93
+ @job_entry_pattern ||= %r{^\*\*#{build_name}\*\*:.*\[test report\]\(.*\)<br />$}
94
94
  end
95
95
  end
96
96
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Publisher
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.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: 0.2.1
4
+ version: 0.3.0
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-21 00:00:00.000000000 Z
11
+ date: 2021-05-24 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.95.0
22
+ version: 1.96.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.95.0
32
+ version: 1.96.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: dry-cli
35
35
  requirement: !ruby/object:Gem::Requirement