circlemator 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +79 -0
- data/.gitignore +0 -1
- data/.ruby-version +1 -1
- data/Dockerfile +11 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +164 -0
- data/README.md +58 -1
- data/circlemator.gemspec +6 -2
- data/exe/circlemator +26 -3
- data/lib/circlemator/code_analyser.rb +41 -0
- data/lib/circlemator/github_repo.rb +4 -0
- data/lib/circlemator/pr_commenter.rb +30 -0
- data/lib/circlemator/version.rb +1 -1
- metadata +68 -9
- data/circle.yml +0 -4
- data/lib/circlemator/style_checker.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b85de391417bc5d4ca2137e3f75c3901afef8d00905c2ebdd783bf1063d361f3
|
4
|
+
data.tar.gz: cec624177ec7726bcc054fc3ef8d95d89f7b80ec468a5276cc4513bb3de9c6a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cafe0affdbf14f324ed34d57020c43a2bd255380502175c6e8e6183018caf81ec7725ff4304861b0945bd00e0c869d62740f466f66827dafded98ab53af63f79
|
7
|
+
data.tar.gz: dd3847b813c6a0afc8829d32ae0dc1fa3ee4e5398012127e0a9432b3c197c05b8e23744baf9e05d90b85085d72b397ca04d00aaf78fe5c0def7835fa5e6d715b
|
@@ -0,0 +1,79 @@
|
|
1
|
+
version: 2
|
2
|
+
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
docker:
|
6
|
+
- image: circleci/ruby:2.4.2
|
7
|
+
steps:
|
8
|
+
- checkout
|
9
|
+
- run:
|
10
|
+
name: Ensure CIRCLE_BRANCH
|
11
|
+
command: |
|
12
|
+
if [ -z $CIRCLE_BRANCH ]; then
|
13
|
+
echo "export CIRCLE_BRANCH=$CIRCLE_TAG" >> $BASH_ENV
|
14
|
+
fi
|
15
|
+
- run:
|
16
|
+
name: Install env dependencies
|
17
|
+
command: |
|
18
|
+
sudo apt-get update
|
19
|
+
sudo apt-get install cmake pkg-config
|
20
|
+
- restore_cache:
|
21
|
+
key: v1-rainforest-bundler-{{ checksum "Gemfile.lock" }}
|
22
|
+
- run:
|
23
|
+
name: Install Ruby gems
|
24
|
+
command: |
|
25
|
+
bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
|
26
|
+
- save_cache:
|
27
|
+
key: v1-rainforest-bundler-{{ checksum "Gemfile.lock" }}
|
28
|
+
paths:
|
29
|
+
- ~/project/vendor/bundle
|
30
|
+
- run:
|
31
|
+
name: Cancel old builds
|
32
|
+
command: bundle exec exe/circlemator cancel-old
|
33
|
+
- run:
|
34
|
+
name: Test Circlemator
|
35
|
+
command: bundle exec exe/circlemator style-check --base-branch=master
|
36
|
+
- run:
|
37
|
+
name: Run Specs
|
38
|
+
command: bundle exec rspec
|
39
|
+
- run:
|
40
|
+
name: Test Code Coverage
|
41
|
+
command: bundle exec exe/circlemator test-coverage --base-branch=master
|
42
|
+
push_to_rubygems:
|
43
|
+
docker:
|
44
|
+
- image: circleci/ruby:2.4.2
|
45
|
+
steps:
|
46
|
+
- checkout
|
47
|
+
- run:
|
48
|
+
name: Create .gem/credentials file
|
49
|
+
command: |
|
50
|
+
mkdir ~/.gem
|
51
|
+
echo "---
|
52
|
+
:rubygems_api_key: $RUBYGEMS_API_KEY
|
53
|
+
" > ~/.gem/credentials
|
54
|
+
chmod 600 ~/.gem/credentials
|
55
|
+
- run:
|
56
|
+
name: Release circlemator
|
57
|
+
command: |
|
58
|
+
gem build circlemator
|
59
|
+
gem push circlemator-*.gem
|
60
|
+
|
61
|
+
workflows:
|
62
|
+
version: 2
|
63
|
+
test_and_release:
|
64
|
+
jobs:
|
65
|
+
- test:
|
66
|
+
filters:
|
67
|
+
tags:
|
68
|
+
only:
|
69
|
+
- /.*/
|
70
|
+
- push_to_rubygems:
|
71
|
+
requires:
|
72
|
+
- test
|
73
|
+
filters:
|
74
|
+
branches:
|
75
|
+
ignore:
|
76
|
+
- /.*/
|
77
|
+
tags:
|
78
|
+
only:
|
79
|
+
- /^v.*/
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.2
|
data/Dockerfile
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
circlemator (0.4.0)
|
5
|
+
httparty (~> 0.13.7)
|
6
|
+
pronto (~> 0.9.5)
|
7
|
+
pronto-commentator (~> 0)
|
8
|
+
pronto-rubocop (~> 0.9.0)
|
9
|
+
pronto-undercover (~> 0.1)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
addressable (2.5.2)
|
15
|
+
public_suffix (>= 2.0.2, < 4.0)
|
16
|
+
ast (2.4.0)
|
17
|
+
coderay (1.1.2)
|
18
|
+
crack (0.4.3)
|
19
|
+
safe_yaml (~> 1.0.0)
|
20
|
+
diff-lcs (1.3)
|
21
|
+
docile (1.3.1)
|
22
|
+
faraday (0.15.3)
|
23
|
+
multipart-post (>= 1.2, < 3)
|
24
|
+
ffi (1.9.18)
|
25
|
+
formatador (0.2.5)
|
26
|
+
gitlab (4.3.0)
|
27
|
+
httparty
|
28
|
+
terminal-table
|
29
|
+
guard (2.14.1)
|
30
|
+
formatador (>= 0.2.4)
|
31
|
+
listen (>= 2.7, < 4.0)
|
32
|
+
lumberjack (~> 1.0)
|
33
|
+
nenv (~> 0.1)
|
34
|
+
notiffany (~> 0.0)
|
35
|
+
pry (>= 0.9.12)
|
36
|
+
shellany (~> 0.0)
|
37
|
+
thor (>= 0.18.1)
|
38
|
+
guard-compat (1.2.1)
|
39
|
+
guard-rspec (4.6.5)
|
40
|
+
guard (~> 2.1)
|
41
|
+
guard-compat (~> 1.1)
|
42
|
+
rspec (>= 2.99.0, < 4.0)
|
43
|
+
hashdiff (0.3.6)
|
44
|
+
httparty (0.13.7)
|
45
|
+
json (~> 1.8)
|
46
|
+
multi_xml (>= 0.5.2)
|
47
|
+
imagen (0.1.5)
|
48
|
+
parser (>= 2.5, != 2.5.1.1)
|
49
|
+
json (1.8.6)
|
50
|
+
listen (3.1.5)
|
51
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
52
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
53
|
+
ruby_dep (~> 1.2)
|
54
|
+
lumberjack (1.0.12)
|
55
|
+
method_source (0.9.0)
|
56
|
+
multi_xml (0.6.0)
|
57
|
+
multipart-post (2.0.0)
|
58
|
+
nenv (0.3.0)
|
59
|
+
notiffany (0.1.1)
|
60
|
+
nenv (~> 0.1)
|
61
|
+
shellany (~> 0.0)
|
62
|
+
octokit (4.12.0)
|
63
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
64
|
+
parallel (1.12.1)
|
65
|
+
parser (2.5.1.2)
|
66
|
+
ast (~> 2.4.0)
|
67
|
+
powerpack (0.1.2)
|
68
|
+
pronto (0.9.5)
|
69
|
+
gitlab (~> 4.0, >= 4.0.0)
|
70
|
+
httparty (>= 0.13.7)
|
71
|
+
octokit (~> 4.7, >= 4.7.0)
|
72
|
+
rainbow (~> 2.1)
|
73
|
+
rugged (~> 0.24, >= 0.23.0)
|
74
|
+
thor (~> 0.19.0)
|
75
|
+
pronto-commentator (0.1.1)
|
76
|
+
pronto (~> 0.9.5)
|
77
|
+
pronto-rubocop (0.9.1)
|
78
|
+
pronto (~> 0.9.0)
|
79
|
+
rubocop (~> 0.50, >= 0.49.1)
|
80
|
+
pronto-undercover (0.1.2)
|
81
|
+
pronto (~> 0.9.0)
|
82
|
+
undercover (~> 0.2.0)
|
83
|
+
pry (0.11.1)
|
84
|
+
coderay (~> 1.1.0)
|
85
|
+
method_source (~> 0.9.0)
|
86
|
+
public_suffix (3.0.3)
|
87
|
+
rainbow (2.2.2)
|
88
|
+
rake
|
89
|
+
rake (10.5.0)
|
90
|
+
rb-fsevent (0.10.2)
|
91
|
+
rb-inotify (0.9.10)
|
92
|
+
ffi (>= 0.5.0, < 2)
|
93
|
+
rf-stylez (0.2.9)
|
94
|
+
rubocop (~> 0.51.0)
|
95
|
+
rspec (3.4.0)
|
96
|
+
rspec-core (~> 3.4.0)
|
97
|
+
rspec-expectations (~> 3.4.0)
|
98
|
+
rspec-mocks (~> 3.4.0)
|
99
|
+
rspec-core (3.4.4)
|
100
|
+
rspec-support (~> 3.4.0)
|
101
|
+
rspec-expectations (3.4.0)
|
102
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
103
|
+
rspec-support (~> 3.4.0)
|
104
|
+
rspec-mocks (3.4.1)
|
105
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
106
|
+
rspec-support (~> 3.4.0)
|
107
|
+
rspec-support (3.4.1)
|
108
|
+
rspec_junit_formatter (0.3.0)
|
109
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
110
|
+
rubocop (0.51.0)
|
111
|
+
parallel (~> 1.10)
|
112
|
+
parser (>= 2.3.3.1, < 3.0)
|
113
|
+
powerpack (~> 0.1)
|
114
|
+
rainbow (>= 2.2.2, < 3.0)
|
115
|
+
ruby-progressbar (~> 1.7)
|
116
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
117
|
+
ruby-progressbar (1.10.0)
|
118
|
+
ruby_dep (1.5.0)
|
119
|
+
rugged (0.27.4)
|
120
|
+
safe_yaml (1.0.4)
|
121
|
+
sawyer (0.8.1)
|
122
|
+
addressable (>= 2.3.5, < 2.6)
|
123
|
+
faraday (~> 0.8, < 1.0)
|
124
|
+
shellany (0.0.1)
|
125
|
+
simplecov (0.16.1)
|
126
|
+
docile (~> 1.1)
|
127
|
+
json (>= 1.8, < 3)
|
128
|
+
simplecov-html (~> 0.10.0)
|
129
|
+
simplecov-html (0.10.2)
|
130
|
+
simplecov-lcov (0.7.0)
|
131
|
+
terminal-table (1.8.0)
|
132
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
133
|
+
thor (0.19.4)
|
134
|
+
undercover (0.2.1)
|
135
|
+
imagen (~> 0.1.5)
|
136
|
+
rainbow (~> 2.1)
|
137
|
+
rugged (~> 0.27.0)
|
138
|
+
unicode-display_width (1.4.0)
|
139
|
+
vcr (3.0.3)
|
140
|
+
webmock (1.22.6)
|
141
|
+
addressable (>= 2.3.6)
|
142
|
+
crack (>= 0.3.2)
|
143
|
+
hashdiff
|
144
|
+
|
145
|
+
PLATFORMS
|
146
|
+
ruby
|
147
|
+
|
148
|
+
DEPENDENCIES
|
149
|
+
bundler (>= 1.9)
|
150
|
+
circlemator!
|
151
|
+
guard-rspec (~> 4.6.4)
|
152
|
+
rake (~> 10.0)
|
153
|
+
rf-stylez
|
154
|
+
rspec (~> 3.4.0)
|
155
|
+
rspec_junit_formatter
|
156
|
+
rubocop
|
157
|
+
simplecov
|
158
|
+
simplecov-html
|
159
|
+
simplecov-lcov
|
160
|
+
vcr (~> 3.0.1)
|
161
|
+
webmock (~> 1.22.6)
|
162
|
+
|
163
|
+
BUNDLED WITH
|
164
|
+
1.16.3
|
data/README.md
CHANGED
@@ -50,11 +50,21 @@ to be set in CircleCI:
|
|
50
50
|
- `CIRCLE_API_TOKEN`: Your CircleCI API token. (Can also be set with
|
51
51
|
the `-t` option.)
|
52
52
|
|
53
|
+
### Comment
|
54
|
+
|
55
|
+
You can comment on the open PR using the `comment` command:
|
56
|
+
|
57
|
+
```yml
|
58
|
+
test:
|
59
|
+
post:
|
60
|
+
- bundle exec circlemator comment 'A totally unnecessary comment' --base-branch=develop
|
61
|
+
```
|
62
|
+
|
53
63
|
### Style check
|
54
64
|
|
55
65
|
Think of this as a poor man's HoundCI: it runs Rubocop (and/or more
|
56
66
|
linters/checkers TBD) and comments on the Github pull request using
|
57
|
-
the excellent [Pronto](https://github.com/
|
67
|
+
the excellent [Pronto](https://github.com/prontolabs/pronto). Use it
|
58
68
|
like so:
|
59
69
|
|
60
70
|
```yml
|
@@ -72,6 +82,53 @@ It probably makes sense to put `style-check` in either the `pre` or
|
|
72
82
|
|
73
83
|
`style-check` requires the following environment variable to be set:
|
74
84
|
|
85
|
+
- `GITHUB_ACCESS_TOKEN`: A Github API auth token for a user with commit
|
86
|
+
access to your repo. (Can also be set with the `-g` option.)
|
87
|
+
|
88
|
+
### Code coverage check
|
89
|
+
|
90
|
+
The code coverage check looks for untested lines in the pull request using [Pronto](https://github.com/prontolabs/pronto) and [Undercover](https://github.com/grodowski/undercover) and posts warnings as PR comments.
|
91
|
+
|
92
|
+
Set up code coverage reporting with SimpleCov to start finding untested code after tests have been executed:
|
93
|
+
|
94
|
+
```rb
|
95
|
+
# Gemfile
|
96
|
+
group :test do
|
97
|
+
gem 'simplecov'
|
98
|
+
gem 'simplecov-lcov'
|
99
|
+
end
|
100
|
+
```
|
101
|
+
|
102
|
+
```rb
|
103
|
+
# spec_helper.rb (or test_helper.rb)
|
104
|
+
|
105
|
+
require 'simplecov'
|
106
|
+
require 'simplecov-lcov'
|
107
|
+
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
|
108
|
+
SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
|
109
|
+
SimpleCov.start do
|
110
|
+
add_filter(/^\/spec\//) # For RSpec
|
111
|
+
|
112
|
+
add_filter(/^\/test\//) # For Minitest
|
113
|
+
end
|
114
|
+
|
115
|
+
require 'your_app'
|
116
|
+
|
117
|
+
# ...
|
118
|
+
```
|
119
|
+
|
120
|
+
Then use it like this:
|
121
|
+
|
122
|
+
```yml
|
123
|
+
test:
|
124
|
+
post:
|
125
|
+
- bundle exec circlemator test-coverage --base-branch=develop
|
126
|
+
```
|
127
|
+
|
128
|
+
Circlemator reads additional config from [.pronto.yml](https://github.com/grodowski/pronto-undercover#configuring)
|
129
|
+
|
130
|
+
`test-coverage` requires the following environment variable to be set:
|
131
|
+
|
75
132
|
- `GITHUB_ACCESS_TOKEN`: A Github API auth token for a user with commit
|
76
133
|
access to your repo. (Can also be set with the `-g` option.)
|
77
134
|
|
data/circlemator.gemspec
CHANGED
@@ -22,9 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
24
|
spec.add_dependency 'httparty', '~> 0.13.7'
|
25
|
-
spec.add_dependency 'pronto', '~> 0.
|
26
|
-
spec.add_dependency 'pronto-rubocop', '~> 0.
|
25
|
+
spec.add_dependency 'pronto', '~> 0.9.5'
|
26
|
+
spec.add_dependency 'pronto-rubocop', '~> 0.9.0'
|
27
27
|
spec.add_dependency 'pronto-commentator', '~> 0'
|
28
|
+
spec.add_dependency 'pronto-undercover', '~> 0.1'
|
28
29
|
|
29
30
|
spec.add_development_dependency 'bundler', '>= 1.9'
|
30
31
|
spec.add_development_dependency 'rake', '~> 10.0'
|
@@ -33,4 +34,7 @@ Gem::Specification.new do |spec|
|
|
33
34
|
spec.add_development_dependency 'webmock', '~> 1.22.6'
|
34
35
|
spec.add_development_dependency 'rspec', '~> 3.4.0'
|
35
36
|
spec.add_development_dependency 'guard-rspec', '~> 4.6.4'
|
37
|
+
spec.add_development_dependency 'simplecov'
|
38
|
+
spec.add_development_dependency 'simplecov-html'
|
39
|
+
spec.add_development_dependency 'simplecov-lcov'
|
36
40
|
end
|
data/exe/circlemator
CHANGED
@@ -4,11 +4,12 @@ require 'optparse'
|
|
4
4
|
require_relative '../lib/circlemator/build_canceler'
|
5
5
|
require_relative '../lib/circlemator/self_merger'
|
6
6
|
require_relative '../lib/circlemator/github_repo'
|
7
|
-
require_relative '../lib/circlemator/
|
7
|
+
require_relative '../lib/circlemator/code_analyser'
|
8
|
+
require_relative '../lib/circlemator/pr_commenter'
|
8
9
|
|
9
10
|
options = {}
|
10
11
|
parser = OptionParser.new do |opts|
|
11
|
-
opts.banner = 'Usage: circlemator (self-merge|cancel-old) [options]'
|
12
|
+
opts.banner = 'Usage: circlemator (self-merge|cancel-old|comment) [text] [options]'
|
12
13
|
|
13
14
|
opts.on('-bBRANCH', '--base-branch=BRANCH', 'Base branch for merging') do |b|
|
14
15
|
options[:base_branch] = b
|
@@ -59,6 +60,7 @@ options[:user] = require_env 'CIRCLE_PROJECT_USERNAME'
|
|
59
60
|
options[:repo] = require_env 'CIRCLE_PROJECT_REPONAME'
|
60
61
|
options[:github_auth_token] ||= ENV['GITHUB_ACCESS_TOKEN']
|
61
62
|
options[:github_auth_token] ||= ENV['GITHUB_AUTH_TOKEN']
|
63
|
+
ENV['PRONTO_GITHUB_ACCESS_TOKEN'] ||= options[:github_auth_token]
|
62
64
|
|
63
65
|
case ARGV[0]
|
64
66
|
when 'self-merge'
|
@@ -82,7 +84,28 @@ when 'style-check'
|
|
82
84
|
require_opt options, :base_branch
|
83
85
|
options[:github_repo] = Circlemator::GithubRepo.new(options)
|
84
86
|
|
85
|
-
Circlemator::
|
87
|
+
Circlemator::CodeAnalyser.new(options).check_style
|
88
|
+
when 'test-coverage'
|
89
|
+
options[:sha] = require_env 'CIRCLE_SHA1'
|
90
|
+
options[:compare_branch] ||= require_env 'CIRCLE_BRANCH'
|
91
|
+
require_opt options, :github_auth_token
|
92
|
+
require_opt options, :base_branch
|
93
|
+
options[:github_repo] = Circlemator::GithubRepo.new(options)
|
94
|
+
|
95
|
+
Circlemator::CodeAnalyser.new(options).check_coverage
|
96
|
+
when 'comment'
|
97
|
+
options[:sha] = require_env 'CIRCLE_SHA1'
|
98
|
+
options[:compare_branch] ||= require_env 'CIRCLE_BRANCH'
|
99
|
+
require_opt options, :github_auth_token
|
100
|
+
require_opt options, :base_branch
|
101
|
+
options[:github_repo] = Circlemator::GithubRepo.new(options)
|
102
|
+
|
103
|
+
unless ARGV[1]
|
104
|
+
puts 'Please add some text to the comment!'
|
105
|
+
exit 1
|
106
|
+
end
|
107
|
+
|
108
|
+
Circlemator::PrCommenter.new(options).comment ARGV[1]
|
86
109
|
else
|
87
110
|
puts parser
|
88
111
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'httparty'
|
3
|
+
require 'json'
|
4
|
+
require 'pronto'
|
5
|
+
require 'pronto/commentator'
|
6
|
+
require 'circlemator/pr_finder'
|
7
|
+
|
8
|
+
module Circlemator
|
9
|
+
class CodeAnalyser
|
10
|
+
def initialize(opts)
|
11
|
+
@opts = opts
|
12
|
+
@base_branch = opts.fetch(:base_branch)
|
13
|
+
end
|
14
|
+
|
15
|
+
def check_coverage
|
16
|
+
require 'pronto/undercover'
|
17
|
+
run_pronto
|
18
|
+
end
|
19
|
+
|
20
|
+
def check_style
|
21
|
+
require 'pronto/rubocop'
|
22
|
+
run_pronto
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def run_pronto
|
28
|
+
Pronto.run("origin/#{@base_branch}", '.', formatter)
|
29
|
+
end
|
30
|
+
|
31
|
+
def formatter
|
32
|
+
pr_number, _ = PrFinder.new(@opts).find_pr
|
33
|
+
if pr_number
|
34
|
+
ENV['PRONTO_PULL_REQUEST_ID'] = pr_number.to_s
|
35
|
+
Pronto::Formatter::GithubPullRequestFormatter.new
|
36
|
+
else
|
37
|
+
Pronto::Formatter::GithubFormatter.new
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'circlemator/pr_finder'
|
3
|
+
|
4
|
+
module Circlemator
|
5
|
+
class PrCommenter
|
6
|
+
def initialize(opts)
|
7
|
+
github_repo = opts.fetch(:github_repo)
|
8
|
+
raise "#{github_repo} is invalid" unless github_repo.is_a? GithubRepo
|
9
|
+
|
10
|
+
@github_repo = github_repo
|
11
|
+
@sha = opts.fetch(:sha)
|
12
|
+
@opts = opts
|
13
|
+
end
|
14
|
+
|
15
|
+
def comment(text)
|
16
|
+
_, pr_url = PrFinder.new(@opts).find_pr
|
17
|
+
raise 'PR not found!' unless pr_url
|
18
|
+
|
19
|
+
response = @github_repo.post "#{pr_url}/reviews", body: { commit_id: @sha,
|
20
|
+
body: text,
|
21
|
+
event: 'COMMENT',
|
22
|
+
}.to_json
|
23
|
+
|
24
|
+
if response.code != 200
|
25
|
+
body = JSON.parse(response.body)
|
26
|
+
raise "PR Comment Failed: #{body.fetch('message')}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/circlemator/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: circlemator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emanuel Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.9.5
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.9.5
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pronto-rubocop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.9.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.9.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pronto-commentator
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pronto-undercover
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.1'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +178,48 @@ dependencies:
|
|
164
178
|
- - "~>"
|
165
179
|
- !ruby/object:Gem::Version
|
166
180
|
version: 4.6.4
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: simplecov
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: simplecov-html
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: simplecov-lcov
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
167
223
|
description: A few utilities for CircleCI to improve your CI workflow.
|
168
224
|
email:
|
169
225
|
- emanuel@rainforestqa.com
|
@@ -172,26 +228,29 @@ executables:
|
|
172
228
|
extensions: []
|
173
229
|
extra_rdoc_files: []
|
174
230
|
files:
|
231
|
+
- ".circleci/config.yml"
|
175
232
|
- ".gitignore"
|
176
233
|
- ".rspec"
|
177
234
|
- ".rubocop.yml"
|
178
235
|
- ".ruby-version"
|
236
|
+
- Dockerfile
|
179
237
|
- Gemfile
|
238
|
+
- Gemfile.lock
|
180
239
|
- Guardfile
|
181
240
|
- LICENSE
|
182
241
|
- README.md
|
183
242
|
- Rakefile
|
184
243
|
- bin/console
|
185
244
|
- bin/setup
|
186
|
-
- circle.yml
|
187
245
|
- circlemator.gemspec
|
188
246
|
- exe/circlemator
|
189
247
|
- lib/circlemator.rb
|
190
248
|
- lib/circlemator/build_canceler.rb
|
249
|
+
- lib/circlemator/code_analyser.rb
|
191
250
|
- lib/circlemator/github_repo.rb
|
251
|
+
- lib/circlemator/pr_commenter.rb
|
192
252
|
- lib/circlemator/pr_finder.rb
|
193
253
|
- lib/circlemator/self_merger.rb
|
194
|
-
- lib/circlemator/style_checker.rb
|
195
254
|
- lib/circlemator/version.rb
|
196
255
|
homepage: https://github.com/rainforestapp/circlemator
|
197
256
|
licenses:
|
@@ -213,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
272
|
version: '0'
|
214
273
|
requirements: []
|
215
274
|
rubyforge_project:
|
216
|
-
rubygems_version: 2.
|
275
|
+
rubygems_version: 2.7.3
|
217
276
|
signing_key:
|
218
277
|
specification_version: 4
|
219
278
|
summary: A bucket of tricks for CircleCI and Github.
|
data/circle.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'httparty'
|
3
|
-
require 'json'
|
4
|
-
require 'pronto'
|
5
|
-
require 'pronto/rubocop'
|
6
|
-
require 'pronto/commentator'
|
7
|
-
require 'circlemator/pr_finder'
|
8
|
-
|
9
|
-
module Circlemator
|
10
|
-
class StyleChecker
|
11
|
-
def initialize(opts)
|
12
|
-
@opts = opts
|
13
|
-
@base_branch = opts.fetch(:base_branch)
|
14
|
-
end
|
15
|
-
|
16
|
-
def check!
|
17
|
-
pr_number, _ = PrFinder.new(@opts).find_pr
|
18
|
-
if pr_number
|
19
|
-
ENV['PULL_REQUEST_ID'] = pr_number.to_s
|
20
|
-
formatter = ::Pronto::Formatter::GithubPullRequestFormatter.new
|
21
|
-
else
|
22
|
-
formatter = ::Pronto::Formatter::GithubFormatter.new
|
23
|
-
end
|
24
|
-
|
25
|
-
::Pronto.run("origin/#{@base_branch}", '.', formatter)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|