pig-ci-rails 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -5
- data/README.md +24 -18
- data/lib/pig_ci/api/reports.rb +1 -1
- data/lib/pig_ci/profiler_engine/rails.rb +8 -2
- data/lib/pig_ci/version.rb +1 -1
- data/lib/pig_ci.rb +13 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db71bd9b82ebe9f9f4e9d88184f6c85f8883d4f94043df05dfc22acef1ca7a6e
|
4
|
+
data.tar.gz: 621ff89d5cdb3cac6b9dbeb51d4f5f4b6d929c9fb7488ecf6b10600add3beff1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05f65a26d7dfcf639d28087f530d93b661051d5145afe9906fa8dc07247980dc76096b389e0e44916b5586b27901722c09554b1614b4fe110db70f3b7c55effa
|
7
|
+
data.tar.gz: 12bbaa13fa3a727a272220d6cedeabb6758c4c9099835d8a00fb10e7726665ebb092104a4724a319347fb4af05641f3966010d75121e68ffee08c065f0e98ec5
|
data/CHANGELOG.md
CHANGED
@@ -2,14 +2,16 @@
|
|
2
2
|
|
3
3
|
## 0.1.2
|
4
4
|
|
5
|
-
|
5
|
+
* [Improving Codacy Rating](https://github.com/PigCI/pig-ci-rails/pull/4)
|
6
|
+
* [Correcting issue where app warm up would negatively affect timezone](https://github.com/PigCI/pig-ci-rails/pull/5)
|
7
|
+
* [Adding option to control if app is preloaded or not](https://github.com/PigCI/pig-ci-rails/pull/3)
|
6
8
|
|
7
9
|
## 0.1.1
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
11
|
+
* Updating API Endpoints for PigCI.com
|
12
|
+
* Adding fallback for if API is down to not fail CI.
|
13
|
+
* Removing unnecessary JS,
|
12
14
|
|
13
15
|
## 0.1.0
|
14
16
|
|
15
|
-
|
17
|
+
* Initial Release
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ require 'pig_ci'
|
|
42
42
|
PigCI.start
|
43
43
|
```
|
44
44
|
|
45
|
-
### With [PigCI.com](https://pigci.com) - For sharing runs as a team via CI
|
45
|
+
### With [PigCI.com](https://pigci.com) - For sharing runs as a team via CI
|
46
46
|
|
47
47
|
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).
|
48
48
|
|
@@ -67,7 +67,7 @@ PigCI.start do |config|
|
|
67
67
|
|
68
68
|
# E.g. disable terminal summary output
|
69
69
|
config.generate_terminal_summary = false
|
70
|
-
end # if RSpec.configuration.files_to_run.count > 1
|
70
|
+
end # if ENV['RUN_PIG_CI'] || RSpec.configuration.files_to_run.count > 1
|
71
71
|
```
|
72
72
|
|
73
73
|
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).
|
@@ -78,33 +78,39 @@ Currently this gem only supports Ruby on Rails.
|
|
78
78
|
|
79
79
|
### Metric notes
|
80
80
|
|
81
|
+
Minor fluctuations in memory usage and request time are to be expected and are nothing to worry about. Though any large spike is a signal of something worth investigating.
|
82
|
+
|
81
83
|
#### Memory
|
82
84
|
|
83
|
-
|
85
|
+
By default, this gem will tell Rails to eager load your application on startup. This aims to help identify leaks, over just pure bulk.
|
84
86
|
|
85
|
-
You can
|
87
|
+
You can disable this functionality by setting your configuration to be:
|
86
88
|
|
87
89
|
```ruby
|
88
|
-
|
90
|
+
require 'pig_ci'
|
91
|
+
PigCI.start do |config|
|
92
|
+
config.during_setup_eager_load_application = false
|
93
|
+
end
|
89
94
|
```
|
90
95
|
|
91
96
|
#### Request Time
|
92
97
|
|
93
|
-
Often the first request test will be slow, as rails is loading a full environment.
|
98
|
+
Often the first request test will be slow, as rails is loading a full environment. To mitigate this issue, this gem will make a blank request to your application before your test suite starts.
|
94
99
|
|
95
|
-
|
100
|
+
You can disable this functionality by setting your configuration to be:
|
96
101
|
|
97
102
|
```ruby
|
98
|
-
|
103
|
+
require 'pig_ci'
|
104
|
+
PigCI.start do |config|
|
105
|
+
config.during_setup_make_blank_application_request = false
|
106
|
+
end
|
99
107
|
```
|
100
108
|
|
101
|
-
Before you call `PigCI.start`.
|
102
|
-
|
103
109
|
## Authors
|
104
110
|
|
105
|
-
|
106
|
-
|
107
|
-
|
111
|
+
* This gem was made by [@MikeRogers0](https://github.com/MikeRogers0).
|
112
|
+
* It was originally inspired by [oink](https://github.com/noahd1/oink), after it was used to [monitor acceptance tests](https://mikerogers.io/2015/03/28/monitor-rails-memory-usage-in-integration-tests.html) and it spotted a memory leak. It seemed like something that would be useful to have as part of CI.
|
113
|
+
* The HTML output was inspired by [simplecov](https://github.com/colszowka/simplecov).
|
108
114
|
|
109
115
|
## Development
|
110
116
|
|
@@ -116,11 +122,11 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
116
122
|
|
117
123
|
Features I'd like to add at some point:
|
118
124
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
125
|
+
* HTML output to include branch - Right now they're just timestamps which makes filtering hard.
|
126
|
+
* Should I disable terminal output by default? It feels like noise.
|
127
|
+
* Should I reject database requests that have a value of 0? I think so.
|
128
|
+
* Document setting branch/commit encase of weird CI.
|
129
|
+
* Add rake rake for submitting reports.
|
124
130
|
|
125
131
|
## Contributing
|
126
132
|
|
data/lib/pig_ci/api/reports.rb
CHANGED
@@ -20,7 +20,8 @@ class PigCI::ProfilerEngine::Rails < ::PigCI::ProfilerEngine
|
|
20
20
|
|
21
21
|
def setup!
|
22
22
|
super do
|
23
|
-
eager_load_rails!
|
23
|
+
eager_load_rails! if PigCI.during_setup_eager_load_application?
|
24
|
+
make_blank_application_request! if PigCI.during_setup_make_blank_application_request?
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
@@ -31,9 +32,14 @@ class PigCI::ProfilerEngine::Rails < ::PigCI::ProfilerEngine
|
|
31
32
|
::Rails.application.eager_load!
|
32
33
|
::Rails::Engine.subclasses.map(&:instance).each(&:eager_load!)
|
33
34
|
::ActiveRecord::Base.descendants
|
35
|
+
end
|
34
36
|
|
37
|
+
def make_blank_application_request!
|
35
38
|
# Make a call to the root path to load up as much of rails as possible
|
36
|
-
|
39
|
+
# Done within a timezone block as it affects the timezone.
|
40
|
+
Time.use_zone('UTC') do
|
41
|
+
::Rails.application.call(::Rack::MockRequest.env_for('/'))
|
42
|
+
end
|
37
43
|
end
|
38
44
|
|
39
45
|
def attach_listeners!
|
data/lib/pig_ci/version.rb
CHANGED
data/lib/pig_ci.rb
CHANGED
@@ -45,6 +45,16 @@ module PigCI
|
|
45
45
|
@report_memory_precision || 2
|
46
46
|
end
|
47
47
|
|
48
|
+
attr_writer :during_setup_eager_load_application
|
49
|
+
def during_setup_eager_load_application?
|
50
|
+
@during_setup_eager_load_application.nil? || @during_setup_eager_load_application
|
51
|
+
end
|
52
|
+
|
53
|
+
attr_writer :during_setup_make_blank_application_request
|
54
|
+
def during_setup_make_blank_application_request?
|
55
|
+
@during_setup_make_blank_application_request.nil? || @during_setup_make_blank_application_request
|
56
|
+
end
|
57
|
+
|
48
58
|
attr_writer :terminal_report_row_limit
|
49
59
|
def terminal_report_row_limit
|
50
60
|
@terminal_report_row_limit || -1
|
@@ -73,7 +83,7 @@ module PigCI
|
|
73
83
|
|
74
84
|
attr_writer :api_base_uri
|
75
85
|
def api_base_uri
|
76
|
-
@api_base_uri || 'https://api.pigci.com'
|
86
|
+
@api_base_uri || 'https://api.pigci.com/api'
|
77
87
|
end
|
78
88
|
|
79
89
|
attr_accessor :api_verify_ssl
|
@@ -88,12 +98,12 @@ module PigCI
|
|
88
98
|
|
89
99
|
attr_writer :commit_sha1
|
90
100
|
def commit_sha1
|
91
|
-
@commit_sha1 || ENV['CIRCLE_SHA1'] || ENV['TRAVIS_COMMIT'] || `git rev-parse HEAD`.strip
|
101
|
+
@commit_sha1 || ENV['CI_COMMIT_ID'] || ENV['CIRCLE_SHA1'] || ENV['TRAVIS_COMMIT'] || `git rev-parse HEAD`.strip
|
92
102
|
end
|
93
103
|
|
94
104
|
attr_writer :head_branch
|
95
105
|
def head_branch
|
96
|
-
@head_branch || ENV['CIRCLE_BRANCH'] || ENV['TRAVIS_BRANCH'] || `git rev-parse --abbrev-ref HEAD`.strip
|
106
|
+
@head_branch || ENV['CI_BRANCH'] || ENV['CIRCLE_BRANCH'] || ENV['TRAVIS_BRANCH'] || `git rev-parse --abbrev-ref HEAD`.strip
|
97
107
|
end
|
98
108
|
|
99
109
|
attr_writer :locale
|
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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Rogers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|