duel 0.1.7 → 0.2.0
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/AGENT_PROMPT.md +2 -2
- data/CHANGELOG.md +203 -1
- data/README.md +41 -1
- data/docs/ci.md +170 -76
- data/docs/configuration.md +38 -2
- data/docs/how-it-works.md +18 -9
- data/docs/plugins.md +23 -0
- data/lib/duel/across.rb +1 -6
- data/lib/duel/baseline.rb +8 -7
- data/lib/duel/cli.rb +96 -28
- data/lib/duel/comment.rb +296 -0
- data/lib/duel/config.rb +124 -4
- data/lib/duel/context.rb +33 -34
- data/lib/duel/control.rb +52 -0
- data/lib/duel/init.rb +255 -20
- data/lib/duel/lane.rb +734 -0
- data/lib/duel/lock.rb +34 -4
- data/lib/duel/memory.rb +14 -5
- data/lib/duel/metric.rb +97 -26
- data/lib/duel/native.rb +199 -32
- data/lib/duel/platform.rb +31 -0
- data/lib/duel/process_sample.rb +74 -49
- data/lib/duel/resource.rb +71 -42
- data/lib/duel/result.rb +165 -0
- data/lib/duel/rubies.rb +21 -3
- data/lib/duel/runner.rb +33 -1044
- data/lib/duel/spawn.rb +327 -0
- data/lib/duel/summary.rb +21 -15
- data/lib/duel/templates/duel.gitlab-ci.yml.erb +8 -19
- data/lib/duel/templates/perf-caller.yml.erb +43 -0
- data/lib/duel/templates/perf-comment-caller.yml.erb +42 -0
- data/lib/duel/templates/perf-comment.yml.erb +61 -44
- data/lib/duel/templates/perf.yml.erb +143 -7
- data/lib/duel/testing.rb +3 -0
- data/lib/duel/version.rb +1 -1
- data/lib/duel/worker.rb +13 -4
- data/lib/duel/worker_process.rb +142 -0
- data/lib/duel.rb +35 -3
- data/sig/duel/cli.rbs +19 -0
- data/sig/duel/comment.rbs +97 -0
- data/sig/duel/config.rbs +57 -2
- data/sig/duel/context.rbs +4 -31
- data/sig/duel/control.rbs +27 -0
- data/sig/duel/init.rbs +95 -1
- data/sig/duel/lane.rbs +202 -0
- data/sig/duel/lock.rbs +8 -1
- data/sig/duel/memory.rbs +1 -1
- data/sig/duel/metric.rbs +53 -10
- data/sig/duel/native.rbs +109 -9
- data/sig/duel/platform.rbs +13 -0
- data/sig/duel/process_sample.rbs +7 -9
- data/sig/duel/resource.rbs +28 -9
- data/sig/duel/result.rbs +164 -0
- data/sig/duel/rubies.rbs +4 -0
- data/sig/duel/runner.rbs +6 -460
- data/sig/duel/spawn.rbs +111 -0
- data/sig/duel/summary.rbs +6 -3
- data/sig/duel/worker_process.rbs +90 -0
- data/sig/duel.rbs +17 -3
- metadata +121 -105
data/lib/duel.rb
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "duel/version"
|
|
4
|
+
require_relative "duel/platform"
|
|
4
5
|
require_relative "duel/config"
|
|
5
6
|
require_relative "duel/metric"
|
|
7
|
+
require_relative "duel/control"
|
|
6
8
|
|
|
7
9
|
# Performance regression guards: every benchmark runs on two versions of
|
|
8
10
|
# a codebase side by side, the baseline and the candidate, and the
|
|
@@ -13,6 +15,11 @@ module Duel
|
|
|
13
15
|
# that didn't start (Failed).
|
|
14
16
|
class Error < StandardError; end
|
|
15
17
|
|
|
18
|
+
# What Duel raises when something a run needs fails: a resource that
|
|
19
|
+
# didn't start (Resource#failed), two that set a variable differently,
|
|
20
|
+
# a worker that died or hung.
|
|
21
|
+
class Failed < Error; end
|
|
22
|
+
|
|
16
23
|
# The hooks, which run code around a benchmark's samples: in .duel.rb
|
|
17
24
|
# (Config#setup, say), at the top of a file of benchmarks (DSL#setup),
|
|
18
25
|
# or as an option of one benchmark (DSL#duel's setup:). Where several
|
|
@@ -137,9 +144,10 @@ module Duel
|
|
|
137
144
|
end
|
|
138
145
|
end
|
|
139
146
|
|
|
140
|
-
# Loads a config file (.duel.rb)
|
|
141
|
-
# the file is.
|
|
142
|
-
#
|
|
147
|
+
# Loads a config file (.duel.rb) and returns its configuration: a
|
|
148
|
+
# fresh one, rooted where the file is, which is Duel.config from then
|
|
149
|
+
# on (what the file's Duel.configure sets up). For a tool that reads a
|
|
150
|
+
# project's settings, as a plugin's generator does (duel-rails's).
|
|
143
151
|
def load_config(path)
|
|
144
152
|
path = File.expand_path(path)
|
|
145
153
|
self.config = Config.new(File.dirname(path))
|
|
@@ -196,6 +204,14 @@ module Duel
|
|
|
196
204
|
# end
|
|
197
205
|
# end
|
|
198
206
|
#
|
|
207
|
+
# Where what it starts for each worker (a database server, say) takes
|
|
208
|
+
# more memory than Duel can see as it starts, its module says how much
|
|
209
|
+
# at most, in bytes, as +worker_memory+: Runner#fit counts that much
|
|
210
|
+
# for each worker, at least, as it fits the workers in the memory
|
|
211
|
+
# available. (A version of Duel before it asked ignores it.)
|
|
212
|
+
#
|
|
213
|
+
# def self.worker_memory = 450 << 20
|
|
214
|
+
#
|
|
199
215
|
# Its own kinds of benchmark, if it has any, are the methods of its
|
|
200
216
|
# module's DSL module, which files of benchmarks get as .duel.rb uses
|
|
201
217
|
# it (see DSL.add):
|
|
@@ -218,6 +234,22 @@ module Duel
|
|
|
218
234
|
# @api private
|
|
219
235
|
def plugins = @plugins ||= {} #: Hash[Symbol, Module & _Plugin]
|
|
220
236
|
|
|
237
|
+
# Whether Duel runs on Windows: for a plugin to do what it does
|
|
238
|
+
# differently there (start its server another way, say). For a
|
|
239
|
+
# plugin's default:
|
|
240
|
+
#
|
|
241
|
+
# def self.configure(config, pg_ctl: Duel.windows?)
|
|
242
|
+
def windows? = Platform::WINDOWS
|
|
243
|
+
|
|
244
|
+
# Whether a server that a plugin starts for a worker can listen on a
|
|
245
|
+
# Unix socket (in the worker's directory) that a worker can reach: not
|
|
246
|
+
# on Windows, nor where Ruby has none (see Control.unix_sockets?).
|
|
247
|
+
# Where it can't, the server listens on a port (see Resource#port).
|
|
248
|
+
# For a plugin's default:
|
|
249
|
+
#
|
|
250
|
+
# def self.configure(config, tcp: !Duel.unix_sockets?)
|
|
251
|
+
def unix_sockets? = Control.unix_sockets?(windows: windows?)
|
|
252
|
+
|
|
221
253
|
# The file of benchmarks that called the DSL method running (see
|
|
222
254
|
# DSL.add), if one is: the file that what it defines is filed
|
|
223
255
|
# under, so it gets that file's hooks, not those of the file the
|
data/sig/duel/cli.rbs
CHANGED
|
@@ -5,6 +5,10 @@ module Duel
|
|
|
5
5
|
# The environment (ENV, or a Hash in its place).
|
|
6
6
|
interface _Env
|
|
7
7
|
def reject: () { (String name, String value) -> boolish } -> _Variables
|
|
8
|
+
|
|
9
|
+
def fetch: (String name) -> String
|
|
10
|
+
|
|
11
|
+
def []: (String name) -> String?
|
|
8
12
|
end
|
|
9
13
|
|
|
10
14
|
# What's left of it.
|
|
@@ -52,8 +56,11 @@ module Duel
|
|
|
52
56
|
@json: String?
|
|
53
57
|
@settings: Settings?
|
|
54
58
|
@config: Config?
|
|
59
|
+
# The Config::RUN_SETTINGS options given.
|
|
60
|
+
@given: Array[Symbol]
|
|
55
61
|
@passed: bool?
|
|
56
62
|
@note: String?
|
|
63
|
+
@accepted: bool?
|
|
57
64
|
|
|
58
65
|
def initialize: (Array[String] argv, ?env: _Env, ?out: _Output, ?err: _Output) -> void
|
|
59
66
|
|
|
@@ -153,6 +160,12 @@ module Duel
|
|
|
153
160
|
# The candidate, in Markdown.
|
|
154
161
|
def described_candidate: (Config config, Settings settings) -> String
|
|
155
162
|
|
|
163
|
+
def merged: (String dir) -> String?
|
|
164
|
+
|
|
165
|
+
def merge_request: () -> Hash[String, untyped]
|
|
166
|
+
|
|
167
|
+
def pull_request: () -> Hash[String, untyped]?
|
|
168
|
+
|
|
156
169
|
# What chose a baseline of the last release: the release, or a change
|
|
157
170
|
# since it accepted with the label.
|
|
158
171
|
def last_release: (Config config, Baseline baseline) -> String
|
|
@@ -177,6 +190,12 @@ module Duel
|
|
|
177
190
|
# The environment's variables that are set.
|
|
178
191
|
def variables: () -> _Variables
|
|
179
192
|
|
|
193
|
+
# Sets a Config::RUN_SETTINGS setting to an option's +value+.
|
|
194
|
+
def given: (Settings settings, Symbol name, Float | Integer value) -> void
|
|
195
|
+
|
|
196
|
+
# Sets a setting, a number of processes not fitted to memory.
|
|
197
|
+
def set: (Settings settings, Symbol name, Float | Integer value) -> void
|
|
198
|
+
|
|
180
199
|
def parser: (Settings settings) -> OptionParser
|
|
181
200
|
end
|
|
182
201
|
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
module Duel
|
|
2
|
+
# `duel comment`: what the Perf comment workflow runs, to comment on a
|
|
3
|
+
# pull request with Duel's report.
|
|
4
|
+
# @api private
|
|
5
|
+
class Comment
|
|
6
|
+
USAGE: String
|
|
7
|
+
|
|
8
|
+
# The first release whose `duel comment` the workflow can run.
|
|
9
|
+
SINCE: String
|
|
10
|
+
|
|
11
|
+
# Where GitLab CI has what Duel said.
|
|
12
|
+
GITLAB: Hash[String, String]
|
|
13
|
+
|
|
14
|
+
# What Duel says in comment.env, as each line must have it.
|
|
15
|
+
SAID: Hash[String, Regexp]
|
|
16
|
+
|
|
17
|
+
# The characters a comment of reports has room for.
|
|
18
|
+
ROOM: Integer
|
|
19
|
+
|
|
20
|
+
# A report's, in a comment of them, where its Duel job failed first.
|
|
21
|
+
NONE: String
|
|
22
|
+
|
|
23
|
+
# The comments on a pull request, a page at a time.
|
|
24
|
+
COMMENTS: String
|
|
25
|
+
|
|
26
|
+
# The jq that picks GitHub Actions' token's comments.
|
|
27
|
+
LISTED: String
|
|
28
|
+
|
|
29
|
+
@argv: Array[String]
|
|
30
|
+
@env: CLI::_Env
|
|
31
|
+
@out: _Output
|
|
32
|
+
@err: _Output
|
|
33
|
+
@marker: String
|
|
34
|
+
@report: String?
|
|
35
|
+
@head: String?
|
|
36
|
+
@gitlab: bool?
|
|
37
|
+
|
|
38
|
+
def initialize: (Array[String] argv, env: CLI::_Env, out: _Output, err: _Output) -> void
|
|
39
|
+
|
|
40
|
+
# Returns the exit status: 0 commented (or had nothing to say), 1
|
|
41
|
+
# GitHub wouldn't take it, 2 a bad option.
|
|
42
|
+
def run: () -> Integer
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def parser: () -> OptionParser
|
|
47
|
+
|
|
48
|
+
# Comments, if Duel said to, and the pull request's head is still the
|
|
49
|
+
# run's.
|
|
50
|
+
def comment: (String dir) -> Integer
|
|
51
|
+
|
|
52
|
+
# The reports' directories in +dir+.
|
|
53
|
+
def reports: (String dir) -> Array[String]
|
|
54
|
+
|
|
55
|
+
# What each report's +values+ say together for +name+, or nil.
|
|
56
|
+
def merged: (String name, Array[String?] values) -> String?
|
|
57
|
+
|
|
58
|
+
# The comment's Markdown, of +reports+.
|
|
59
|
+
def body: (Array[String] reports) -> String
|
|
60
|
+
|
|
61
|
+
# Posts +body+ as a new comment, or nil.
|
|
62
|
+
def post: (String pr, String body) -> untyped
|
|
63
|
+
|
|
64
|
+
# What Duel said in comment.env, or nil.
|
|
65
|
+
def said: (String name, String report) -> String?
|
|
66
|
+
|
|
67
|
+
# Duel's comments on the pull request, oldest first, or nil.
|
|
68
|
+
def earlier: (String pr) -> Array[Hash[String, untyped]]?
|
|
69
|
+
|
|
70
|
+
# The merge request, as GitLab's API has it, or nil.
|
|
71
|
+
def merge_request: (String pr) -> untyped
|
|
72
|
+
|
|
73
|
+
# The token's notes on the merge request, or nil.
|
|
74
|
+
def notes: (String pr) -> Array[Hash[String, untyped]]?
|
|
75
|
+
|
|
76
|
+
# What GitLab's API says, or nil.
|
|
77
|
+
def gitlab: (Symbol verb, String path, ?Hash[String, String]? body, ?pages: bool) -> untyped
|
|
78
|
+
|
|
79
|
+
# A connection to +uri+'s host, not yet started.
|
|
80
|
+
def connection: (URI::Generic uri) -> Net::HTTP
|
|
81
|
+
|
|
82
|
+
# Hides an earlier comment as outdated.
|
|
83
|
+
def hide: (String id) -> void
|
|
84
|
+
|
|
85
|
+
# What gh api prints, or nil where it fails.
|
|
86
|
+
def gh: (*String args) -> String?
|
|
87
|
+
|
|
88
|
+
# Says why it doesn't comment, and returns 0.
|
|
89
|
+
def quiet: (String why) -> Integer
|
|
90
|
+
|
|
91
|
+
def marker: () -> String
|
|
92
|
+
|
|
93
|
+
def repository: () -> String
|
|
94
|
+
|
|
95
|
+
def project: () -> String
|
|
96
|
+
end
|
|
97
|
+
end
|
data/sig/duel/config.rbs
CHANGED
|
@@ -32,10 +32,17 @@ module Duel
|
|
|
32
32
|
@fail_on: fail_on
|
|
33
33
|
@push_base: push_base
|
|
34
34
|
@accept_label: String?
|
|
35
|
+
@limit: Float?
|
|
36
|
+
@confidence: Float?
|
|
37
|
+
@processes: Integer?
|
|
38
|
+
@timeout: Float?
|
|
39
|
+
@time_limit: Float?
|
|
40
|
+
@warm: Float?
|
|
35
41
|
@metrics: Array[singleton(Metric)]
|
|
36
42
|
@in_workers: Array[^(Stops stops) -> void]
|
|
37
43
|
@hooks: Hash[Symbol, Array[hook]]
|
|
38
44
|
@used: Hash[Symbol, Used]
|
|
45
|
+
@worker_memory: Integer
|
|
39
46
|
@measures: Hash[String, Hash[Symbol, untyped]]
|
|
40
47
|
@loader: (^(String version_root) -> void)?
|
|
41
48
|
|
|
@@ -45,6 +52,10 @@ module Duel
|
|
|
45
52
|
# Where Duel keeps what it keeps for the project: tmp/duel.
|
|
46
53
|
def state: () -> String
|
|
47
54
|
|
|
55
|
+
# Where what a resource builds once is kept: tmp/duel/cache.
|
|
56
|
+
# @api private
|
|
57
|
+
def cache: () -> String
|
|
58
|
+
|
|
48
59
|
# A glob, from the root, of the files defining benchmarks.
|
|
49
60
|
attr_accessor benchmarks: String
|
|
50
61
|
|
|
@@ -89,6 +100,48 @@ module Duel
|
|
|
89
100
|
# Sets #fail_on, or fails for a value it doesn't take.
|
|
90
101
|
def fail_on=: (untyped runs) -> untyped
|
|
91
102
|
|
|
103
|
+
# The settings of a run that .duel.rb can set too: for each, what it
|
|
104
|
+
# takes, and whether a value is that.
|
|
105
|
+
# @api private
|
|
106
|
+
RUN_SETTINGS: Hash[Symbol, [String, ^(Numeric) -> bool]]
|
|
107
|
+
|
|
108
|
+
# The ratio above which a timing is slower (--limit), or nil.
|
|
109
|
+
attr_reader limit: Float?
|
|
110
|
+
def limit=: (Numeric? ratio) -> void
|
|
111
|
+
|
|
112
|
+
# The confidence of every interval (--confidence), or nil.
|
|
113
|
+
attr_reader confidence: Float?
|
|
114
|
+
def confidence=: (Numeric? level) -> void
|
|
115
|
+
|
|
116
|
+
# The worker processes of each version (--processes), or nil.
|
|
117
|
+
attr_reader processes: Integer?
|
|
118
|
+
def processes=: (Integer? count) -> void
|
|
119
|
+
|
|
120
|
+
# The most seconds a worker may take (--timeout), or nil.
|
|
121
|
+
attr_reader timeout: Float?
|
|
122
|
+
def timeout=: (Numeric? seconds) -> void
|
|
123
|
+
|
|
124
|
+
# The most seconds a run measures for (--time-limit), or nil.
|
|
125
|
+
attr_reader time_limit: Float?
|
|
126
|
+
def time_limit=: (Numeric? seconds) -> void
|
|
127
|
+
|
|
128
|
+
# The seconds each benchmark warms up for (--warm), or nil.
|
|
129
|
+
attr_reader warm: Float?
|
|
130
|
+
def warm=: (Numeric? seconds) -> void
|
|
131
|
+
|
|
132
|
+
# +value+ for the RUN_SETTINGS +name+d, as that takes it, or nil, or
|
|
133
|
+
# fails saying what to give.
|
|
134
|
+
# @api private
|
|
135
|
+
def self.setting: (Symbol name, Numeric? value) -> untyped
|
|
136
|
+
|
|
137
|
+
# What to give instead of +value+, or nil if it's one that takes.
|
|
138
|
+
# @api private
|
|
139
|
+
def self.problem: (Symbol name, Numeric value) -> String?
|
|
140
|
+
|
|
141
|
+
# The RUN_SETTINGS .duel.rb set, by name.
|
|
142
|
+
# @api private
|
|
143
|
+
def run_settings: () -> Hash[Symbol, Float | Integer]
|
|
144
|
+
|
|
92
145
|
# The name of a label that accepts a regression in a pull request, or
|
|
93
146
|
# nil (the default) for none.
|
|
94
147
|
attr_reader accept_label: String?
|
|
@@ -125,6 +178,10 @@ module Duel
|
|
|
125
178
|
# @api private
|
|
126
179
|
attr_reader measures: Hash[String, Hash[Symbol, untyped]]
|
|
127
180
|
|
|
181
|
+
# The memory that what the plugins used start for each worker takes at
|
|
182
|
+
# most, as they say, in bytes.
|
|
183
|
+
attr_reader worker_memory: Integer
|
|
184
|
+
|
|
128
185
|
# A configuration of the conventions, for the project at +root+.
|
|
129
186
|
def initialize: (?String root) -> void
|
|
130
187
|
|
|
@@ -160,8 +217,6 @@ module Duel
|
|
|
160
217
|
@options: Hash[Symbol, untyped]
|
|
161
218
|
@value: untyped
|
|
162
219
|
|
|
163
|
-
attr_reader options: Hash[Symbol, untyped]
|
|
164
|
-
|
|
165
220
|
attr_accessor value: untyped
|
|
166
221
|
|
|
167
222
|
def initialize: (Hash[Symbol, untyped] options) -> void
|
data/sig/duel/context.rbs
CHANGED
|
@@ -189,8 +189,6 @@ module Duel
|
|
|
189
189
|
@timed: Hash[String, Metric::value]
|
|
190
190
|
@counted: Hash[String, Metric::value]
|
|
191
191
|
@details: Hash[String, String]
|
|
192
|
-
@started: true?
|
|
193
|
-
@stopped: true?
|
|
194
192
|
@heap: Integer
|
|
195
193
|
|
|
196
194
|
# What a metric learns of the sample: its benchmark and its iterations.
|
|
@@ -198,12 +196,6 @@ module Duel
|
|
|
198
196
|
|
|
199
197
|
attr_reader n: Integer
|
|
200
198
|
|
|
201
|
-
# @api private
|
|
202
|
-
attr_reader started: true?
|
|
203
|
-
|
|
204
|
-
# @api private
|
|
205
|
-
attr_reader stopped: true?
|
|
206
|
-
|
|
207
199
|
# Each timed measure's total, by name.
|
|
208
200
|
# @api private
|
|
209
201
|
attr_reader timed: Hash[String, Metric::value]
|
|
@@ -284,16 +276,9 @@ module Duel
|
|
|
284
276
|
# A run of a benchmark that measures nothing: to see that it runs.
|
|
285
277
|
# @api private
|
|
286
278
|
class Trial
|
|
287
|
-
|
|
288
|
-
@stopped: true?
|
|
289
|
-
|
|
290
|
-
attr_reader started: true?
|
|
291
|
-
|
|
292
|
-
attr_reader stopped: true?
|
|
293
|
-
|
|
294
|
-
def start: () -> true
|
|
279
|
+
def start: () -> void
|
|
295
280
|
|
|
296
|
-
def stop: () ->
|
|
281
|
+
def stop: () -> void
|
|
297
282
|
|
|
298
283
|
def pause: [T] () { () -> T } -> T
|
|
299
284
|
|
|
@@ -305,8 +290,6 @@ module Duel
|
|
|
305
290
|
# A stretch of a benchmark run for its peak memory.
|
|
306
291
|
# @api private
|
|
307
292
|
class MemorySample
|
|
308
|
-
@started: true?
|
|
309
|
-
@stopped: true?
|
|
310
293
|
# Resident memory where it started, plus what paused blocks left.
|
|
311
294
|
@base: Integer
|
|
312
295
|
# The most above it the watcher saw, outside paused blocks.
|
|
@@ -315,10 +298,7 @@ module Duel
|
|
|
315
298
|
# Resident memory when it last stopped watching.
|
|
316
299
|
@unwatched: Integer
|
|
317
300
|
@watcher: Thread
|
|
318
|
-
|
|
319
|
-
attr_reader started: true?
|
|
320
|
-
|
|
321
|
-
attr_reader stopped: true?
|
|
301
|
+
@lock: Thread::Mutex
|
|
322
302
|
|
|
323
303
|
# Bytes (once it's stopped).
|
|
324
304
|
attr_reader peak: Integer
|
|
@@ -358,16 +338,9 @@ module Duel
|
|
|
358
338
|
# What StackProf samples by here (see .mode).
|
|
359
339
|
MODE: :cpu | :wall
|
|
360
340
|
|
|
361
|
-
@started: true?
|
|
362
|
-
@stopped: true?
|
|
363
|
-
|
|
364
341
|
# What StackProf samples by on +platform+: CPU time, but elapsed time
|
|
365
342
|
# on macOS.
|
|
366
|
-
def self.mode: (?String
|
|
367
|
-
|
|
368
|
-
attr_reader started: true?
|
|
369
|
-
|
|
370
|
-
attr_reader stopped: true?
|
|
343
|
+
def self.mode: (?platform: String) -> (:cpu | :wall)
|
|
371
344
|
|
|
372
345
|
def start: () -> void
|
|
373
346
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Duel
|
|
2
|
+
# The runner's connection to a worker: a Unix socket, or a port of
|
|
3
|
+
# 127.0.0.1's where there are none.
|
|
4
|
+
# @api private
|
|
5
|
+
module Control
|
|
6
|
+
HOST: String
|
|
7
|
+
UNIX: bool
|
|
8
|
+
TCP: Regexp
|
|
9
|
+
|
|
10
|
+
# Whether a worker can reach a server on a Unix socket: not on
|
|
11
|
+
# Windows, nor where Ruby has none.
|
|
12
|
+
def self.unix_sockets?: (windows: bool, ?unix: bool) -> bool
|
|
13
|
+
|
|
14
|
+
# A server for a worker to connect to, at +path+ (or a port, unless
|
|
15
|
+
# +unix+), and its address.
|
|
16
|
+
def self.listen: (String path, unix: bool) -> [UNIXServer | TCPServer, String]
|
|
17
|
+
|
|
18
|
+
# A server on a port of 127.0.0.1's that the system chose.
|
|
19
|
+
def self.tcp_server: () -> TCPServer
|
|
20
|
+
|
|
21
|
+
# A connection to the server at +address+.
|
|
22
|
+
def self.connect: (String address) -> (UNIXSocket | TCPSocket)
|
|
23
|
+
|
|
24
|
+
# Removes a Unix socket's file.
|
|
25
|
+
def self.remove: (String address) -> void
|
|
26
|
+
end
|
|
27
|
+
end
|
data/sig/duel/init.rbs
CHANGED
|
@@ -15,18 +15,36 @@ module Duel
|
|
|
15
15
|
# A Gemfile's development group.
|
|
16
16
|
DEVELOPMENT: Regexp
|
|
17
17
|
|
|
18
|
+
# The color of the label it creates.
|
|
19
|
+
LABEL_COLOR: String
|
|
20
|
+
|
|
21
|
+
# Where Duel's reusable workflows are.
|
|
22
|
+
REUSABLE: String
|
|
23
|
+
|
|
24
|
+
# Where it reads an answer.
|
|
25
|
+
interface _Input
|
|
26
|
+
def tty?: () -> bool
|
|
27
|
+
|
|
28
|
+
def gets: () -> String?
|
|
29
|
+
end
|
|
30
|
+
|
|
18
31
|
@argv: Array[String]
|
|
32
|
+
@repository: String?
|
|
19
33
|
@out: _Output
|
|
20
34
|
@err: _Output
|
|
35
|
+
@input: _Input
|
|
21
36
|
@root: String
|
|
37
|
+
@label: bool?
|
|
22
38
|
@force: bool?
|
|
23
39
|
@dry_run: bool?
|
|
40
|
+
@reusable: bool?
|
|
41
|
+
@check: bool?
|
|
24
42
|
@gitlab: bool?
|
|
25
43
|
@badge: bool?
|
|
26
44
|
@settings: Config?
|
|
27
45
|
@stackprof: bool?
|
|
28
46
|
|
|
29
|
-
def initialize: (Array[String] argv, ?out: _Output, ?err: _Output, ?root: String) -> void
|
|
47
|
+
def initialize: (Array[String] argv, ?out: _Output, ?err: _Output, ?input: _Input, ?root: String) -> void
|
|
30
48
|
|
|
31
49
|
# Returns the exit status: 0 set up, 1 a Rails app, 2 a bad option.
|
|
32
50
|
def run: () -> Integer
|
|
@@ -38,6 +56,35 @@ module Duel
|
|
|
38
56
|
|
|
39
57
|
def parser: () -> OptionParser
|
|
40
58
|
|
|
59
|
+
# Says whether each workflow is what it writes, or how it differs.
|
|
60
|
+
def check: () -> Integer
|
|
61
|
+
|
|
62
|
+
# Whether the file at +path+ is +content+, saying so, or how it differs.
|
|
63
|
+
def same?: (String path, String content) -> bool
|
|
64
|
+
|
|
65
|
+
# How +lines+ (the file at +path+'s) differ from +content+, as diff -u
|
|
66
|
+
# has it.
|
|
67
|
+
def diff: (String path, String lines, String content) -> String
|
|
68
|
+
|
|
69
|
+
# Creates the label that accepts a regression, with gh, if it's missing
|
|
70
|
+
# and the answer to whether to is yes.
|
|
71
|
+
def create_label: () -> void
|
|
72
|
+
|
|
73
|
+
# The names of the GitHub repository's labels gh finds, or nil.
|
|
74
|
+
def github_labels: (String repo, String label) -> Array[String]?
|
|
75
|
+
|
|
76
|
+
# The project's GitLab project, as glab has it, or nil.
|
|
77
|
+
def gitlab_project: () -> String?
|
|
78
|
+
|
|
79
|
+
# The names of the GitLab project's labels, or nil.
|
|
80
|
+
def gitlab_labels: (String repo) -> Array[String]?
|
|
81
|
+
|
|
82
|
+
# What gh (or glab) prints, run in the project, or nil.
|
|
83
|
+
def cli: (String program, *String args) -> String?
|
|
84
|
+
|
|
85
|
+
# A pull request, or on GitLab, a merge request.
|
|
86
|
+
def request: () -> String
|
|
87
|
+
|
|
41
88
|
# Says to use duel-rails's generator instead.
|
|
42
89
|
def rails: () -> Integer
|
|
43
90
|
|
|
@@ -66,6 +113,21 @@ module Duel
|
|
|
66
113
|
|
|
67
114
|
def render: (String name) -> String
|
|
68
115
|
|
|
116
|
+
# Whether the templates are rendered as Duel's reusable workflows.
|
|
117
|
+
def reusable?: () -> bool
|
|
118
|
+
|
|
119
|
+
# Whether the workflow's jobs write to the repository.
|
|
120
|
+
def writes?: () -> bool?
|
|
121
|
+
|
|
122
|
+
# What a workflow it writes with --reusable passes on to Duel's, as
|
|
123
|
+
# its inputs, each as YAML has it.
|
|
124
|
+
def perf_inputs: () -> Hash[String, String]
|
|
125
|
+
|
|
126
|
+
def comment_inputs: () -> Hash[String, String]
|
|
127
|
+
|
|
128
|
+
# The glob release tags match, as .duel.rb sets it.
|
|
129
|
+
def set_release_tags: () -> String?
|
|
130
|
+
|
|
69
131
|
# The project's configuration, as the conventions have it.
|
|
70
132
|
def config: () -> Config
|
|
71
133
|
|
|
@@ -116,6 +178,9 @@ module Duel
|
|
|
116
178
|
# The project's directory, from its repository's root, or nil.
|
|
117
179
|
def working_directory: () -> String?
|
|
118
180
|
|
|
181
|
+
# +name+, or for a project in a subdirectory, +name+-<its path>.
|
|
182
|
+
def suffixed: (String name) -> String
|
|
183
|
+
|
|
119
184
|
def workflow_name: () -> String
|
|
120
185
|
|
|
121
186
|
# What marks the workflow's comment on a pull request.
|
|
@@ -138,5 +203,34 @@ module Duel
|
|
|
138
203
|
|
|
139
204
|
# The Ruby image's tag for GitLab CI.
|
|
140
205
|
def gitlab_ruby: () -> String
|
|
206
|
+
|
|
207
|
+
# Duel's reusable workflows: the templates, each setting an input.
|
|
208
|
+
class Reusable < Init
|
|
209
|
+
def files: () -> Hash[String, String]
|
|
210
|
+
|
|
211
|
+
private
|
|
212
|
+
|
|
213
|
+
def reusable?: () -> true
|
|
214
|
+
|
|
215
|
+
def accept_label: () -> String
|
|
216
|
+
|
|
217
|
+
def release_tags: () -> String
|
|
218
|
+
|
|
219
|
+
def ruby_version: () -> String
|
|
220
|
+
|
|
221
|
+
def working_directory: () -> String
|
|
222
|
+
|
|
223
|
+
def passed_branch: () -> String
|
|
224
|
+
|
|
225
|
+
def badge_branch: () -> String
|
|
226
|
+
|
|
227
|
+
def version_file: () -> true
|
|
228
|
+
|
|
229
|
+
def comment_on_pushes?: () -> true
|
|
230
|
+
|
|
231
|
+
def mark_passed?: () -> true
|
|
232
|
+
|
|
233
|
+
def badge?: () -> true
|
|
234
|
+
end
|
|
141
235
|
end
|
|
142
236
|
end
|