mergify-ci-core 2026.10.8-aarch64-linux

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.
@@ -0,0 +1,147 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mergify
4
+ module CI
5
+ module Core
6
+ # The Rust extension over mergify-ci-session: the session shared with the
7
+ # pytest and TypeScript clients.
8
+ #
9
+ # Loading is best-effort by design. A precompiled gem carries one
10
+ # extension per Ruby under `<ruby>/`, the source gem compiles one
11
+ # alongside this file, and a platform we publish neither for gets
12
+ # neither. Detection is one input to telemetry, not the point of the gem,
13
+ # so an absent extension degrades what we can report rather than breaking
14
+ # the suite under test -- the same fail-open posture the napi binding
15
+ # takes when a platform has no prebuilt binary. `load_error` keeps the
16
+ # reason, for callers that want to say so.
17
+ module Native
18
+ class << self
19
+ # The LoadError that prevented the extension loading, or nil.
20
+ attr_accessor :load_error
21
+
22
+ def available?
23
+ load_error.nil?
24
+ end
25
+
26
+ # Which of the two failed requires actually explains the absence.
27
+ #
28
+ # A precompiled gem ships lib/mergify/ci/core/<ruby>/mergify_ci.<dlext>,
29
+ # so when one is packed for this Ruby that require is the real attempt:
30
+ # it fails with something like "version `GLIBC_2.29' not found", and the
31
+ # fallback that follows only ever adds "cannot load such file", which
32
+ # sends the reader looking for the wrong thing. With no extension for
33
+ # this Ruby -- the source gem, or a platform we publish no gem for --
34
+ # it is the other way round.
35
+ # Require a file next to this one, returning the LoadError instead of
36
+ # raising it. Two attempts read better as values than as nested rescues.
37
+ def attempt_require(path)
38
+ require_relative path
39
+ nil
40
+ rescue LoadError => e
41
+ e
42
+ end
43
+
44
+ def load_failure_reason(versioned, fallback)
45
+ packed = Dir.glob(File.join(__dir__, RUBY_VERSION.to_f.to_s, 'mergify_ci.*')).any?
46
+ packed ? versioned : fallback
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ # Precompiled gems ship lib/mergify/ci/core/<ruby>/mergify_ci.<dlext>; the
55
+ # source gem and any local `rake compile` put one beside this file instead.
56
+ versioned_error = Mergify::CI::Core::Native.attempt_require("#{RUBY_VERSION.to_f}/mergify_ci")
57
+ fallback_error = versioned_error && Mergify::CI::Core::Native.attempt_require('mergify_ci')
58
+
59
+ if fallback_error
60
+ Mergify::CI::Core::Native.load_error =
61
+ Mergify::CI::Core::Native.load_failure_reason(versioned_error, fallback_error)
62
+ end
63
+
64
+ unless Mergify::CI::Core::Native.available?
65
+ # Stand in for the extension so callers can just ask, and get the same answer
66
+ # they would get from a machine that is not in CI. Branching on availability
67
+ # at every call site would only spread the same nil back through the caller.
68
+ module Mergify
69
+ module CI
70
+ module Core
71
+ module Native
72
+ # A session that detects nothing, as on a machine that is not in CI.
73
+ class Session
74
+ def self.start(*)
75
+ new
76
+ end
77
+
78
+ # Nothing detected, so nothing to report to.
79
+ def reports?
80
+ false
81
+ end
82
+
83
+ def repository_name
84
+ nil
85
+ end
86
+
87
+ # Nothing detected: no run to name.
88
+ def run_id
89
+ nil
90
+ end
91
+
92
+ # Nothing to send a verdict with: it neither folds nor reports.
93
+ def record_test(_example_id, _status, _run_time); end
94
+
95
+ # Nothing to ask with: every example runs.
96
+ def select(_example_ids)
97
+ { 'outcome' => 'full' }
98
+ end
99
+
100
+ def executed_count
101
+ 0
102
+ end
103
+
104
+ def report_verdict(_failed_outside_examples); end
105
+
106
+ def captured_verdict
107
+ nil
108
+ end
109
+
110
+ # Nothing to send a trace with either.
111
+ def record_case(_example); end
112
+
113
+ def record_retry(_example_id, _status, _duration_ms); end
114
+
115
+ def report_trace(_failed); end
116
+
117
+ # Nothing reported: nothing to say.
118
+ def summary(_partial)
119
+ []
120
+ end
121
+
122
+ def captured_trace
123
+ nil
124
+ end
125
+
126
+ # Nothing to rerun with.
127
+ def prepare_reruns(_example_ids)
128
+ nil
129
+ end
130
+
131
+ def state_former_names(_former_names); end
132
+
133
+ def flaky_detection_runs?
134
+ false
135
+ end
136
+
137
+ def flaky_detection_fails_the_run?
138
+ false
139
+ end
140
+
141
+ def record_attempt(_test, _outcome, _duration_ms); end
142
+ end
143
+ end
144
+ end
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
5
+ module Mergify
6
+ module CI
7
+ module Core
8
+ # How the Ruby clients name a test their framework declares inside
9
+ # groups, an RSpec `describe` or a Minitest spec one, so both give the
10
+ # same test the same name: `<file> > <groups> > <title>`, the shape the
11
+ # TypeScript clients use too, the file relative to the directory the run
12
+ # started in. Nothing in it counts tests, so adding one names no other
13
+ # one anew.
14
+ module TestNames
15
+ module_function
16
+
17
+ SEPARATOR = ' > '
18
+
19
+ # What opens and closes a block, around the code `block_text` keeps.
20
+ DELIMITERS = [/\A\{(.*)\}\z/m, /\Ado\b(.*)\bend\z/m].freeze
21
+
22
+ # The name of the test `title` declared in `file`, in `groups`,
23
+ # outermost first.
24
+ def spec_name(file, groups, title, root)
25
+ [relative(file, root), *groups, title].join(SEPARATOR)
26
+ end
27
+
28
+ # `file` relative to `root`, or as it is when it is not under it
29
+ # (another drive, on Windows). Both are expanded, so a root given
30
+ # without a drive gets the one the file does.
31
+ def relative(file, root)
32
+ Pathname.new(File.expand_path(file)).relative_path_from(Pathname.new(File.expand_path(root))).to_s
33
+ rescue ArgumentError
34
+ file
35
+ end
36
+
37
+ # The title of a test written without text of its own: the code of its
38
+ # block, on one line, without its braces or its `do` and `end`. Nil
39
+ # when there is none to read: an empty block, or one whose file is
40
+ # gone or that an `eval` defined.
41
+ def block_text(block)
42
+ code = block_code(block)
43
+ return unless code
44
+
45
+ inner = DELIMITERS.lazy.filter_map { |delimited| code[delimited, 1] }.first
46
+ text = inner&.split&.join(' ')
47
+ text unless text.nil? || text.empty?
48
+ end
49
+
50
+ # The source of `block` (a proc, or a method one defined), as its file
51
+ # holds it.
52
+ def block_code(block)
53
+ file, first_line, first_column, last_line, last_column = code_location(block)
54
+ return unless file && File.file?(file)
55
+
56
+ lines = File.readlines(file)[(first_line - 1)..(last_line - 1)]
57
+ between(lines, first_column, last_column) if lines&.size == last_line - first_line + 1
58
+ end
59
+
60
+ # `lines` from `first_column` of the first to `last_column` of the last.
61
+ def between(lines, first_column, last_column)
62
+ lines[-1] = lines[-1].byteslice(0, last_column)
63
+ lines[0] = lines[0].byteslice(first_column..)
64
+ lines.join
65
+ end
66
+
67
+ # Where Ruby compiled `block` from: its file, then the line and column
68
+ # it starts at and the ones it ends at, the columns in bytes. Nothing
69
+ # for code an `eval` compiled, which has no absolute path whatever file
70
+ # it claims, and whose columns are the evaluated string's.
71
+ def code_location(block)
72
+ code = RubyVM::InstructionSequence.of(block)
73
+ location = code&.to_a&.dig(4, :code_location)
74
+ [code.absolute_path, *location] if code&.absolute_path && location
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mergify
4
+ module CI
5
+ module Core
6
+ # What every Ruby client reads of its own switches the same way.
7
+ module Utils
8
+ module_function
9
+
10
+ TRUTHY_STRINGS = %w[y yes t true on 1].freeze
11
+
12
+ # Returns true when the named environment variable holds a truthy value.
13
+ def env_truthy?(key)
14
+ TRUTHY_STRINGS.include?(ENV.fetch(key, '').downcase)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mergify
4
+ module CI
5
+ module Core
6
+ # Placeholder: the release workflow stamps the real version from the git
7
+ # tag at build time, the same one it stamps into every Ruby client built
8
+ # on this gem, which each pins exactly.
9
+ VERSION = '2026.10.8'
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'core/version'
4
+ require_relative 'core/utils'
5
+ require_relative 'core/test_names'
6
+ require_relative 'core/native'
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mergify-ci-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 2026.10.8
5
+ platform: aarch64-linux
6
+ authors:
7
+ - Mergify
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-10-23 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 'The compiled session rspec-mergify and minitest-mergify run on: CI detection,
14
+ the trace, the verdict, quarantine, Test Selection and flaky detection.'
15
+ email:
16
+ - support@mergify.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - LICENSE
22
+ - README.md
23
+ - THIRD_PARTY_LICENSES
24
+ - lib/mergify/ci/core.rb
25
+ - lib/mergify/ci/core/3.1/mergify_ci.so
26
+ - lib/mergify/ci/core/3.2/mergify_ci.so
27
+ - lib/mergify/ci/core/3.3/mergify_ci.so
28
+ - lib/mergify/ci/core/3.4/mergify_ci.so
29
+ - lib/mergify/ci/core/4.0/mergify_ci.so
30
+ - lib/mergify/ci/core/native.rb
31
+ - lib/mergify/ci/core/test_names.rb
32
+ - lib/mergify/ci/core/utils.rb
33
+ - lib/mergify/ci/core/version.rb
34
+ homepage: https://docs.mergify.com/test-engine/
35
+ licenses:
36
+ - LicenseRef-Mergify-Proprietary
37
+ metadata:
38
+ homepage_uri: https://docs.mergify.com/test-engine/
39
+ bug_tracker_uri: https://github.com/Mergifyio/mergify-cli/issues
40
+ rubygems_mfa_required: 'true'
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '3.1'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: 4.1.dev
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubygems_version: 3.5.23
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: The native core of Mergify's Ruby test clients
63
+ test_files: []