duel 0.2.0 → 0.3.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 +51 -27
- data/CHANGELOG.md +247 -1
- data/README.md +30 -14
- data/docs/benchmarks.md +28 -24
- data/docs/ci.md +328 -362
- data/docs/configuration.md +40 -37
- data/docs/how-it-works.md +23 -10
- data/docs/json.md +21 -25
- data/docs/plugins.md +40 -22
- data/docs/troubleshooting.md +3 -2
- data/lib/duel/across.rb +18 -18
- data/lib/duel/badge.rb +174 -0
- data/lib/duel/baseline.rb +38 -15
- data/lib/duel/cli.rb +175 -107
- data/lib/duel/comment.rb +80 -71
- data/lib/duel/config.rb +145 -63
- data/lib/duel/context.rb +29 -24
- data/lib/duel/forge.rb +87 -0
- data/lib/duel/init.rb +44 -87
- data/lib/duel/json_report.rb +34 -25
- data/lib/duel/lane.rb +107 -61
- data/lib/duel/lock.rb +1 -1
- data/lib/duel/mark_passed.rb +132 -0
- data/lib/duel/metric.rb +28 -27
- data/lib/duel/native.rb +7 -5
- data/lib/duel/platform.rb +4 -0
- data/lib/duel/process_sample.rb +9 -6
- data/lib/duel/rake_task.rb +4 -5
- data/lib/duel/resource.rb +10 -11
- data/lib/duel/result.rb +22 -14
- data/lib/duel/rubies.rb +6 -2
- data/lib/duel/runner.rb +27 -15
- data/lib/duel/spawn.rb +29 -4
- data/lib/duel/stats.rb +14 -12
- data/lib/duel/summary.rb +31 -29
- data/lib/duel/templates/benchmark_duel.rb.erb +2 -2
- data/lib/duel/templates/duel.gitlab-ci.yml.erb +18 -54
- data/lib/duel/templates/duel.rb.erb +7 -7
- data/lib/duel/templates/perf-caller.yml.erb +22 -5
- data/lib/duel/templates/perf-comment.yml.erb +11 -11
- data/lib/duel/templates/perf-push-jobs.yml.erb +127 -0
- data/lib/duel/templates/perf-push.yml.erb +50 -0
- data/lib/duel/templates/perf.yml.erb +113 -335
- data/lib/duel/testing.rb +20 -25
- data/lib/duel/version.rb +1 -1
- data/lib/duel/worker.rb +16 -9
- data/lib/duel/worker_process.rb +6 -6
- data/lib/duel.rb +88 -33
- data/sig/duel/across.rbs +4 -0
- data/sig/duel/badge.rbs +51 -0
- data/sig/duel/baseline.rbs +7 -2
- data/sig/duel/cli.rbs +31 -20
- data/sig/duel/comment.rbs +14 -15
- data/sig/duel/config.rbs +71 -29
- data/sig/duel/context.rbs +4 -4
- data/sig/duel/forge.rbs +42 -0
- data/sig/duel/init.rbs +8 -26
- data/sig/duel/json_report.rbs +7 -6
- data/sig/duel/lane.rbs +29 -6
- data/sig/duel/mark_passed.rbs +39 -0
- data/sig/duel/metric.rbs +10 -10
- data/sig/duel/native.rbs +3 -0
- data/sig/duel/platform.rbs +1 -0
- data/sig/duel/process_sample.rbs +3 -0
- data/sig/duel/resource.rbs +3 -3
- data/sig/duel/result.rbs +12 -5
- data/sig/duel/rubies.rbs +3 -0
- data/sig/duel/runner.rbs +23 -16
- data/sig/duel/spawn.rbs +7 -0
- data/sig/duel/stats.rbs +4 -1
- data/sig/duel/summary.rbs +8 -0
- data/sig/duel/testing.rbs +2 -2
- data/sig/duel/worker.rbs +6 -5
- data/sig/duel/worker_process.rbs +3 -3
- data/sig/duel.rbs +50 -31
- metadata +9 -1
data/sig/duel/comment.rbs
CHANGED
|
@@ -3,10 +3,9 @@ module Duel
|
|
|
3
3
|
# pull request with Duel's report.
|
|
4
4
|
# @api private
|
|
5
5
|
class Comment
|
|
6
|
-
|
|
6
|
+
include Forge
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
SINCE: String
|
|
8
|
+
USAGE: String
|
|
10
9
|
|
|
11
10
|
# Where GitLab CI has what Duel said.
|
|
12
11
|
GITLAB: Hash[String, String]
|
|
@@ -33,7 +32,7 @@ module Duel
|
|
|
33
32
|
@marker: String
|
|
34
33
|
@report: String?
|
|
35
34
|
@head: String?
|
|
36
|
-
@
|
|
35
|
+
@commit: String?
|
|
37
36
|
|
|
38
37
|
def initialize: (Array[String] argv, env: CLI::_Env, out: _Output, err: _Output) -> void
|
|
39
38
|
|
|
@@ -47,6 +46,15 @@ module Duel
|
|
|
47
46
|
|
|
48
47
|
# Comments, if Duel said to, and the pull request's head is still the
|
|
49
48
|
# run's.
|
|
49
|
+
# Comments on a pushed commit with the report, where Duel said to.
|
|
50
|
+
def commit_comment: (String dir, String sha) -> Integer
|
|
51
|
+
|
|
52
|
+
# The markers of GitHub Actions' comments on the repository's commits.
|
|
53
|
+
def commit_comments: () -> Array[String]?
|
|
54
|
+
|
|
55
|
+
# The markers of the token's comments on the commit before the push.
|
|
56
|
+
def commit_notes: () -> Array[String]?
|
|
57
|
+
|
|
50
58
|
def comment: (String dir) -> Integer
|
|
51
59
|
|
|
52
60
|
# The reports' directories in +dir+.
|
|
@@ -73,25 +81,16 @@ module Duel
|
|
|
73
81
|
# The token's notes on the merge request, or nil.
|
|
74
82
|
def notes: (String pr) -> Array[Hash[String, untyped]]?
|
|
75
83
|
|
|
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
84
|
# Hides an earlier comment as outdated.
|
|
83
85
|
def hide: (String id) -> void
|
|
84
86
|
|
|
85
|
-
# What gh api prints, or nil where it fails.
|
|
86
|
-
def gh: (*String args) -> String?
|
|
87
|
-
|
|
88
87
|
# Says why it doesn't comment, and returns 0.
|
|
89
88
|
def quiet: (String why) -> Integer
|
|
90
89
|
|
|
91
90
|
def marker: () -> String
|
|
92
91
|
|
|
93
|
-
def
|
|
92
|
+
def command: () -> String
|
|
94
93
|
|
|
95
|
-
def
|
|
94
|
+
def gitlab_token: () -> String
|
|
96
95
|
end
|
|
97
96
|
end
|
data/sig/duel/config.rbs
CHANGED
|
@@ -10,6 +10,10 @@ module Duel
|
|
|
10
10
|
# version file's, a path, or what a block makes of the version's tree.
|
|
11
11
|
type ruby = :version_file | String | ^(String root) -> String | nil
|
|
12
12
|
|
|
13
|
+
# How each version loads: a library to require, none, or a lambda
|
|
14
|
+
# given the root of its tree.
|
|
15
|
+
type library = String | ^(String root) -> void | nil
|
|
16
|
+
|
|
13
17
|
# When the workflow comments on a pull request (see #comment).
|
|
14
18
|
type comment = :always | :results | :failures | :never
|
|
15
19
|
|
|
@@ -20,12 +24,12 @@ module Duel
|
|
|
20
24
|
type push_base = :before | :last_passed
|
|
21
25
|
|
|
22
26
|
@root: String
|
|
23
|
-
@benchmarks: String
|
|
24
|
-
@watch: Array[String]
|
|
25
|
-
@library:
|
|
27
|
+
@benchmarks: String | Array[String]
|
|
28
|
+
@watch: String | Array[String]
|
|
29
|
+
@library: library | :conventional
|
|
26
30
|
@build: String | :conventional | nil
|
|
27
31
|
@main_branch: String?
|
|
28
|
-
@release_tags: String
|
|
32
|
+
@release_tags: String | Array[String]
|
|
29
33
|
@prepares: Hash[Symbol, Array[prepare]]
|
|
30
34
|
@ruby: ruby
|
|
31
35
|
@comment: comment
|
|
@@ -34,6 +38,7 @@ module Duel
|
|
|
34
38
|
@accept_label: String?
|
|
35
39
|
@limit: Float?
|
|
36
40
|
@confidence: Float?
|
|
41
|
+
@jobs: Integer?
|
|
37
42
|
@processes: Integer?
|
|
38
43
|
@timeout: Float?
|
|
39
44
|
@time_limit: Float?
|
|
@@ -44,7 +49,6 @@ module Duel
|
|
|
44
49
|
@used: Hash[Symbol, Used]
|
|
45
50
|
@worker_memory: Integer
|
|
46
51
|
@measures: Hash[String, Hash[Symbol, untyped]]
|
|
47
|
-
@loader: (^(String version_root) -> void)?
|
|
48
52
|
|
|
49
53
|
# Where the project is (and its config file).
|
|
50
54
|
attr_reader root: String
|
|
@@ -56,29 +60,38 @@ module Duel
|
|
|
56
60
|
# @api private
|
|
57
61
|
def cache: () -> String
|
|
58
62
|
|
|
59
|
-
# A glob, from the root, of the files defining benchmarks
|
|
60
|
-
|
|
63
|
+
# A glob, from the root, of the files defining benchmarks, or a list
|
|
64
|
+
# of them. Each setter fails, saying what to give, on a value it
|
|
65
|
+
# doesn't take.
|
|
66
|
+
attr_reader benchmarks: String | Array[String]
|
|
67
|
+
def benchmarks=: (String | Array[String] globs) -> (String | Array[String])
|
|
61
68
|
|
|
62
|
-
#
|
|
63
|
-
# about (with what decides how it's measured).
|
|
64
|
-
|
|
69
|
+
# A path, from the root, of the code whose changes a comparison is
|
|
70
|
+
# about (with what decides how it's measured), or a list of them.
|
|
71
|
+
attr_reader watch: String | Array[String]
|
|
72
|
+
def watch=: (String | Array[String] paths) -> (String | Array[String])
|
|
65
73
|
|
|
66
|
-
#
|
|
67
|
-
|
|
74
|
+
# How each version loads: the library to require from it, nil for
|
|
75
|
+
# none, or a lambda given the root of its tree.
|
|
76
|
+
def library=: (library library) -> library
|
|
68
77
|
|
|
69
78
|
# A shell command that builds a checked-out tree, or nil for none.
|
|
70
|
-
|
|
79
|
+
def build=: (String? command) -> String?
|
|
71
80
|
|
|
72
81
|
# The branch a comparison defaults to (nil: the one origin/HEAD names).
|
|
73
|
-
|
|
82
|
+
attr_reader main_branch: String?
|
|
83
|
+
def main_branch=: (String? branch) -> String?
|
|
74
84
|
|
|
75
|
-
# The glob release tags match (for `--base last-release`)
|
|
76
|
-
|
|
85
|
+
# The glob release tags match (for `--base last-release`), or a list
|
|
86
|
+
# of them.
|
|
87
|
+
attr_reader release_tags: String | Array[String]
|
|
88
|
+
def release_tags=: (String | Array[String] globs) -> (String | Array[String])
|
|
77
89
|
|
|
78
90
|
# The Ruby each version runs on: nil for the runner's own,
|
|
79
91
|
# :version_file for the one its version file names, a path, or a block
|
|
80
92
|
# given the version's tree.
|
|
81
|
-
|
|
93
|
+
attr_reader ruby: ruby
|
|
94
|
+
def ruby=: (ruby ruby) -> ruby
|
|
82
95
|
|
|
83
96
|
# When the workflow comments on a pull request: :always, :results,
|
|
84
97
|
# :failures (the default) or :never.
|
|
@@ -88,7 +101,7 @@ module Duel
|
|
|
88
101
|
COMMENTS: Array[comment]
|
|
89
102
|
|
|
90
103
|
# Sets #comment, or fails for a value it doesn't take.
|
|
91
|
-
def comment=: (
|
|
104
|
+
def comment=: (comment mode) -> comment
|
|
92
105
|
|
|
93
106
|
# Which runs a regression fails: :every_run (the default), or
|
|
94
107
|
# :pull_requests.
|
|
@@ -98,13 +111,16 @@ module Duel
|
|
|
98
111
|
FAIL_ON: Array[fail_on]
|
|
99
112
|
|
|
100
113
|
# Sets #fail_on, or fails for a value it doesn't take.
|
|
101
|
-
def fail_on=: (
|
|
114
|
+
def fail_on=: (fail_on runs) -> fail_on
|
|
102
115
|
|
|
103
116
|
# The settings of a run that .duel.rb can set too: for each, what it
|
|
104
117
|
# takes, and whether a value is that.
|
|
105
118
|
# @api private
|
|
106
119
|
RUN_SETTINGS: Hash[Symbol, [String, ^(Numeric) -> bool]]
|
|
107
120
|
|
|
121
|
+
# The RUN_SETTINGS that are whole numbers.
|
|
122
|
+
WHOLE: Array[Symbol]
|
|
123
|
+
|
|
108
124
|
# The ratio above which a timing is slower (--limit), or nil.
|
|
109
125
|
attr_reader limit: Float?
|
|
110
126
|
def limit=: (Numeric? ratio) -> void
|
|
@@ -113,6 +129,10 @@ module Duel
|
|
|
113
129
|
attr_reader confidence: Float?
|
|
114
130
|
def confidence=: (Numeric? level) -> void
|
|
115
131
|
|
|
132
|
+
# The benchmarks measured at once (--jobs), or nil.
|
|
133
|
+
attr_reader jobs: Integer?
|
|
134
|
+
def jobs=: (Integer? count) -> void
|
|
135
|
+
|
|
116
136
|
# The worker processes of each version (--processes), or nil.
|
|
117
137
|
attr_reader processes: Integer?
|
|
118
138
|
def processes=: (Integer? count) -> void
|
|
@@ -129,6 +149,25 @@ module Duel
|
|
|
129
149
|
attr_reader warm: Float?
|
|
130
150
|
def warm=: (Numeric? seconds) -> void
|
|
131
151
|
|
|
152
|
+
# +value+ for the setting +name+d, if it's one of +values+, or fails
|
|
153
|
+
# saying which to give.
|
|
154
|
+
# @api private
|
|
155
|
+
def self.one_of: [T < Symbol] (Symbol name, T value, Array[Symbol] values) -> T
|
|
156
|
+
|
|
157
|
+
# +value+ for the setting +name+d, if the block says it's one it takes,
|
|
158
|
+
# or fails saying to +give+ one.
|
|
159
|
+
# @api private
|
|
160
|
+
def self.given: [T < _Inspect] (Symbol name, T value, String give) { () -> boolish } -> T
|
|
161
|
+
|
|
162
|
+
# What a value that's said wrong needs, to say how.
|
|
163
|
+
interface _Inspect
|
|
164
|
+
def inspect: () -> String
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Whether +value+ is a String, or a list of them (+empty+, or not).
|
|
168
|
+
# @api private
|
|
169
|
+
def self.strings?: (untyped value, ?empty: bool) -> bool
|
|
170
|
+
|
|
132
171
|
# +value+ for the RUN_SETTINGS +name+d, as that takes it, or nil, or
|
|
133
172
|
# fails saying what to give.
|
|
134
173
|
# @api private
|
|
@@ -147,7 +186,7 @@ module Duel
|
|
|
147
186
|
attr_reader accept_label: String?
|
|
148
187
|
|
|
149
188
|
# Sets #accept_label, or fails for what isn't a name or nil.
|
|
150
|
-
def accept_label=: (
|
|
189
|
+
def accept_label=: (String? label) -> String?
|
|
151
190
|
|
|
152
191
|
# What a push is compared with: :before (the default), the commit
|
|
153
192
|
# before it, or :last_passed, the last commit Duel passed.
|
|
@@ -157,7 +196,7 @@ module Duel
|
|
|
157
196
|
PUSH_BASES: Array[push_base]
|
|
158
197
|
|
|
159
198
|
# Sets #push_base, or fails for a value it doesn't take.
|
|
160
|
-
def push_base=: (
|
|
199
|
+
def push_base=: (push_base base) -> push_base
|
|
161
200
|
|
|
162
201
|
# What #prepare was given, by scope.
|
|
163
202
|
# @api private
|
|
@@ -190,16 +229,15 @@ module Duel
|
|
|
190
229
|
SCOPES: Array[Symbol]
|
|
191
230
|
|
|
192
231
|
# The library: the gem the project's only .gemspec names, unless set.
|
|
193
|
-
%a{pure} def library: () ->
|
|
232
|
+
%a{pure} def library: () -> library
|
|
233
|
+
|
|
234
|
+
# The gem the project's only .gemspec names, or nil.
|
|
235
|
+
def gem_library: () -> String?
|
|
194
236
|
|
|
195
237
|
# The build command: `bundle exec rake compile` for a project with
|
|
196
238
|
# ext/ and a Rakefile, unless set.
|
|
197
239
|
%a{pure} def build: () -> String?
|
|
198
240
|
|
|
199
|
-
# How a worker loads one version of the code, from the tree at the
|
|
200
|
-
# root it's given, instead of the convention.
|
|
201
|
-
def load: () { (String version_root) -> void } -> void
|
|
202
|
-
|
|
203
241
|
# Loads the version at +version_root+.
|
|
204
242
|
# @api private
|
|
205
243
|
def load_into: (String version_root) -> void
|
|
@@ -252,11 +290,11 @@ module Duel
|
|
|
252
290
|
|
|
253
291
|
# The configuration's hooks (see Duel::HOOKS), for every benchmark,
|
|
254
292
|
# run where they were written, before its file's and its own.
|
|
255
|
-
def setup: () { (
|
|
293
|
+
def setup: () { () -> void } -> void
|
|
256
294
|
|
|
257
|
-
def teardown: () { (
|
|
295
|
+
def teardown: () { () -> void } -> void
|
|
258
296
|
|
|
259
|
-
def before_sample: () { (
|
|
297
|
+
def before_sample: () { () -> void } -> void
|
|
260
298
|
|
|
261
299
|
def around_iteration: () { (Iteration iteration) -> void } -> void
|
|
262
300
|
|
|
@@ -272,6 +310,10 @@ module Duel
|
|
|
272
310
|
# @api private
|
|
273
311
|
def benchmark_files: () -> Array[String]
|
|
274
312
|
|
|
313
|
+
# A setting that takes one or a list, as a list.
|
|
314
|
+
# @api private
|
|
315
|
+
def self.list: (String | Array[String] given) -> Array[String]
|
|
316
|
+
|
|
275
317
|
private
|
|
276
318
|
|
|
277
319
|
def add_hook: (Symbol name, Proc? block) -> void
|
data/sig/duel/context.rbs
CHANGED
|
@@ -124,8 +124,8 @@ module Duel
|
|
|
124
124
|
# The hooks +name+d: the configuration's, then its file's and its own.
|
|
125
125
|
def hooks: (Symbol name, Hash[Symbol, Array[hook]] hooks) -> Array[_Bound]
|
|
126
126
|
|
|
127
|
-
#
|
|
128
|
-
def
|
|
127
|
+
# The hooks +name+d, none of which takes a parameter.
|
|
128
|
+
def plain_hooks: (Symbol name, Hash[Symbol, Array[hook]] hooks) -> Array[_Bound]
|
|
129
129
|
|
|
130
130
|
# What pausing and resuming leaves in each measure, an iteration.
|
|
131
131
|
def paused: (Array[Metric] metrics) -> Hash[String, Float]
|
|
@@ -134,8 +134,8 @@ module Duel
|
|
|
134
134
|
# costly to read), an iteration.
|
|
135
135
|
def hooked: (Array[Metric] metrics) -> Hash[String, Float]
|
|
136
136
|
|
|
137
|
-
# Each measure's least in +
|
|
138
|
-
def least: (Array[
|
|
137
|
+
# Each measure's least in +samples+, over +stretches+.
|
|
138
|
+
def least: (Array[Sample] samples, Integer stretches) -> Hash[String, Float]
|
|
139
139
|
|
|
140
140
|
def iterate: (Integer n, _Sample sample) -> void
|
|
141
141
|
|
data/sig/duel/forge.rbs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Duel
|
|
2
|
+
# What the commands that run in CI's jobs of their own share: GitHub's
|
|
3
|
+
# API, through gh, and GitLab's, over HTTP.
|
|
4
|
+
# @api private
|
|
5
|
+
module Forge
|
|
6
|
+
@env: CLI::_Env
|
|
7
|
+
@err: _Output
|
|
8
|
+
@out: _Output
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
# The command it's for, as its messages say (the includer's).
|
|
13
|
+
def command: () -> String
|
|
14
|
+
|
|
15
|
+
# The variable of the token GitLab's API is signed in with (the
|
|
16
|
+
# includer's).
|
|
17
|
+
def gitlab_token: () -> String
|
|
18
|
+
|
|
19
|
+
# What gh api prints, or nil where it fails.
|
|
20
|
+
def gh: (*String args, ?quiet: bool) -> String?
|
|
21
|
+
|
|
22
|
+
# What GitLab's API says, or nil.
|
|
23
|
+
def gitlab: (Symbol verb, String path, ?Hash[String, String]? body, ?pages: bool, ?quiet: bool) -> untyped
|
|
24
|
+
|
|
25
|
+
# Names the branch that keeps Git from making this one, and returns 1.
|
|
26
|
+
def blocked: (String branch) { (String prefix) -> untyped } -> Integer
|
|
27
|
+
|
|
28
|
+
# A connection to +uri+'s host, not yet started.
|
|
29
|
+
def connection: (URI::Generic uri) -> Net::HTTP
|
|
30
|
+
|
|
31
|
+
# Whether it runs on GitLab CI.
|
|
32
|
+
def gitlab?: () -> bool
|
|
33
|
+
|
|
34
|
+
def repository: () -> String
|
|
35
|
+
|
|
36
|
+
# The project's path in GitLab's API.
|
|
37
|
+
def project: () -> String
|
|
38
|
+
|
|
39
|
+
# A branch's name, as a path of GitLab's API takes it.
|
|
40
|
+
def encoded: (String ref) -> String
|
|
41
|
+
end
|
|
42
|
+
end
|
data/sig/duel/init.rbs
CHANGED
|
@@ -37,7 +37,7 @@ module Duel
|
|
|
37
37
|
@label: bool?
|
|
38
38
|
@force: bool?
|
|
39
39
|
@dry_run: bool?
|
|
40
|
-
@
|
|
40
|
+
@standalone: bool?
|
|
41
41
|
@check: bool?
|
|
42
42
|
@gitlab: bool?
|
|
43
43
|
@badge: bool?
|
|
@@ -116,17 +116,14 @@ module Duel
|
|
|
116
116
|
# Whether the templates are rendered as Duel's reusable workflows.
|
|
117
117
|
def reusable?: () -> bool
|
|
118
118
|
|
|
119
|
-
# Whether the workflow's jobs write to the repository.
|
|
120
|
-
def writes?: () -> bool?
|
|
121
119
|
|
|
122
|
-
# What a workflow it writes
|
|
123
|
-
# its inputs, each as YAML has it.
|
|
120
|
+
# What a workflow it writes (without --standalone) passes on to
|
|
121
|
+
# Duel's, as its inputs, each as YAML has it.
|
|
124
122
|
def perf_inputs: () -> Hash[String, String]
|
|
125
123
|
|
|
126
|
-
def
|
|
124
|
+
def push_inputs: () -> Hash[String, String]
|
|
127
125
|
|
|
128
|
-
|
|
129
|
-
def set_release_tags: () -> String?
|
|
126
|
+
def comment_inputs: () -> Hash[String, String]
|
|
130
127
|
|
|
131
128
|
# The project's configuration, as the conventions have it.
|
|
132
129
|
def config: () -> Config
|
|
@@ -137,24 +134,12 @@ module Duel
|
|
|
137
134
|
|
|
138
135
|
def load_settings: () -> Config?
|
|
139
136
|
|
|
140
|
-
# The settings of the .duel.rb it writes.
|
|
141
|
-
def written_settings: () -> Config
|
|
142
|
-
|
|
143
137
|
# The label that accepts a regression, for the workflows, or nil.
|
|
144
138
|
def accept_label: () -> String?
|
|
145
139
|
|
|
146
|
-
# Whether the workflow comments on a pushed commit.
|
|
147
|
-
def comment_on_pushes?: () -> bool
|
|
148
|
-
|
|
149
|
-
# Whether the workflow marks a push passed.
|
|
150
|
-
def mark_passed?: () -> bool
|
|
151
|
-
|
|
152
140
|
# The library the gemspec names, or nil.
|
|
153
141
|
def library: () -> String?
|
|
154
142
|
|
|
155
|
-
# The glob release tags match, for the workflow.
|
|
156
|
-
def release_tags: () -> String
|
|
157
|
-
|
|
158
143
|
# The library, without a gemspec: lib/'s only Ruby file, or nil.
|
|
159
144
|
def guess: () -> String?
|
|
160
145
|
|
|
@@ -210,12 +195,13 @@ module Duel
|
|
|
210
195
|
|
|
211
196
|
private
|
|
212
197
|
|
|
198
|
+
# The whole Perf workflow's jobs for a push, as the push workflow's.
|
|
199
|
+
def push_jobs: () -> String
|
|
200
|
+
|
|
213
201
|
def reusable?: () -> true
|
|
214
202
|
|
|
215
203
|
def accept_label: () -> String
|
|
216
204
|
|
|
217
|
-
def release_tags: () -> String
|
|
218
|
-
|
|
219
205
|
def ruby_version: () -> String
|
|
220
206
|
|
|
221
207
|
def working_directory: () -> String
|
|
@@ -226,10 +212,6 @@ module Duel
|
|
|
226
212
|
|
|
227
213
|
def version_file: () -> true
|
|
228
214
|
|
|
229
|
-
def comment_on_pushes?: () -> true
|
|
230
|
-
|
|
231
|
-
def mark_passed?: () -> true
|
|
232
|
-
|
|
233
215
|
def badge?: () -> true
|
|
234
216
|
end
|
|
235
217
|
end
|
data/sig/duel/json_report.rbs
CHANGED
|
@@ -14,18 +14,19 @@ module Duel
|
|
|
14
14
|
@runner: Runner
|
|
15
15
|
@results: Array[Result]
|
|
16
16
|
@settings: Settings
|
|
17
|
+
@passed: bool
|
|
17
18
|
@exit: Integer
|
|
18
|
-
@
|
|
19
|
+
@passed_anyway: String?
|
|
19
20
|
@versions: Hash[String, Hash[String, String | bool | nil]]
|
|
20
21
|
|
|
21
|
-
# A run that didn't compare: +status+, its +exit+ status, what it
|
|
22
|
-
# said
|
|
23
|
-
def self.note: (String status, Integer exit, String message, Settings settings
|
|
22
|
+
# A run that didn't compare: +status+, its +exit+ status, and what it
|
|
23
|
+
# said.
|
|
24
|
+
def self.note: (String status, Integer exit, String message, Settings settings) -> report
|
|
24
25
|
|
|
25
26
|
# What every report starts with.
|
|
26
|
-
def self.head: (String status, Integer exit, String? message, Settings settings
|
|
27
|
+
def self.head: (String status, Integer exit, String? passed_anyway, String? message, Settings settings) -> report
|
|
27
28
|
|
|
28
|
-
def initialize: (Runner runner, Array[Result] results, settings: Settings, exit: Integer,
|
|
29
|
+
def initialize: (Runner runner, Array[Result] results, settings: Settings, passed: bool, exit: Integer, passed_anyway: String?,
|
|
29
30
|
baseline: Hash[String, String?],
|
|
30
31
|
candidate: Hash[String, String | bool | nil]) -> void
|
|
31
32
|
|
data/sig/duel/lane.rbs
CHANGED
|
@@ -47,8 +47,6 @@ module Duel
|
|
|
47
47
|
# The warm-up's seconds (see #warm).
|
|
48
48
|
@warm: Float
|
|
49
49
|
|
|
50
|
-
attr_reader profiler: bool
|
|
51
|
-
|
|
52
50
|
def initialize: (Config config, Settings settings, Hash[String, Side] sides, ?processes: Integer) -> void
|
|
53
51
|
|
|
54
52
|
# A number of its own for each lane, from 1.
|
|
@@ -82,8 +80,18 @@ module Duel
|
|
|
82
80
|
|
|
83
81
|
private
|
|
84
82
|
|
|
83
|
+
# How a benchmark runs as a process of its own, or nil.
|
|
84
|
+
def process_of: (String name) -> Definition::process?
|
|
85
|
+
|
|
86
|
+
# Each version's first worker, by version.
|
|
87
|
+
def firsts: () -> Hash[String, WorkerProcess]
|
|
88
|
+
|
|
85
89
|
def spawn: (String side, Integer index) -> WorkerProcess
|
|
86
90
|
|
|
91
|
+
# Fails where a worker's environment turns on one of CRuby's JITs that
|
|
92
|
+
# it doesn't run.
|
|
93
|
+
def check_jit: (String side, WorkerProcess worker, Hash[String, String?] env, String engine) -> void
|
|
94
|
+
|
|
87
95
|
# Fails if a version's workers loaded a native extension that isn't a
|
|
88
96
|
# build of its own.
|
|
89
97
|
def check_builds: () -> void
|
|
@@ -92,7 +100,8 @@ module Duel
|
|
|
92
100
|
# in an installed gem.
|
|
93
101
|
def inside?: (String path, String side, WorkerProcess worker) -> bool
|
|
94
102
|
|
|
95
|
-
|
|
103
|
+
# Each version's workers, the baseline's first.
|
|
104
|
+
def every_worker: () -> Array[WorkerProcess]
|
|
96
105
|
|
|
97
106
|
def set_up: (String name, Result result) -> void
|
|
98
107
|
|
|
@@ -135,6 +144,10 @@ module Duel
|
|
|
135
144
|
# Whether a benchmark's timings are judged by process.
|
|
136
145
|
def by_process?: (String name) -> bool
|
|
137
146
|
|
|
147
|
+
# Whether there are workers enough of each version for an interval
|
|
148
|
+
# over them.
|
|
149
|
+
def enough_workers?: () -> bool
|
|
150
|
+
|
|
138
151
|
# Judges each of +judged+ over workers, in rounds of a sample from
|
|
139
152
|
# every worker.
|
|
140
153
|
def judge_processes: (String name, Integer n, Array[Metric::spec] judged, Result result) -> void
|
|
@@ -154,8 +167,11 @@ module Duel
|
|
|
154
167
|
# Whether both versions' CPU time is below its floor.
|
|
155
168
|
def below_cpu_floor?: (Array[[Worker::sampled, Worker::sampled]] floors) -> bool
|
|
156
169
|
|
|
157
|
-
# Whether
|
|
158
|
-
def above_floors?: (Array[
|
|
170
|
+
# Whether either version's samples are above a spec's floors.
|
|
171
|
+
def above_floors?: (Array[[WorkerProcess::reply, WorkerProcess::reply]] floors, Metric::spec spec) -> bool
|
|
172
|
+
|
|
173
|
+
# Each pair's ratio: the candidate's value over the baseline's (at least 1).
|
|
174
|
+
def ratios: (Array[[Metric::value, Metric::value]] pairs) -> Array[Float]
|
|
159
175
|
|
|
160
176
|
def limit: (Metric::spec spec) -> Float
|
|
161
177
|
|
|
@@ -174,11 +190,18 @@ module Duel
|
|
|
174
190
|
# allocated nothing).
|
|
175
191
|
def most_iterations: (Integer n, Integer heap) -> (Integer | Float)
|
|
176
192
|
|
|
193
|
+
# The warm-up's pairs, the floors a benchmark's measures are judged
|
|
194
|
+
# above.
|
|
195
|
+
def warm_up_pairs: (String name, Integer n) -> Array[[WorkerProcess::reply, WorkerProcess::reply]]
|
|
196
|
+
|
|
177
197
|
# The +index+th pair: [baseline's reply, candidate's].
|
|
178
198
|
def pair: (String name, Integer n, Integer index, ?runs: Integer, ?count: bool) -> [WorkerProcess::reply, WorkerProcess::reply]
|
|
179
199
|
|
|
200
|
+
# Round +round+ of pairs by process: yields each pair's workers' indexes and replies.
|
|
201
|
+
def in_round: (String name, Integer n, Integer round, ?runs: Integer, ?count: bool) { (Integer, Integer, WorkerProcess::reply, WorkerProcess::reply) -> void } -> void
|
|
202
|
+
|
|
180
203
|
# A sample from a baseline worker and from a candidate worker: [baseline's reply, candidate's].
|
|
181
|
-
def sampled: (String name, Integer n, WorkerProcess base, WorkerProcess candidate, base_first: bool,
|
|
204
|
+
def sampled: (String name, Integer n, WorkerProcess base, WorkerProcess candidate, base_first: bool, runs: Integer, count: bool) -> [WorkerProcess::reply, WorkerProcess::reply]
|
|
182
205
|
|
|
183
206
|
def count: (String name, Integer n, Result result) -> void
|
|
184
207
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Duel
|
|
2
|
+
# duel mark-passed BRANCH: moves the branch that marks the last commit
|
|
3
|
+
# Duel passed forward to the pushed commit, on GitHub or GitLab.
|
|
4
|
+
# @api private
|
|
5
|
+
class MarkPassed
|
|
6
|
+
include Forge
|
|
7
|
+
|
|
8
|
+
USAGE: String
|
|
9
|
+
|
|
10
|
+
@argv: Array[String]
|
|
11
|
+
|
|
12
|
+
def initialize: (Array[String] argv, env: CLI::_Env, out: _Output, err: _Output) -> void
|
|
13
|
+
|
|
14
|
+
# Returns the exit status: 0 moved (or left), 1 it couldn't, 2 a bad
|
|
15
|
+
# option.
|
|
16
|
+
def run: () -> Integer
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def parser: () -> OptionParser
|
|
21
|
+
|
|
22
|
+
# Moves the branch to the commit on GitHub.
|
|
23
|
+
def on_github: (String branch, String sha) -> Integer
|
|
24
|
+
|
|
25
|
+
# How the branch's commit compares with the push's, as GitHub says.
|
|
26
|
+
def compared: (String sha, String at) -> String
|
|
27
|
+
|
|
28
|
+
# Moves the branch to the commit on GitLab.
|
|
29
|
+
def on_gitlab: (String branch, String sha) -> Integer
|
|
30
|
+
|
|
31
|
+
def moved: (String branch, String sha) -> Integer
|
|
32
|
+
|
|
33
|
+
def left: (String branch) -> Integer
|
|
34
|
+
|
|
35
|
+
def command: () -> String
|
|
36
|
+
|
|
37
|
+
def gitlab_token: () -> String
|
|
38
|
+
end
|
|
39
|
+
end
|
data/sig/duel/metric.rbs
CHANGED
|
@@ -4,9 +4,9 @@ module Duel
|
|
|
4
4
|
# settings, in +measures+, and say whether they can measure here with
|
|
5
5
|
# +available?+.
|
|
6
6
|
class Metric
|
|
7
|
-
# :
|
|
7
|
+
# :timed (noisy: judged on paired ratios with a confidence interval)
|
|
8
8
|
# or :counted (exact).
|
|
9
|
-
type kind = :
|
|
9
|
+
type kind = :timed | :counted
|
|
10
10
|
|
|
11
11
|
# What a measure measures.
|
|
12
12
|
type value = Integer | Float
|
|
@@ -17,7 +17,7 @@ module Duel
|
|
|
17
17
|
# A measure's settings, as declared: any left out as by default. (+calibrate+:
|
|
18
18
|
# running totals' only, see Snapshot, and +skip+: Config#measure's only.)
|
|
19
19
|
type settings = { ?kind: kind, ?unit: unit?, ?floor: value, ?cpu_floor: value, ?limit: Float?, ?unit_ns: value,
|
|
20
|
-
?
|
|
20
|
+
?size_samples: bool, ?across: bool, ?per_iteration: value, ?per_sample: value, ?calibrate: bool, ?skip: bool }
|
|
21
21
|
|
|
22
22
|
# What #stop_sample returns: the measurement, a Hash of them (by name), or
|
|
23
23
|
# nil (none this time).
|
|
@@ -26,11 +26,11 @@ module Duel
|
|
|
26
26
|
# A measure as the runner learns it.
|
|
27
27
|
# @api private
|
|
28
28
|
type spec = { "name" => String, "kind" => String, "unit" => String?, "plural" => String?, "floor" => value, "cpu_floor" => value, "limit" => Float?,
|
|
29
|
-
"unit_ns" => value, "
|
|
29
|
+
"unit_ns" => value, "size_samples" => bool, "across" => bool, "per_iteration" => value, "per_sample" => value }
|
|
30
30
|
|
|
31
31
|
# A measure's settings, every one, resolved (see Metric.resolve).
|
|
32
32
|
type resolved = { kind: kind, unit: String?, plural: String?, floor: value, cpu_floor: value, limit: Float?, unit_ns: value,
|
|
33
|
-
|
|
33
|
+
size_samples: bool, across: bool, per_iteration: value, per_sample: value, ?calibrate: bool }
|
|
34
34
|
|
|
35
35
|
# No measure's settings changed.
|
|
36
36
|
# @api private
|
|
@@ -72,8 +72,8 @@ module Duel
|
|
|
72
72
|
def self.measures: () -> Hash[String, settings]
|
|
73
73
|
|
|
74
74
|
# Whether +more+ (what a count grew by, over +n+ iterations) is still
|
|
75
|
-
# within +
|
|
76
|
-
def self.within?: (value more, Integer n,
|
|
75
|
+
# within +per_iteration+ an iteration and +per_sample+ a sample.
|
|
76
|
+
def self.within?: (value more, Integer n, per_iteration: value, per_sample: value) -> bool
|
|
77
77
|
|
|
78
78
|
# Fails unless +settings+ (a measure's) are settings there are, with a
|
|
79
79
|
# kind there is.
|
|
@@ -109,12 +109,12 @@ module Duel
|
|
|
109
109
|
# A setting of +measure+: by default, of the one it measures.
|
|
110
110
|
def setting: (:kind key, ?String measure) -> kind
|
|
111
111
|
| (:unit | :plural key, ?String measure) -> String?
|
|
112
|
-
| (:floor | :cpu_floor | :unit_ns | :
|
|
112
|
+
| (:floor | :cpu_floor | :unit_ns | :per_iteration | :per_sample key, ?String measure) -> value
|
|
113
113
|
| (:limit key, ?String measure) -> Float?
|
|
114
|
-
| (:
|
|
114
|
+
| (:size_samples | :across key, ?String measure) -> bool
|
|
115
115
|
|
|
116
116
|
# Whether +more+ (what +measure+'s count grew by, over +n+ iterations)
|
|
117
|
-
# is still within its
|
|
117
|
+
# is still within what its per_iteration and per_sample allow.
|
|
118
118
|
def within?: (value more, Integer n, ?String measure) -> bool
|
|
119
119
|
|
|
120
120
|
# Sets up what it reads, once in each worker, before it measures
|
data/sig/duel/native.rbs
CHANGED
|
@@ -96,6 +96,9 @@ module Duel
|
|
|
96
96
|
# The struct K32GetProcessMemoryInfo fills in, in place.
|
|
97
97
|
@buffer: String
|
|
98
98
|
|
|
99
|
+
# K32GetProcessMemoryInfo, a process's memory.
|
|
100
|
+
def self.process_memory_info: () -> _Function
|
|
101
|
+
|
|
99
102
|
def self.open: (?platform: String, ?memory_info: _Function?) -> Windows?
|
|
100
103
|
|
|
101
104
|
# The bytes of physical memory available, or nil.
|
data/sig/duel/platform.rbs
CHANGED
data/sig/duel/process_sample.rbs
CHANGED
|
@@ -25,6 +25,9 @@ module Duel
|
|
|
25
25
|
# The fastest of +samples+: the least CPU time and peak memory.
|
|
26
26
|
def self.fastest: (Array[sampled] samples) -> sampled
|
|
27
27
|
|
|
28
|
+
# A process benchmark's sample: its CPU time and peak memory.
|
|
29
|
+
def self.sampled: (Integer cpu, Integer? peak) -> sampled
|
|
30
|
+
|
|
28
31
|
# Runs +command+ once, and returns its sample.
|
|
29
32
|
def run: (Array[String] command) -> sampled
|
|
30
33
|
|