gitarro 0.1.85 → 0.1.86
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gitarro +8 -3
- data/lib/gitarro/backend.rb +19 -3
- data/lib/gitarro/opt_parser.rb +7 -0
- 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: d1060fb1ac1b396de8cf3d4262cab2b534f05cb1ca46aca564adb69bcc70991a
|
4
|
+
data.tar.gz: d855875451608261291992b8ed30dd5a55b38a0a0dc3f137d7d07ae439fd9977
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1936f7fdc6ee3654cb93cab8c2c964b55ac6eb0943f60a85347333307c7db17a69787b26dd21675c3b3e2cd88866981a8dffb57aef138ee88fff03eb5a1c36d0
|
7
|
+
data.tar.gz: 6fa07c2bee9524c77f2a315e2129d215e3a3f17b32b828bc4254650a59fefa4305e0a007e22f5d686c10446eb270b29bc6e5c42c40e56077c2cffb0203970a61
|
data/bin/gitarro
CHANGED
@@ -8,23 +8,28 @@ require 'gitarro/git_op'
|
|
8
8
|
require 'gitarro/backend'
|
9
9
|
|
10
10
|
b = Backend.new
|
11
|
-
|
11
|
+
prs = b.required_prs
|
12
12
|
|
13
|
-
prs = b.open_newer_prs
|
14
13
|
exit 0 if prs.empty?
|
15
14
|
|
16
15
|
prs.each do |pr|
|
17
|
-
puts '=' * 30 + "\n" + "TITLE_PR: #{pr.title}, NR: #{pr.number}
|
16
|
+
puts '=' * 30 + "\n" + "TITLE_PR: #{pr.title}, NR: #{pr.number}"
|
17
|
+
puts "DESCRIPTION:\n#{pr.body}\n" + '=' * 30
|
18
|
+
|
18
19
|
# check if prs contains the branch given otherwise just break
|
19
20
|
next unless b.pr_equal_specific_branch?(pr)
|
20
21
|
|
21
22
|
# this check the last commit state, catch for review or not reviewd status.
|
22
23
|
comm_st = b.client.status(b.repo, pr.head.sha)
|
23
24
|
|
25
|
+
# force test without any filter or check
|
26
|
+
break if b.force_run_test(pr)
|
27
|
+
|
24
28
|
# retrigger if magic word found
|
25
29
|
b.retrigger_check(pr)
|
26
30
|
# 0) do test for unreviewed pr
|
27
31
|
break if b.unreviewed_new_pr?(pr, comm_st)
|
32
|
+
|
28
33
|
# we run the test in 2 conditions:
|
29
34
|
# 1) the context is not set, test didnt run
|
30
35
|
# 2) the pending status is set on commit, repeat always when pending set
|
data/lib/gitarro/backend.rb
CHANGED
@@ -170,6 +170,13 @@ class Backend
|
|
170
170
|
@gbexec = TestExecutor.new(@options)
|
171
171
|
end
|
172
172
|
|
173
|
+
# public method retrieve pull request to process
|
174
|
+
def required_prs
|
175
|
+
return open_newer_prs if @options[:pr_number].nil?
|
176
|
+
|
177
|
+
[@client.pull_request(@repo, @options[:pr_number])]
|
178
|
+
end
|
179
|
+
|
173
180
|
# public method for check if pr belong to user specified branch
|
174
181
|
# if the pr belong to the branch continue tests
|
175
182
|
# otherwise just skip tests without setting any status
|
@@ -192,9 +199,18 @@ class Backend
|
|
192
199
|
prs
|
193
200
|
end
|
194
201
|
|
202
|
+
# public forcing to run the test
|
203
|
+
def force_run_test(pr)
|
204
|
+
return false unless @force_test && defined?(@pr_number)
|
205
|
+
|
206
|
+
print_test_required
|
207
|
+
gbexec.export_pr_data(pr)
|
208
|
+
launch_test_and_setup_status(pr)
|
209
|
+
end
|
210
|
+
|
195
211
|
# public for retrigger the test
|
196
212
|
def retrigger_check(pr)
|
197
|
-
return unless retrigger_needed?(pr)
|
213
|
+
return false unless retrigger_needed?(pr)
|
198
214
|
|
199
215
|
print_test_required
|
200
216
|
gbexec.export_pr_data(pr)
|
@@ -216,7 +232,7 @@ class Backend
|
|
216
232
|
def unreviewed_new_pr?(pr, comm_st)
|
217
233
|
return unless commit_is_unreviewed?(comm_st)
|
218
234
|
|
219
|
-
return if empty_files_changed_by_pr?(pr)
|
235
|
+
return true if empty_files_changed_by_pr?(pr)
|
220
236
|
|
221
237
|
# gb.check is true when there is a job running as scheduler
|
222
238
|
# which doesn't execute the test but trigger another job
|
@@ -259,7 +275,7 @@ class Backend
|
|
259
275
|
# this function will check if the PR contains a checkbox
|
260
276
|
# for retrigger all the tests.
|
261
277
|
def retriggered_by_checkbox?(pr, context)
|
262
|
-
return false unless pr.body.
|
278
|
+
return false unless pr.body.match(/\[x\]\s+Re-run\s+test\s+#{context}/i)
|
263
279
|
|
264
280
|
skipped = ''
|
265
281
|
unless empty_files_changed_by_pr?(pr)
|
data/lib/gitarro/opt_parser.rb
CHANGED
@@ -37,6 +37,11 @@ module OptionalOptions
|
|
37
37
|
opt.on('-C', '--check', desc) { |check| @options[:check] = check }
|
38
38
|
end
|
39
39
|
|
40
|
+
def force_test_opt(opt)
|
41
|
+
desc = 'Force to run a test, even if is not marked to be re-triggered.'
|
42
|
+
opt.on('-F', '--force_test', desc) { |force_test| @options[:force_test] = force_test }
|
43
|
+
end
|
44
|
+
|
40
45
|
def no_shallow(opt)
|
41
46
|
desc = 'If enabled, gitarro will not use git shallow clone'
|
42
47
|
opt.on('--noshallow', desc) { |noshallow| @options[:noshallow] = noshallow }
|
@@ -106,6 +111,7 @@ module OptionalOptions
|
|
106
111
|
opt.separator "\n Optional options:"
|
107
112
|
desc_opt(opt)
|
108
113
|
check_opt(opt)
|
114
|
+
force_test_opt(opt)
|
109
115
|
branch_opt(opt)
|
110
116
|
no_shallow(opt)
|
111
117
|
file_opt(opt)
|
@@ -171,6 +177,7 @@ class OptParserInternal
|
|
171
177
|
|
172
178
|
# set some default values
|
173
179
|
def defaults_false
|
180
|
+
@options[:force_test] = false if @options[:force_test].nil?
|
174
181
|
@options[:check] = false if @options[:check].nil?
|
175
182
|
@options[:target_url] = '' if @options[:target_url].nil?
|
176
183
|
@options[:https] = false if @options[:https].nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitarro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.86
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dario Maiocchi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: english
|