rspec-mergify 0.0.1 → 0.0.3
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/lib/mergify/rspec/configuration.rb +19 -0
- data/lib/mergify/rspec/formatter.rb +13 -2
- data/lib/mergify/rspec/version.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a1ee16535a80623dfcca5bd323c52ee4743503040198e1aae945a17a4ce78ed
|
|
4
|
+
data.tar.gz: d60592e2447449c11f81ff3a9fe0ef6448b4dd657c5083e35595acf9e7e68621
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4f1117fc75677a5b1692f54eefc99b23679b976a57905cea6557a2b371a70dc40a16b78fad566e04794bd98168e1b64a813d99073ab1b70ce92534761549567
|
|
7
|
+
data.tar.gz: 4229140614275e54eff25041d6f0b72edabb801492d66280131f62b2622fc7a807929250f0ac9f78fe2c048011784d22da2285d2f0522f0550a963e6baa025de
|
|
@@ -16,6 +16,16 @@ module Mergify
|
|
|
16
16
|
# Add formatter when in CI
|
|
17
17
|
config.add_formatter(Mergify::RSpec::Formatter) if Utils.in_ci?
|
|
18
18
|
|
|
19
|
+
# Flaky detection: prepare session with all example IDs
|
|
20
|
+
config.before(:suite) do
|
|
21
|
+
ci = Mergify::RSpec.ci_insights
|
|
22
|
+
fd = ci&.flaky_detector
|
|
23
|
+
if fd
|
|
24
|
+
all_ids = ::RSpec.world.example_groups.flat_map(&:descendants).flat_map(&:examples).map(&:id)
|
|
25
|
+
fd.prepare_for_session(all_ids)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
19
29
|
# Quarantine: mark tests before execution
|
|
20
30
|
config.before(:each) do |example|
|
|
21
31
|
ci = Mergify::RSpec.ci_insights
|
|
@@ -32,6 +42,15 @@ module Mergify
|
|
|
32
42
|
|
|
33
43
|
example.run
|
|
34
44
|
|
|
45
|
+
# Feed metrics from the initial run so the detector can evaluate
|
|
46
|
+
if fd
|
|
47
|
+
run_time = example.execution_result.run_time || 0.0
|
|
48
|
+
status = example.execution_result.status
|
|
49
|
+
fd.fill_metrics_from_report(example.id, 'setup', 0.0, status)
|
|
50
|
+
fd.fill_metrics_from_report(example.id, 'call', run_time, status)
|
|
51
|
+
fd.fill_metrics_from_report(example.id, 'teardown', 0.0, status)
|
|
52
|
+
end
|
|
53
|
+
|
|
35
54
|
next unless fd&.rerunning_test?(example.id)
|
|
36
55
|
|
|
37
56
|
fd.set_test_deadline(example.id)
|
|
@@ -189,13 +189,13 @@ module Mergify
|
|
|
189
189
|
output.puts report if report
|
|
190
190
|
end
|
|
191
191
|
|
|
192
|
-
def flush_and_shutdown
|
|
192
|
+
def flush_and_shutdown # rubocop:disable Metrics/MethodLength
|
|
193
193
|
return unless @ci_insights&.tracer_provider
|
|
194
194
|
|
|
195
195
|
begin
|
|
196
196
|
@ci_insights.tracer_provider.force_flush
|
|
197
197
|
rescue StandardError => e
|
|
198
|
-
|
|
198
|
+
print_export_error(e)
|
|
199
199
|
end
|
|
200
200
|
|
|
201
201
|
begin
|
|
@@ -204,6 +204,17 @@ module Mergify
|
|
|
204
204
|
output.puts "Error while shutting down the tracer: #{e.message}"
|
|
205
205
|
end
|
|
206
206
|
end
|
|
207
|
+
|
|
208
|
+
def print_export_error(error)
|
|
209
|
+
output.puts "Error while exporting traces: #{error.message}"
|
|
210
|
+
output.puts ''
|
|
211
|
+
output.puts 'Common issues:'
|
|
212
|
+
output.puts ' - Your MERGIFY_TOKEN might not be set or could be invalid'
|
|
213
|
+
output.puts ' - CI Insights might not be enabled for this repository'
|
|
214
|
+
output.puts ' - There might be a network connectivity issue with the Mergify API'
|
|
215
|
+
output.puts ''
|
|
216
|
+
output.puts 'Documentation: https://docs.mergify.com/ci-insights/test-frameworks/'
|
|
217
|
+
end
|
|
207
218
|
end
|
|
208
219
|
# rubocop:enable Metrics/ClassLength
|
|
209
220
|
end
|
|
@@ -2,8 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
module Mergify
|
|
4
4
|
module RSpec
|
|
5
|
-
VERSION =
|
|
6
|
-
v
|
|
5
|
+
VERSION = begin
|
|
6
|
+
v = `git describe --tags 2>/dev/null`.strip.delete_prefix('v')
|
|
7
|
+
if v.empty?
|
|
8
|
+
'0.0.0.dev'
|
|
9
|
+
elsif v.include?('-')
|
|
10
|
+
# e.g. "0.1.0-3-gabc123" -> "0.1.0.dev3"
|
|
11
|
+
parts = v.split('-')
|
|
12
|
+
"#{parts[0]}.dev#{parts[1]}"
|
|
13
|
+
else
|
|
14
|
+
v
|
|
15
|
+
end
|
|
7
16
|
end
|
|
8
17
|
end
|
|
9
18
|
end
|