fast_ci 1.0.11 → 1.1.1
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/Gemfile.lock +6 -6
- data/lib/fast_ci/version.rb +1 -1
- data/lib/fast_ci.rb +24 -14
- data/lib/minitest/fastci_plugin.rb +39 -0
- data/lib/minitest/reporters/fastci_reporter.rb +5 -36
- 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: cde3318f98f75d587d3151007dd38a0336106709b3df12bc971fc720275adc64
|
4
|
+
data.tar.gz: a600f3f55cdf8c479b9b9f555e3a9818d2a26113af146994c5ce809c38b928da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 654096c3ac8764a47cf7122a66e6b931fe349fffea27e37cbe1875de914efe9d3acad2fe319783fbd0c0651099fb23e510324ad399b8835980b58b070be7e65e
|
7
|
+
data.tar.gz: fe743b69df08bd40150ad3d09a93e468b81217a36462d5c3e872db32351aa9b74ed11dad06e70f8574cb211cf5e32ac38e573d5e3681b4e0682e0d14d8590632
|
data/Gemfile.lock
CHANGED
@@ -11,7 +11,7 @@ GIT
|
|
11
11
|
PATH
|
12
12
|
remote: .
|
13
13
|
specs:
|
14
|
-
fast_ci (1.
|
14
|
+
fast_ci (1.1.1)
|
15
15
|
async-websocket (<= 0.20.0)
|
16
16
|
brakeman (>= 5.4.1)
|
17
17
|
console (>= 1.10.0)
|
@@ -80,7 +80,7 @@ GEM
|
|
80
80
|
diff-lcs (1.5.0)
|
81
81
|
docile (1.4.1)
|
82
82
|
equalizer (0.0.11)
|
83
|
-
erubi (1.13.
|
83
|
+
erubi (1.13.1)
|
84
84
|
fiber-local (1.0.0)
|
85
85
|
flay (2.13.3)
|
86
86
|
erubi (~> 1.10)
|
@@ -98,13 +98,13 @@ GEM
|
|
98
98
|
launchy (3.0.1)
|
99
99
|
addressable (~> 2.8)
|
100
100
|
childprocess (~> 5.0)
|
101
|
-
logger (1.6.
|
101
|
+
logger (1.6.4)
|
102
102
|
loofah (2.23.1)
|
103
103
|
crass (~> 1.0.2)
|
104
104
|
nokogiri (>= 1.12.0)
|
105
105
|
method_source (1.0.0)
|
106
|
-
mini_portile2 (2.8.
|
107
|
-
minitest (5.25.
|
106
|
+
mini_portile2 (2.8.8)
|
107
|
+
minitest (5.25.4)
|
108
108
|
minitest-rails (6.1.1)
|
109
109
|
minitest (~> 5.10)
|
110
110
|
railties (~> 6.1.0)
|
@@ -179,7 +179,7 @@ GEM
|
|
179
179
|
simplecov (>= 0.17.0)
|
180
180
|
tty-which (~> 0.4.0)
|
181
181
|
virtus (~> 1.0)
|
182
|
-
sexp_processor (4.17.
|
182
|
+
sexp_processor (4.17.3)
|
183
183
|
simplecov (0.22.0)
|
184
184
|
docile (~> 1.1)
|
185
185
|
simplecov-html (~> 0.11)
|
data/lib/fast_ci/version.rb
CHANGED
data/lib/fast_ci.rb
CHANGED
@@ -54,8 +54,16 @@ module FastCI
|
|
54
54
|
minitest_ws.await
|
55
55
|
end
|
56
56
|
|
57
|
+
def error(msg)
|
58
|
+
STDERR.puts "\e[31m[FastCI] #{msg}\e[0m"
|
59
|
+
end
|
60
|
+
|
57
61
|
def debug(msg)
|
58
|
-
puts "\
|
62
|
+
puts "\e[36mDEBUG: \e[0m #{msg}\n" if ENV["FAST_CI_DEBUG"]
|
63
|
+
end
|
64
|
+
|
65
|
+
def log(msg)
|
66
|
+
puts "\e[0m[FastCI] #{msg}\e[0m"
|
59
67
|
end
|
60
68
|
|
61
69
|
def report_options(run_key, content)
|
@@ -138,13 +146,13 @@ module FastCI
|
|
138
146
|
rescue Async::WebSocket::ProtocolError => e
|
139
147
|
case e.message
|
140
148
|
when "Failed to negotiate connection: 401"
|
141
|
-
|
149
|
+
FastCI.error("Failed to connect: Invalid secret key!")
|
142
150
|
exit 2
|
143
151
|
when "Failed to negotiate connection: 403"
|
144
|
-
|
152
|
+
FastCI.error("Failed to connect: Invalid or disabled run key!")
|
145
153
|
exit 2
|
146
|
-
|
147
|
-
|
154
|
+
else
|
155
|
+
FastCI.error("Failed to connect: General connection error!")
|
148
156
|
exit 2
|
149
157
|
end
|
150
158
|
end
|
@@ -163,7 +171,7 @@ module FastCI
|
|
163
171
|
|
164
172
|
case response&.dig(:event) || message[:event]
|
165
173
|
when "phx_error"
|
166
|
-
raise("
|
174
|
+
raise("Unexpected server error")
|
167
175
|
when "join"
|
168
176
|
handle_join(response)
|
169
177
|
when "failed_join"
|
@@ -179,15 +187,12 @@ module FastCI
|
|
179
187
|
else
|
180
188
|
break
|
181
189
|
end
|
182
|
-
when "error"
|
183
|
-
raise(response.inspect)
|
184
190
|
else
|
185
|
-
|
191
|
+
raise(response.inspect)
|
186
192
|
end
|
187
193
|
end
|
188
194
|
rescue => e
|
189
|
-
|
190
|
-
puts e.backtrace.join("\n")
|
195
|
+
FastCI.error("Unexpected error: #{e.message}\n\t#{e.backtrace.join("\n\t")}")
|
191
196
|
task&.stop
|
192
197
|
end
|
193
198
|
end
|
@@ -227,8 +232,13 @@ module FastCI
|
|
227
232
|
end
|
228
233
|
|
229
234
|
def handle_join_fail(response)
|
230
|
-
|
231
|
-
|
235
|
+
if response[:state] == "passed"
|
236
|
+
FastCI.log("Can't join because of run's state being: #{response[:state]}")
|
237
|
+
exit 0
|
238
|
+
else
|
239
|
+
FastCI.error("Can't join because of run's state being: #{response[:state]}")
|
240
|
+
exit 1
|
241
|
+
end
|
232
242
|
end
|
233
243
|
|
234
244
|
def handle_deq_request(_response)
|
@@ -240,7 +250,7 @@ module FastCI
|
|
240
250
|
end
|
241
251
|
|
242
252
|
def topic
|
243
|
-
"test_orchestrator:#{run_key}-#{FastCI.configuration.build_id}"
|
253
|
+
"test_orchestrator:#{run_key}-#{FastCI.configuration.commit}-#{FastCI.configuration.build_id}"
|
244
254
|
end
|
245
255
|
|
246
256
|
def endpoint
|
@@ -3,6 +3,45 @@ require_relative "reporters/fastci_reporter"
|
|
3
3
|
module Minitest
|
4
4
|
def self.plugin_fastci_init(options)
|
5
5
|
if ENV['FAST_CI_SECRET_KEY'].present?
|
6
|
+
FastCI.configure { |c| c.run_key = "minitest" }
|
7
|
+
Minitest.class_eval do
|
8
|
+
class<< self
|
9
|
+
def __run reporter, options
|
10
|
+
suites = Minitest::Runnable.runnables
|
11
|
+
tests = {}
|
12
|
+
suit_paths = {}
|
13
|
+
suites.each do |suite|
|
14
|
+
path = "./#{Object.const_source_location(suite.name)[0].gsub(Regexp.new("^#{::Rails.root}/"), '')}"
|
15
|
+
next if path.starts_with?('./vendor/bundle')
|
16
|
+
tests[path] ||= { run_time: 0.0, file_status: 'pending', test_count: suite.runnable_methods.count, test_counters: { failed: 0, passed: 0, pending: 0 }, '1' => {} }
|
17
|
+
suit_paths[path] = suite
|
18
|
+
suite.runnable_methods.each_with_index do |method, ix|
|
19
|
+
description = method.split(':')[1..-1].join(':')
|
20
|
+
tests[path]['1'][(ix + 1).to_s] ||= { status: 'pending', description: description }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
FastCI.minitest_ws.on(:enq_request) do
|
25
|
+
tests
|
26
|
+
end
|
27
|
+
|
28
|
+
FastCI.minitest_ws.on(:deq) do |api_tests|
|
29
|
+
run_suites = api_tests.map do |test_path|
|
30
|
+
suit_paths[test_path]
|
31
|
+
end
|
32
|
+
parallel, serial = run_suites.partition { |s| s.test_order == :parallel }
|
33
|
+
|
34
|
+
serial.map { |suite| suite.run reporter, options }
|
35
|
+
parallel.map { |suite| suite.run reporter, options }
|
36
|
+
|
37
|
+
fc_reporter = reporter.report.select {|r| r.class == Minitest::Reporters::FastCIReporter }.first
|
38
|
+
fc_reporter.test_results
|
39
|
+
end
|
40
|
+
FastCI.minitest_await
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
6
45
|
Minitest.reporter << Minitest::Reporters::FastCIReporter.new
|
7
46
|
end
|
8
47
|
end
|
@@ -31,18 +31,6 @@ module Minitest
|
|
31
31
|
@test_results = {}
|
32
32
|
@ids = {}
|
33
33
|
@events = []
|
34
|
-
|
35
|
-
$stdout = StringIO.new()
|
36
|
-
|
37
|
-
if ENV['RBCI_REMOTE_TESTS'] != 'true'
|
38
|
-
FastCI.minitest_ws.on(:enq_request) do
|
39
|
-
tests
|
40
|
-
end
|
41
|
-
|
42
|
-
FastCI.minitest_ws.on(:deq) do |api_tests|
|
43
|
-
test_results
|
44
|
-
end
|
45
|
-
end
|
46
34
|
end
|
47
35
|
|
48
36
|
def start
|
@@ -63,20 +51,18 @@ module Minitest
|
|
63
51
|
end
|
64
52
|
|
65
53
|
def before_test(test)
|
66
|
-
$stdout = StringIO.new()
|
67
54
|
end
|
68
55
|
|
69
56
|
def prerecord(klass, name)
|
70
57
|
description = test_description(name)
|
71
58
|
path = test_path(klass.name)
|
72
59
|
|
73
|
-
test_results[path] ||= {
|
74
|
-
test_results[path][:test_count] += 1
|
60
|
+
test_results[path] ||= { '1' => {} }
|
75
61
|
|
76
62
|
id = (test_results[path]['1'].keys.size + 1).to_s
|
77
63
|
ids[description] = id
|
78
64
|
|
79
|
-
test_results[path]['1'][id] ||= { status: 'pending'
|
65
|
+
test_results[path]['1'][id] ||= { status: 'pending' }
|
80
66
|
test_results[path]['1'][id][:start] = Minitest.clock_time
|
81
67
|
|
82
68
|
tests[path] ||= { run_time: 0.0, file_status: 'pending', test_count: 0, test_counters: { failed: 0, passed: 0, pending: 0 }, '1' => {} }
|
@@ -85,7 +71,6 @@ module Minitest
|
|
85
71
|
end
|
86
72
|
|
87
73
|
def record(result)
|
88
|
-
test_finished(result)
|
89
74
|
description = test_description(result.name)
|
90
75
|
id = ids[description]
|
91
76
|
path = test_path(result.klass)
|
@@ -93,8 +78,8 @@ module Minitest
|
|
93
78
|
test_results[path]['1'][id][:end] = Minitest.clock_time
|
94
79
|
test_results[path]['1'][id][:run_time] = test_results[path]['1'][id][:end] - test_results[path]['1'][id][:start]
|
95
80
|
test_results[path]['1'][id][:status] = result_status(result).to_s
|
96
|
-
test_results[path][
|
97
|
-
test_results[path][
|
81
|
+
test_results[path]['1'][id].delete(:start)
|
82
|
+
test_results[path]['1'][id].delete(:end)
|
98
83
|
end
|
99
84
|
|
100
85
|
def report
|
@@ -108,13 +93,6 @@ module Minitest
|
|
108
93
|
file_status = 'failed'
|
109
94
|
end
|
110
95
|
end
|
111
|
-
test_results[path][:file_status] = file_status
|
112
|
-
end
|
113
|
-
|
114
|
-
if ENV['RBCI_REMOTE_TESTS'] == 'true'
|
115
|
-
send_events
|
116
|
-
else
|
117
|
-
FastCI.minitest_await
|
118
96
|
end
|
119
97
|
end
|
120
98
|
|
@@ -131,16 +109,7 @@ module Minitest
|
|
131
109
|
end
|
132
110
|
end
|
133
111
|
|
134
|
-
|
135
|
-
|
136
|
-
if pass
|
137
|
-
@events << ['run_minitest'.upcase, { succeed_after: 1 }]
|
138
|
-
else
|
139
|
-
@events << ['run_minitest'.upcase, { failed_after: 1 }]
|
140
|
-
end
|
141
|
-
send_events if ENV['RBCI_REMOTE_TESTS'] == 'true'
|
142
|
-
|
143
|
-
return pass
|
112
|
+
return results.any? {|reult| !result }
|
144
113
|
end
|
145
114
|
|
146
115
|
def method_missing(method, *args)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_ci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nesha Zoric
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: console
|