pig-ci-rails 0.2.2 → 1.0.0
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/CHANGELOG.md +4 -2
- data/README.md +1 -22
- data/config/locales/pig_ci/en.yml +0 -5
- data/lib/pig_ci.rb +5 -19
- data/lib/pig_ci/version.rb +1 -1
- data/pig_ci.gemspec +1 -2
- metadata +3 -19
- data/lib/pig_ci/api.rb +0 -14
- data/lib/pig_ci/api/reports.rb +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b66f58f3bb5e578d8856a2f51d28024ba4174f05cd346c9c2dc710d3ce87ecf2
|
4
|
+
data.tar.gz: 421d50cde44adf6eb69abb5a726383aef6e1271ad9ba21ced7bda35821f8a437
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c481a3f96647b1e85bf9b25ea62e18e7265a1b95fc802c6f0d37eb0a69769be91ca3478ac0e4f589f8784bc22c26a1328488f84f5dec59a0defc0dbf2bf8277
|
7
|
+
data.tar.gz: 299023a04fd3302922a16b50f3af2f4ae2a12e653d41793d1d33037287a92dfaeac1c659e7cbddc6e64d54ce99e207f8e775221b07fca3075ff12328d84c0542
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## 0.
|
3
|
+
## 1.0.1 (In development
|
4
4
|
|
5
|
-
|
5
|
+
## 1.0.0
|
6
|
+
|
7
|
+
* [Removing PigCI.com integration](https://github.com/PigCI/pig-ci-rails/pull/27) - For more information please [see my announcement](https://pigci.com/github-integration-deprecation-notice).
|
6
8
|
|
7
9
|
## 0.2.2
|
8
10
|
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
# PigCI
|
9
9
|
|
10
|
-

|
11
11
|
|
12
12
|
Monitor your Ruby Applications metrics (Memory, SQL Requests & Request Time) as part of your test suite.
|
13
13
|
|
@@ -81,24 +81,6 @@ end # if RSpec.configuration.files_to_run.count > 1
|
|
81
81
|
|
82
82
|
You can see the full configuration options [lib/pig_ci.rb](https://github.com/PigCI/pig-ci-rails/blob/master/lib/pig_ci.rb#L21).
|
83
83
|
|
84
|
-
|
85
|
-
### With [PigCI.com](https://pigci.com) - For sharing runs as a team via CI
|
86
|
-
|
87
|
-
_Note: This feature will be deprecated in the future. Instead use "Configuring thresholds" to have CI pass/fail._
|
88
|
-
|
89
|
-
You can hookup your project to PigCI.com, this will fail PRs when metric thresholds are exceeded (e.g. your app see a big increase in memory).
|
90
|
-
|
91
|
-
```ruby
|
92
|
-
# In spec/rails_helper.rb
|
93
|
-
require 'pig_ci'
|
94
|
-
PigCI.start do |config|
|
95
|
-
# When you connect your project, you'll be given an API key.
|
96
|
-
config.api_key = 'your-api-key-here'
|
97
|
-
end
|
98
|
-
```
|
99
|
-
|
100
|
-
It's a great way to track metrics over time & support this project.
|
101
|
-
|
102
84
|
### Framework support
|
103
85
|
|
104
86
|
Currently this gem only supports Ruby on Rails tested via RSpec.
|
@@ -150,10 +132,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
150
132
|
|
151
133
|
Features I'd like to add at some point:
|
152
134
|
|
153
|
-
* Add support for "upsert" for when tests are split over multiple machines
|
154
135
|
* HTML output to include branch - Right now they're just timestamps which makes filtering hard.
|
155
|
-
* Document setting branch/commit to handle when CI doesn't set it correctly.
|
156
|
-
* Add rake for submitting reports.
|
157
136
|
* https://rubydoc.info/gems/yard/file/docs/GettingStarted.md - Document the gem so it's easier for people to jump on.
|
158
137
|
* Support ActionCable (when requests have no key).
|
159
138
|
|
@@ -1,10 +1,5 @@
|
|
1
1
|
en:
|
2
2
|
pig_ci:
|
3
|
-
api:
|
4
|
-
reports:
|
5
|
-
success: 'PigCI: Successfully submitted report to pigci.com'
|
6
|
-
error: 'Unable to connect to PigCI API: %{error}'
|
7
|
-
api_error: 'Unable to connect to PigCI API'
|
8
3
|
summary:
|
9
4
|
ci_start: 'PigCI Thresholds Summary:'
|
10
5
|
ci_failure: 'PigCI: This commit has exceeded the thresholds defined in PigCI.thresholds'
|
data/lib/pig_ci.rb
CHANGED
@@ -3,7 +3,6 @@ require 'active_support/core_ext/string/inflections'
|
|
3
3
|
require 'rake'
|
4
4
|
|
5
5
|
require 'pig_ci/version'
|
6
|
-
require 'pig_ci/api'
|
7
6
|
require 'pig_ci/configuration'
|
8
7
|
require 'pig_ci/decorator'
|
9
8
|
require 'pig_ci/summary'
|
@@ -88,21 +87,6 @@ module PigCI
|
|
88
87
|
@profiler_engine ||= PigCI::ProfilerEngine::Rails.new
|
89
88
|
end
|
90
89
|
|
91
|
-
attr_writer :api_base_uri
|
92
|
-
def api_base_uri
|
93
|
-
@api_base_uri || 'https://api.pigci.com/api'
|
94
|
-
end
|
95
|
-
|
96
|
-
attr_accessor :api_verify_ssl
|
97
|
-
def api_verify_ssl?
|
98
|
-
!@api_verify_ssl.nil? ? @api_verify_ssl : true
|
99
|
-
end
|
100
|
-
|
101
|
-
attr_accessor :api_key
|
102
|
-
def api_key?
|
103
|
-
!@api_key.nil? && @api_key != ''
|
104
|
-
end
|
105
|
-
|
106
90
|
attr_writer :commit_sha1
|
107
91
|
def commit_sha1
|
108
92
|
@commit_sha1 || ENV['CI_COMMIT_ID'] || ENV['CIRCLE_SHA1'] || ENV['TRAVIS_COMMIT'] || `git rev-parse HEAD`.strip
|
@@ -113,6 +97,11 @@ module PigCI
|
|
113
97
|
@head_branch || ENV['CI_BRANCH'] || ENV['CIRCLE_BRANCH'] || ENV['TRAVIS_BRANCH'] || `git rev-parse --abbrev-ref HEAD`.strip
|
114
98
|
end
|
115
99
|
|
100
|
+
# Throw deprecation notice for setting API
|
101
|
+
def api_key=(value)
|
102
|
+
puts 'DEPRECATED: PigCI.com API has been retired, you no longer need to set config.api_key in your spec/rails_helper.rb file.'
|
103
|
+
end
|
104
|
+
|
116
105
|
attr_writer :locale
|
117
106
|
def locale
|
118
107
|
@locale || :en
|
@@ -161,9 +150,6 @@ module PigCI
|
|
161
150
|
# Save the report summary to the project root.
|
162
151
|
PigCI::Summary::HTML.new(reports: profiler_engine.reports).save! if PigCI.generate_html_summary?
|
163
152
|
|
164
|
-
# If they have an API key, share it with PigCI.com
|
165
|
-
PigCI::Api::Reports.new(reports: profiler_engine.reports).share! if PigCI.api_key?
|
166
|
-
|
167
153
|
# Make sure CI fails when metrics are over thresholds.
|
168
154
|
PigCI::Summary::CI.new(reports: profiler_engine.reports).call!
|
169
155
|
end
|
data/lib/pig_ci/version.rb
CHANGED
data/pig_ci.gemspec
CHANGED
@@ -24,7 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency 'activesupport', '>= 4.2'
|
25
25
|
spec.add_dependency 'colorize', '>= 0.8.1'
|
26
26
|
spec.add_dependency 'get_process_mem', '~> 0.2.3'
|
27
|
-
spec.add_dependency 'httparty', '>= 0.16'
|
28
27
|
spec.add_dependency 'i18n', '>= 0.9', '< 2'
|
29
28
|
spec.add_dependency 'rails', '>= 4.2.0'
|
30
29
|
spec.add_dependency 'terminal-table', '~> 1.8.0'
|
@@ -41,7 +40,7 @@ Gem::Specification.new do |spec|
|
|
41
40
|
spec.post_install_message = [
|
42
41
|
'Thank you for installing Pig CI!',
|
43
42
|
'Upgrade Notes:',
|
44
|
-
'The latest version adds a "config.thresholds" option which
|
43
|
+
'The latest version adds a "config.thresholds" option which replaces the PigCI.com GitHub integration.',
|
45
44
|
'See https://github.com/PigCI/pig-ci-rails#configuring-thresholds for more information :)'
|
46
45
|
].join("\n")
|
47
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pig-ci-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Rogers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.2.3
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: httparty
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.16'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.16'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: i18n
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -236,8 +222,6 @@ files:
|
|
236
222
|
- bin/setup
|
237
223
|
- config/locales/pig_ci/en.yml
|
238
224
|
- lib/pig_ci.rb
|
239
|
-
- lib/pig_ci/api.rb
|
240
|
-
- lib/pig_ci/api/reports.rb
|
241
225
|
- lib/pig_ci/configuration.rb
|
242
226
|
- lib/pig_ci/decorator.rb
|
243
227
|
- lib/pig_ci/decorator/report_terminal_decorator.rb
|
@@ -272,7 +256,7 @@ metadata: {}
|
|
272
256
|
post_install_message: |-
|
273
257
|
Thank you for installing Pig CI!
|
274
258
|
Upgrade Notes:
|
275
|
-
The latest version adds a "config.thresholds" option which
|
259
|
+
The latest version adds a "config.thresholds" option which replaces the PigCI.com GitHub integration.
|
276
260
|
See https://github.com/PigCI/pig-ci-rails#configuring-thresholds for more information :)
|
277
261
|
rdoc_options: []
|
278
262
|
require_paths:
|
data/lib/pig_ci/api.rb
DELETED
data/lib/pig_ci/api/reports.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
class PigCI::Api::Reports < PigCI::Api
|
2
|
-
def initialize(reports: [])
|
3
|
-
@reports = reports
|
4
|
-
end
|
5
|
-
|
6
|
-
def share!
|
7
|
-
response = post_payload
|
8
|
-
if response.success?
|
9
|
-
puts I18n.t('pig_ci.api.reports.success')
|
10
|
-
return
|
11
|
-
end
|
12
|
-
|
13
|
-
if response.parsed_response.is_a?(Hash)
|
14
|
-
puts I18n.t('pig_ci.api.reports.error', error: response.parsed_response.dig('error'))
|
15
|
-
else
|
16
|
-
puts I18n.t('pig_ci.api.reports.error')
|
17
|
-
end
|
18
|
-
rescue JSON::ParserError => _e
|
19
|
-
puts I18n.t('pig_ci.api.reports.api_error')
|
20
|
-
rescue SocketError => e
|
21
|
-
puts I18n.t('pig_ci.api.reports.error', error: e)
|
22
|
-
rescue Net::OpenTimeout => e
|
23
|
-
puts I18n.t('pig_ci.api.reports.error', error: e.inspect)
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def post_payload
|
29
|
-
self.class.post(
|
30
|
-
'/v1/reports',
|
31
|
-
base_uri: PigCI.api_base_uri,
|
32
|
-
verify: PigCI.api_verify_ssl?,
|
33
|
-
body: payload,
|
34
|
-
headers: headers
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
def payload
|
39
|
-
{
|
40
|
-
library: 'pig-ci-rails',
|
41
|
-
library_version: PigCI::VERSION,
|
42
|
-
commit_sha1: PigCI.commit_sha1,
|
43
|
-
head_branch: PigCI.head_branch,
|
44
|
-
reports: @reports.collect { |report| report.to_payload_for(PigCI.run_timestamp) }
|
45
|
-
}.to_json
|
46
|
-
end
|
47
|
-
end
|