polyrun 1.0.0 → 1.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/CHANGELOG.md +35 -0
- data/README.md +23 -3
- data/docs/SETUP_PROFILE.md +1 -1
- data/lib/polyrun/cli/ci_shard_run_command.rb +65 -0
- data/lib/polyrun/cli/config_command.rb +42 -0
- data/lib/polyrun/cli/default_run.rb +115 -0
- data/lib/polyrun/cli/help.rb +54 -0
- data/lib/polyrun/cli/helpers.rb +19 -30
- data/lib/polyrun/cli/plan_command.rb +47 -17
- data/lib/polyrun/cli/prepare_command.rb +2 -3
- data/lib/polyrun/cli/prepare_recipe.rb +12 -7
- data/lib/polyrun/cli/queue_command.rb +17 -7
- data/lib/polyrun/cli/run_shards_command.rb +49 -3
- data/lib/polyrun/cli/run_shards_plan_boot_phases.rb +3 -3
- data/lib/polyrun/cli/run_shards_plan_options.rb +18 -11
- data/lib/polyrun/cli/run_shards_planning.rb +16 -12
- data/lib/polyrun/cli/start_bootstrap.rb +2 -6
- data/lib/polyrun/cli.rb +53 -47
- data/lib/polyrun/config/dotted_path.rb +21 -0
- data/lib/polyrun/config/effective.rb +71 -0
- data/lib/polyrun/config/resolver.rb +70 -0
- data/lib/polyrun/config.rb +7 -0
- data/lib/polyrun/database/provision.rb +12 -7
- data/lib/polyrun/partition/constraints.rb +15 -4
- data/lib/polyrun/partition/paths.rb +83 -2
- data/lib/polyrun/partition/plan.rb +38 -28
- data/lib/polyrun/partition/timing_keys.rb +85 -0
- data/lib/polyrun/prepare/assets.rb +12 -5
- data/lib/polyrun/process_stdio.rb +91 -0
- data/lib/polyrun/quick/runner.rb +26 -17
- data/lib/polyrun/rspec.rb +19 -0
- data/lib/polyrun/templates/POLYRUN.md +1 -1
- data/lib/polyrun/templates/ci_matrix.polyrun.yml +4 -1
- data/lib/polyrun/timing/merge.rb +2 -1
- data/lib/polyrun/timing/rspec_example_formatter.rb +53 -0
- data/lib/polyrun/version.rb +1 -1
- data/polyrun.gemspec +1 -1
- data/sig/polyrun/rspec.rbs +2 -0
- metadata +12 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
require "rspec/core/formatters/base_formatter"
|
|
4
|
+
|
|
5
|
+
module Polyrun
|
|
6
|
+
module Timing
|
|
7
|
+
# Experimental: records +absolute_path:line_number+ => wall seconds per example for
|
|
8
|
+
# {Partition::Plan} +timing_granularity: :example+ and +merge-timing+.
|
|
9
|
+
#
|
|
10
|
+
# Use after RSpec is loaded:
|
|
11
|
+
# require "polyrun/timing/rspec_example_formatter"
|
|
12
|
+
# RSpec.configure { |c| c.add_formatter Polyrun::Timing::RSpecExampleFormatter }
|
|
13
|
+
# Or {Polyrun::RSpec.install_example_timing!} (+output_path:+ avoids touching +ENV+).
|
|
14
|
+
#
|
|
15
|
+
# Default output path: +ENV["POLYRUN_EXAMPLE_TIMING_OUT"]+ if set, else +polyrun_timing_examples.json+.
|
|
16
|
+
class RSpecExampleFormatter < RSpec::Core::Formatters::BaseFormatter
|
|
17
|
+
RSpec::Core::Formatters.register self, :example_finished, :close
|
|
18
|
+
|
|
19
|
+
def initialize(output)
|
|
20
|
+
super
|
|
21
|
+
@times = {}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def example_finished(notification)
|
|
25
|
+
ex = notification.example
|
|
26
|
+
result = ex.execution_result
|
|
27
|
+
return if result.pending?
|
|
28
|
+
|
|
29
|
+
t = result.run_time
|
|
30
|
+
return unless t
|
|
31
|
+
|
|
32
|
+
path = ex.metadata[:absolute_path]
|
|
33
|
+
return unless path
|
|
34
|
+
|
|
35
|
+
line = ex.metadata[:line_number]
|
|
36
|
+
return unless line
|
|
37
|
+
|
|
38
|
+
key = "#{File.expand_path(path)}:#{line}"
|
|
39
|
+
cur = @times[key]
|
|
40
|
+
@times[key] = cur ? [cur, t].max : t
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def close(_notification)
|
|
44
|
+
File.write(timing_output_path, JSON.pretty_generate(@times))
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Override in a subclass from {Polyrun::RSpec.install_example_timing!(output_path: ...)}.
|
|
48
|
+
def timing_output_path
|
|
49
|
+
ENV["POLYRUN_EXAMPLE_TIMING_OUT"] || "polyrun_timing_examples.json"
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
data/lib/polyrun/version.rb
CHANGED
data/polyrun.gemspec
CHANGED
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
spec.license = "MIT"
|
|
11
11
|
spec.required_ruby_version = ">= 3.1.0"
|
|
12
12
|
|
|
13
|
-
spec.files = Dir["lib/**/*", "sig/**/*.rbs", "bin/polyrun", "README.md", "docs/SETUP_PROFILE.md", "LICENSE", "CONTRIBUTING.md", "CODE_OF_CONDUCT.md", "SECURITY.md", "polyrun.gemspec"].reject { |f| File.directory?(f) }
|
|
13
|
+
spec.files = Dir["lib/**/*", "sig/**/*.rbs", "bin/polyrun", "README.md", "CHANGELOG.md", "docs/SETUP_PROFILE.md", "LICENSE", "CONTRIBUTING.md", "CODE_OF_CONDUCT.md", "SECURITY.md", "polyrun.gemspec"].reject { |f| File.directory?(f) }
|
|
14
14
|
spec.bindir = "bin"
|
|
15
15
|
spec.executables = ["polyrun"]
|
|
16
16
|
spec.require_paths = ["lib"]
|
data/sig/polyrun/rspec.rbs
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: polyrun
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrei Makarov
|
|
@@ -156,6 +156,7 @@ executables:
|
|
|
156
156
|
extensions: []
|
|
157
157
|
extra_rdoc_files: []
|
|
158
158
|
files:
|
|
159
|
+
- CHANGELOG.md
|
|
159
160
|
- CODE_OF_CONDUCT.md
|
|
160
161
|
- CONTRIBUTING.md
|
|
161
162
|
- LICENSE
|
|
@@ -165,10 +166,14 @@ files:
|
|
|
165
166
|
- docs/SETUP_PROFILE.md
|
|
166
167
|
- lib/polyrun.rb
|
|
167
168
|
- lib/polyrun/cli.rb
|
|
169
|
+
- lib/polyrun/cli/ci_shard_run_command.rb
|
|
170
|
+
- lib/polyrun/cli/config_command.rb
|
|
168
171
|
- lib/polyrun/cli/coverage_commands.rb
|
|
169
172
|
- lib/polyrun/cli/coverage_merge_io.rb
|
|
170
173
|
- lib/polyrun/cli/database_commands.rb
|
|
174
|
+
- lib/polyrun/cli/default_run.rb
|
|
171
175
|
- lib/polyrun/cli/env_commands.rb
|
|
176
|
+
- lib/polyrun/cli/help.rb
|
|
172
177
|
- lib/polyrun/cli/helpers.rb
|
|
173
178
|
- lib/polyrun/cli/init_command.rb
|
|
174
179
|
- lib/polyrun/cli/plan_command.rb
|
|
@@ -185,6 +190,9 @@ files:
|
|
|
185
190
|
- lib/polyrun/cli/start_bootstrap.rb
|
|
186
191
|
- lib/polyrun/cli/timing_command.rb
|
|
187
192
|
- lib/polyrun/config.rb
|
|
193
|
+
- lib/polyrun/config/dotted_path.rb
|
|
194
|
+
- lib/polyrun/config/effective.rb
|
|
195
|
+
- lib/polyrun/config/resolver.rb
|
|
188
196
|
- lib/polyrun/coverage/cobertura_zero_lines.rb
|
|
189
197
|
- lib/polyrun/coverage/collector.rb
|
|
190
198
|
- lib/polyrun/coverage/collector_finish.rb
|
|
@@ -226,8 +234,10 @@ files:
|
|
|
226
234
|
- lib/polyrun/partition/plan_lpt.rb
|
|
227
235
|
- lib/polyrun/partition/plan_sharding.rb
|
|
228
236
|
- lib/polyrun/partition/stable_shuffle.rb
|
|
237
|
+
- lib/polyrun/partition/timing_keys.rb
|
|
229
238
|
- lib/polyrun/prepare/artifacts.rb
|
|
230
239
|
- lib/polyrun/prepare/assets.rb
|
|
240
|
+
- lib/polyrun/process_stdio.rb
|
|
231
241
|
- lib/polyrun/queue/file_store.rb
|
|
232
242
|
- lib/polyrun/queue/file_store_pending.rb
|
|
233
243
|
- lib/polyrun/quick.rb
|
|
@@ -248,6 +258,7 @@ files:
|
|
|
248
258
|
- lib/polyrun/templates/minimal_gem.polyrun.yml
|
|
249
259
|
- lib/polyrun/templates/rails_prepare.polyrun.yml
|
|
250
260
|
- lib/polyrun/timing/merge.rb
|
|
261
|
+
- lib/polyrun/timing/rspec_example_formatter.rb
|
|
251
262
|
- lib/polyrun/timing/summary.rb
|
|
252
263
|
- lib/polyrun/version.rb
|
|
253
264
|
- polyrun.gemspec
|