polyrun 3.2.0-java
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 +7 -0
- data/CHANGELOG.md +234 -0
- data/CODE_OF_CONDUCT.md +26 -0
- data/CONTRIBUTING.md +23 -0
- data/LICENSE +21 -0
- data/README.md +251 -0
- data/SECURITY.md +25 -0
- data/bin/polyrun +6 -0
- data/docs/QUALITY.md +82 -0
- data/docs/QUALITY_CONFIGURATION.md +95 -0
- data/docs/SETUP_PROFILE.md +139 -0
- data/lib/polyrun/benchmark/pressure/cooker.rb +191 -0
- data/lib/polyrun/benchmark/pressure/process_sample.rb +127 -0
- data/lib/polyrun/benchmark/pressure.rb +144 -0
- data/lib/polyrun/benchmark/profile.rb +191 -0
- data/lib/polyrun/benchmark/report.rb +87 -0
- data/lib/polyrun/cli/benchmark_commands.rb +66 -0
- data/lib/polyrun/cli/ci_shard_hooks.rb +129 -0
- data/lib/polyrun/cli/ci_shard_run_command.rb +177 -0
- data/lib/polyrun/cli/ci_shard_run_parse.rb +68 -0
- data/lib/polyrun/cli/config_command.rb +42 -0
- data/lib/polyrun/cli/coverage_commands.rb +150 -0
- data/lib/polyrun/cli/coverage_merge_io.rb +150 -0
- data/lib/polyrun/cli/database_commands.rb +163 -0
- data/lib/polyrun/cli/default_run.rb +144 -0
- data/lib/polyrun/cli/doctor_command.rb +94 -0
- data/lib/polyrun/cli/env_commands.rb +43 -0
- data/lib/polyrun/cli/failure_commands.rb +99 -0
- data/lib/polyrun/cli/graph_command.rb +68 -0
- data/lib/polyrun/cli/help.rb +83 -0
- data/lib/polyrun/cli/helpers.rb +162 -0
- data/lib/polyrun/cli/hooks_command.rb +97 -0
- data/lib/polyrun/cli/init_command.rb +108 -0
- data/lib/polyrun/cli/mutation_command.rb +67 -0
- data/lib/polyrun/cli/partition_diagnostics.rb +22 -0
- data/lib/polyrun/cli/plan_command.rb +184 -0
- data/lib/polyrun/cli/prepare_command.rb +70 -0
- data/lib/polyrun/cli/prepare_recipe.rb +82 -0
- data/lib/polyrun/cli/quality_commands.rb +65 -0
- data/lib/polyrun/cli/queue_command.rb +161 -0
- data/lib/polyrun/cli/quick_command.rb +13 -0
- data/lib/polyrun/cli/report_commands.rb +108 -0
- data/lib/polyrun/cli/run_queue_command.rb +127 -0
- data/lib/polyrun/cli/run_shards_command.rb +164 -0
- data/lib/polyrun/cli/run_shards_parallel_children.rb +112 -0
- data/lib/polyrun/cli/run_shards_parallel_wait.rb +252 -0
- data/lib/polyrun/cli/run_shards_plan_boot_phases.rb +207 -0
- data/lib/polyrun/cli/run_shards_plan_options.rb +74 -0
- data/lib/polyrun/cli/run_shards_planning.rb +123 -0
- data/lib/polyrun/cli/run_shards_run.rb +171 -0
- data/lib/polyrun/cli/run_shards_worker_interrupt.rb +101 -0
- data/lib/polyrun/cli/skip_env.rb +34 -0
- data/lib/polyrun/cli/spec_quality_commands.rb +149 -0
- data/lib/polyrun/cli/start_bootstrap.rb +126 -0
- data/lib/polyrun/cli/timing_command.rb +31 -0
- data/lib/polyrun/cli/tool_options.rb +48 -0
- data/lib/polyrun/cli/validate_command.rb +26 -0
- data/lib/polyrun/cli.rb +272 -0
- data/lib/polyrun/config/dotted_path.rb +21 -0
- data/lib/polyrun/config/effective.rb +82 -0
- data/lib/polyrun/config/resolver.rb +114 -0
- data/lib/polyrun/config/schema.rb +39 -0
- data/lib/polyrun/config/suite.rb +109 -0
- data/lib/polyrun/config/tool_defaults.rb +42 -0
- data/lib/polyrun/config/tool_validation.rb +79 -0
- data/lib/polyrun/config/tools.rb +120 -0
- data/lib/polyrun/config.rb +97 -0
- data/lib/polyrun/coverage/cobertura_zero_lines.rb +32 -0
- data/lib/polyrun/coverage/collector.rb +169 -0
- data/lib/polyrun/coverage/collector_blob.rb +53 -0
- data/lib/polyrun/coverage/collector_finish.rb +98 -0
- data/lib/polyrun/coverage/collector_fragment_meta.rb +57 -0
- data/lib/polyrun/coverage/config_resolve.rb +131 -0
- data/lib/polyrun/coverage/example_diff.rb +184 -0
- data/lib/polyrun/coverage/example_diff_snapshot.rb +44 -0
- data/lib/polyrun/coverage/example_diff_track_filter.rb +51 -0
- data/lib/polyrun/coverage/file_stats_report.rb +36 -0
- data/lib/polyrun/coverage/filter.rb +22 -0
- data/lib/polyrun/coverage/formatter.rb +137 -0
- data/lib/polyrun/coverage/merge/formatters.rb +188 -0
- data/lib/polyrun/coverage/merge/formatters_html.rb +221 -0
- data/lib/polyrun/coverage/merge/html/_file_list.html.erb +21 -0
- data/lib/polyrun/coverage/merge/html/_file_section.html.erb +26 -0
- data/lib/polyrun/coverage/merge/html/_groups_table.html.erb +18 -0
- data/lib/polyrun/coverage/merge/html/_overview.html.erb +47 -0
- data/lib/polyrun/coverage/merge/html/report.css +147 -0
- data/lib/polyrun/coverage/merge/html/report.js +48 -0
- data/lib/polyrun/coverage/merge/html/template.html.erb +30 -0
- data/lib/polyrun/coverage/merge.rb +160 -0
- data/lib/polyrun/coverage/merge_fragment_meta.rb +58 -0
- data/lib/polyrun/coverage/merge_merge_two.rb +168 -0
- data/lib/polyrun/coverage/merge_native.rb +39 -0
- data/lib/polyrun/coverage/rails.rb +126 -0
- data/lib/polyrun/coverage/reporting.rb +41 -0
- data/lib/polyrun/coverage/result.rb +18 -0
- data/lib/polyrun/coverage/track_files.rb +150 -0
- data/lib/polyrun/data/cached_fixtures.rb +122 -0
- data/lib/polyrun/data/factory_counts.rb +48 -0
- data/lib/polyrun/data/factory_instrumentation.rb +50 -0
- data/lib/polyrun/data/fixtures.rb +68 -0
- data/lib/polyrun/data/parallel_provisioning.rb +93 -0
- data/lib/polyrun/data/snapshot.rb +84 -0
- data/lib/polyrun/database/clone_shards.rb +106 -0
- data/lib/polyrun/database/provision.rb +83 -0
- data/lib/polyrun/database/shard.rb +64 -0
- data/lib/polyrun/database/url_builder/connection/infer.rb +53 -0
- data/lib/polyrun/database/url_builder/connection/url_builders.rb +43 -0
- data/lib/polyrun/database/url_builder/connection.rb +191 -0
- data/lib/polyrun/database/url_builder/template_prepare.rb +21 -0
- data/lib/polyrun/database/url_builder.rb +188 -0
- data/lib/polyrun/debug.rb +81 -0
- data/lib/polyrun/env/ci.rb +65 -0
- data/lib/polyrun/error.rb +3 -0
- data/lib/polyrun/export/csv.rb +25 -0
- data/lib/polyrun/export/markdown.rb +47 -0
- data/lib/polyrun/graph/client.rb +64 -0
- data/lib/polyrun/graph/error.rb +13 -0
- data/lib/polyrun/graph/index.rb +75 -0
- data/lib/polyrun/graph/inspect.rb +58 -0
- data/lib/polyrun/graph/plan.rb +134 -0
- data/lib/polyrun/graph/planner.rb +117 -0
- data/lib/polyrun/graph/syntax.rb +114 -0
- data/lib/polyrun/graph/transaction.rb +81 -0
- data/lib/polyrun/graph/worker.rb +55 -0
- data/lib/polyrun/graph/workspace.rb +117 -0
- data/lib/polyrun/hooks/dsl.rb +128 -0
- data/lib/polyrun/hooks/shell_runner.rb +33 -0
- data/lib/polyrun/hooks/worker_runner.rb +27 -0
- data/lib/polyrun/hooks/worker_shell.rb +50 -0
- data/lib/polyrun/hooks.rb +190 -0
- data/lib/polyrun/log.rb +86 -0
- data/lib/polyrun/minitest_support.rb +60 -0
- data/lib/polyrun/mutation/candidates.rb +91 -0
- data/lib/polyrun/mutation/operators.rb +51 -0
- data/lib/polyrun/mutation/runner.rb +133 -0
- data/lib/polyrun/mutation/subjects.rb +88 -0
- data/lib/polyrun/partition/constraints.rb +80 -0
- data/lib/polyrun/partition/hrw.rb +70 -0
- data/lib/polyrun/partition/min_heap.rb +64 -0
- data/lib/polyrun/partition/paths.rb +175 -0
- data/lib/polyrun/partition/paths_build.rb +141 -0
- data/lib/polyrun/partition/plan.rb +250 -0
- data/lib/polyrun/partition/plan_lpt.rb +91 -0
- data/lib/polyrun/partition/plan_sharding.rb +56 -0
- data/lib/polyrun/partition/reports.rb +139 -0
- data/lib/polyrun/partition/stable_shuffle.rb +18 -0
- data/lib/polyrun/partition/suite.rb +120 -0
- data/lib/polyrun/partition/timing_diagnostics.rb +138 -0
- data/lib/polyrun/partition/timing_keys.rb +86 -0
- data/lib/polyrun/prepare/artifacts.rb +40 -0
- data/lib/polyrun/prepare/assets.rb +64 -0
- data/lib/polyrun/process_stdio.rb +96 -0
- data/lib/polyrun/quality/command.rb +84 -0
- data/lib/polyrun/quality/measure.rb +38 -0
- data/lib/polyrun/quality/observe.rb +53 -0
- data/lib/polyrun/quality/observe_hook.rb +103 -0
- data/lib/polyrun/quality/sandbox.rb +70 -0
- data/lib/polyrun/queue/duration.rb +30 -0
- data/lib/polyrun/queue/file_store.rb +413 -0
- data/lib/polyrun/queue/file_store_intent.rb +188 -0
- data/lib/polyrun/queue/file_store_pending.rb +48 -0
- data/lib/polyrun/queue/worker_loop.rb +73 -0
- data/lib/polyrun/quick/assertions.rb +32 -0
- data/lib/polyrun/quick/config.rb +56 -0
- data/lib/polyrun/quick/errors.rb +6 -0
- data/lib/polyrun/quick/example_group.rb +111 -0
- data/lib/polyrun/quick/example_runner.rb +129 -0
- data/lib/polyrun/quick/matchers.rb +159 -0
- data/lib/polyrun/quick/matchers_predicates.rb +122 -0
- data/lib/polyrun/quick/reporter.rb +76 -0
- data/lib/polyrun/quick/runner.rb +224 -0
- data/lib/polyrun/quick.rb +1 -0
- data/lib/polyrun/railtie.rb +7 -0
- data/lib/polyrun/reporting/failure_merge.rb +171 -0
- data/lib/polyrun/reporting/junit.rb +126 -0
- data/lib/polyrun/reporting/junit_emit.rb +58 -0
- data/lib/polyrun/reporting/junit_report.rb +87 -0
- data/lib/polyrun/reporting/rspec_failure_fragment_formatter.rb +95 -0
- data/lib/polyrun/reporting/rspec_junit.rb +39 -0
- data/lib/polyrun/rspec_support/active_record_timeout_recovery.rb +51 -0
- data/lib/polyrun/rspec_support/example_debug.rb +167 -0
- data/lib/polyrun/rspec_support/example_debug_instrumentation.rb +73 -0
- data/lib/polyrun/rspec_support/sharded_formatter_compat.rb +57 -0
- data/lib/polyrun/rspec_support.rb +110 -0
- data/lib/polyrun/spec_quality/config.rb +139 -0
- data/lib/polyrun/spec_quality/fragment.rb +39 -0
- data/lib/polyrun/spec_quality/merge.rb +78 -0
- data/lib/polyrun/spec_quality/minitest_hook.rb +42 -0
- data/lib/polyrun/spec_quality/plan_loader.rb +47 -0
- data/lib/polyrun/spec_quality/profile.rb +102 -0
- data/lib/polyrun/spec_quality/report.rb +363 -0
- data/lib/polyrun/spec_quality/rspec_hook.rb +55 -0
- data/lib/polyrun/spec_quality/sql_counter.rb +34 -0
- data/lib/polyrun/spec_quality.rb +212 -0
- data/lib/polyrun/sus_support.rb +55 -0
- data/lib/polyrun/templates/POLYRUN.md +51 -0
- data/lib/polyrun/templates/ci_matrix.polyrun.yml +22 -0
- data/lib/polyrun/templates/minimal_gem.polyrun.yml +13 -0
- data/lib/polyrun/templates/polyrun_hooks_spec_quality.rb +12 -0
- data/lib/polyrun/templates/polyrun_spec_quality.yml +20 -0
- data/lib/polyrun/templates/rails_prepare.polyrun.yml +51 -0
- data/lib/polyrun/templates/rails_prepare_task.rake +16 -0
- data/lib/polyrun/timing/merge.rb +36 -0
- data/lib/polyrun/timing/rspec_example_formatter.rb +60 -0
- data/lib/polyrun/timing/stats.rb +76 -0
- data/lib/polyrun/timing/summary.rb +78 -0
- data/lib/polyrun/timing/variance_report.rb +51 -0
- data/lib/polyrun/version.rb +3 -0
- data/lib/polyrun/worker_output.rb +181 -0
- data/lib/polyrun/worker_output_forwarders.rb +94 -0
- data/lib/polyrun/worker_ping.rb +77 -0
- data/lib/polyrun.rb +59 -0
- data/polyrun.gemspec +49 -0
- data/sig/polyrun/cli.rbs +6 -0
- data/sig/polyrun/config.rbs +20 -0
- data/sig/polyrun/debug.rbs +12 -0
- data/sig/polyrun/log.rbs +12 -0
- data/sig/polyrun/minitest_support.rbs +7 -0
- data/sig/polyrun/quick.rbs +19 -0
- data/sig/polyrun/rspec_support.rbs +21 -0
- data/sig/polyrun/sus_support.rbs +7 -0
- data/sig/polyrun/worker_output.rbs +11 -0
- data/sig/polyrun/worker_ping.rbs +10 -0
- data/sig/polyrun.rbs +11 -0
- metadata +463 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
require_relative "stats"
|
|
2
|
+
require_relative "../export/csv"
|
|
3
|
+
require_relative "../export/markdown"
|
|
4
|
+
|
|
5
|
+
module Polyrun
|
|
6
|
+
module Timing
|
|
7
|
+
# Human-readable slow-file list from merged timing JSON (per-file cost).
|
|
8
|
+
module Summary
|
|
9
|
+
CSV_HEADERS = %w[rank path last_seconds min max mean p95 runs failures timeouts].freeze
|
|
10
|
+
MARKDOWN_HEADERS = %w[rank path seconds].freeze
|
|
11
|
+
|
|
12
|
+
module_function
|
|
13
|
+
|
|
14
|
+
def ranked_entries(merged, top: 30)
|
|
15
|
+
return [] if merged.nil? || merged.empty?
|
|
16
|
+
|
|
17
|
+
merged.map { |path, entry| [path, Stats.normalize_entry(entry)] }
|
|
18
|
+
.sort_by { |(_, entry)| -Stats.binpack_weight(entry) }
|
|
19
|
+
.first(Integer(top))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# +merged+ is path (String) => seconds (Float) or stats Hash, as produced by +Timing::Merge.merge_files+.
|
|
23
|
+
def format_slow_files(merged, top: 30, title: "Polyrun slowest files (by wall time, seconds)")
|
|
24
|
+
return "#{title}\n (no data)\n" if merged.nil? || merged.empty?
|
|
25
|
+
|
|
26
|
+
lines = [title, ""]
|
|
27
|
+
ranked_entries(merged, top: top).each_with_index do |(path, entry), index|
|
|
28
|
+
lines << format(" %2d. %s %.4f", index + 1, path, Stats.binpack_weight(entry).to_f)
|
|
29
|
+
end
|
|
30
|
+
lines.join("\n") + "\n"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def format_csv(merged, top: 30)
|
|
34
|
+
rows = ranked_entries(merged, top: top).each_with_index.map do |(path, entry), index|
|
|
35
|
+
[
|
|
36
|
+
index + 1,
|
|
37
|
+
path,
|
|
38
|
+
entry["last_seconds"],
|
|
39
|
+
entry["min"],
|
|
40
|
+
entry["max"],
|
|
41
|
+
entry["mean"],
|
|
42
|
+
entry["p95"],
|
|
43
|
+
entry["runs"],
|
|
44
|
+
entry["failures"],
|
|
45
|
+
entry["timeouts"]
|
|
46
|
+
]
|
|
47
|
+
end
|
|
48
|
+
Export::Csv.generate(CSV_HEADERS, rows)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def format_markdown(merged, top: 30, title: "Polyrun slowest files")
|
|
52
|
+
rows = ranked_entries(merged, top: top).each_with_index.map do |(path, entry), index|
|
|
53
|
+
[index + 1, path, format("%.4f", Stats.binpack_weight(entry).to_f)]
|
|
54
|
+
end
|
|
55
|
+
Export::Markdown.document(
|
|
56
|
+
title,
|
|
57
|
+
[{heading: "Slow files", headers: MARKDOWN_HEADERS, rows: rows}]
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def render(merged, format: "text", **kwargs)
|
|
62
|
+
case format.to_s.downcase
|
|
63
|
+
when "text", "console", "txt" then format_slow_files(merged, **kwargs)
|
|
64
|
+
when "csv" then format_csv(merged, **kwargs)
|
|
65
|
+
when "markdown", "md" then format_markdown(merged, **kwargs)
|
|
66
|
+
else
|
|
67
|
+
raise Polyrun::Error, "report-timing: unknown format #{format.inspect} (use text, csv, or markdown)"
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def write_file(merged, path, **kwargs)
|
|
72
|
+
format = kwargs.delete(:format) || "text"
|
|
73
|
+
File.write(path, render(merged, format: format, **kwargs))
|
|
74
|
+
path
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module Polyrun
|
|
2
|
+
module Timing
|
|
3
|
+
# Flags high-variance, flaky, and regression timing entries.
|
|
4
|
+
module VarianceReport
|
|
5
|
+
module_function
|
|
6
|
+
|
|
7
|
+
# rubocop:disable Metrics/AbcSize -- variance flag scan
|
|
8
|
+
def analyze(merged_stats)
|
|
9
|
+
flags = []
|
|
10
|
+
merged_stats.each do |path, entry|
|
|
11
|
+
h = Stats.normalize_entry(entry)
|
|
12
|
+
next if h["runs"] < 2
|
|
13
|
+
|
|
14
|
+
median = h["mean"]
|
|
15
|
+
if median.positive? && (h["p95"] / median) > 2.0
|
|
16
|
+
flags << {path: path, kind: "high_variance", detail: "p95/mean=#{format("%.2f", h["p95"] / median)}"}
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
if h["runs"] >= 3 && (h["failures"].to_f / h["runs"]) > 0.3
|
|
20
|
+
flags << {path: path, kind: "often_failed", detail: "failures=#{h["failures"]}/#{h["runs"]}"}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
if h["timeouts"].to_i >= 2
|
|
24
|
+
flags << {path: path, kind: "timeout_cluster", detail: "timeouts=#{h["timeouts"]}"}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
if h["mean"].positive? && h["last_seconds"] > (2.0 * h["mean"])
|
|
28
|
+
flags << {path: path, kind: "runtime_regression", detail: "last=#{h["last_seconds"]} mean=#{h["mean"]}"}
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
flags
|
|
32
|
+
end
|
|
33
|
+
# rubocop:enable Metrics/AbcSize
|
|
34
|
+
|
|
35
|
+
def emit_warnings!(merged_stats)
|
|
36
|
+
analyze(merged_stats).each do |f|
|
|
37
|
+
Polyrun::Log.warn "polyrun timing #{f[:kind]}: #{f[:path]} (#{f[:detail]})"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def format_report(merged_stats)
|
|
42
|
+
lines = ["Polyrun timing variance report", ""]
|
|
43
|
+
analyze(merged_stats).each do |f|
|
|
44
|
+
lines << " [#{f[:kind]}] #{f[:path]} — #{f[:detail]}"
|
|
45
|
+
end
|
|
46
|
+
lines << " (none)" if lines.size == 2
|
|
47
|
+
lines.join("\n") + "\n"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
require "fileutils"
|
|
2
|
+
require_relative "worker_output_forwarders"
|
|
3
|
+
|
|
4
|
+
module Polyrun
|
|
5
|
+
# Routes parallel worker stdout/stderr through per-shard log files with optional prefixed TTY echo.
|
|
6
|
+
#
|
|
7
|
+
# Opt-in: +POLYRUN_WORKER_OUTPUT_ROUTING=1+ (or set +POLYRUN_WORKER_LOG_DIR+).
|
|
8
|
+
# +POLYRUN_WORKER_OUTPUT_ROUTING=0+ keeps inherited stdio (default polyrun behavior).
|
|
9
|
+
# +POLYRUN_WORKER_OUTPUT_PREFIX=0+ writes logs only (no live prefixed echo).
|
|
10
|
+
module WorkerOutput
|
|
11
|
+
module_function
|
|
12
|
+
|
|
13
|
+
def routing_enabled?
|
|
14
|
+
return false if disabled_by_env?
|
|
15
|
+
|
|
16
|
+
truthy?(ENV["POLYRUN_WORKER_OUTPUT_ROUTING"]) || !log_directory.nil?
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def log_directory
|
|
20
|
+
value = ENV["POLYRUN_WORKER_LOG_DIR"]
|
|
21
|
+
return nil if value.nil?
|
|
22
|
+
|
|
23
|
+
stripped = value.to_s.strip
|
|
24
|
+
stripped.empty? ? nil : stripped
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def prefix_live?
|
|
28
|
+
return true if ENV["POLYRUN_WORKER_OUTPUT_PREFIX"].nil?
|
|
29
|
+
|
|
30
|
+
truthy?(ENV["POLYRUN_WORKER_OUTPUT_PREFIX"])
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def log_path_for(shard)
|
|
34
|
+
File.expand_path("shard-#{shard}.log", log_directory || default_log_directory)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def worker_log_directory_label
|
|
38
|
+
log_directory || default_log_directory
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def prepare_log_dir!
|
|
42
|
+
directory = log_directory || default_log_directory
|
|
43
|
+
FileUtils.mkdir_p(directory)
|
|
44
|
+
Dir.glob(File.join(directory, "shard-*.log")).each { |path| File.delete(path) }
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def warn_shard_log(shard)
|
|
48
|
+
return unless routing_enabled?
|
|
49
|
+
|
|
50
|
+
Polyrun::Log.warn "polyrun run-shards: shard #{shard} worker log → #{log_path_for(shard)}"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def spawn_worker(child_env, cmd, paths, hook_cfg)
|
|
54
|
+
shard = child_env.fetch("POLYRUN_SHARD_INDEX", "?")
|
|
55
|
+
log_io = File.open(log_path_for(shard), "wb")
|
|
56
|
+
out_read, out_write = IO.pipe
|
|
57
|
+
err_read, err_write = IO.pipe
|
|
58
|
+
|
|
59
|
+
argv = if hook_cfg.worker_hooks? && !Polyrun::Hooks.disabled?
|
|
60
|
+
["sh", "-c", hook_cfg.build_worker_shell_script(cmd, paths)]
|
|
61
|
+
else
|
|
62
|
+
Array(cmd) + Array(paths)
|
|
63
|
+
end
|
|
64
|
+
pid = Process.spawn(child_env, *argv, out: out_write, err: err_write, pgroup: true)
|
|
65
|
+
|
|
66
|
+
out_write.close
|
|
67
|
+
err_write.close
|
|
68
|
+
|
|
69
|
+
start_forwarders(
|
|
70
|
+
pid: pid,
|
|
71
|
+
shard: shard,
|
|
72
|
+
stdout_io: out_read,
|
|
73
|
+
stderr_io: err_read,
|
|
74
|
+
log_io: log_io
|
|
75
|
+
)
|
|
76
|
+
pid
|
|
77
|
+
rescue
|
|
78
|
+
[log_io, out_read, out_write, err_read, err_write].compact.each do |io|
|
|
79
|
+
io.close unless io.closed?
|
|
80
|
+
rescue IOError
|
|
81
|
+
nil
|
|
82
|
+
end
|
|
83
|
+
raise unless pid
|
|
84
|
+
|
|
85
|
+
begin
|
|
86
|
+
Process.kill("KILL", -pid)
|
|
87
|
+
rescue Errno::ESRCH
|
|
88
|
+
nil
|
|
89
|
+
ensure
|
|
90
|
+
Process.waitpid(pid)
|
|
91
|
+
end
|
|
92
|
+
raise
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def start_forwarders(pid:, shard:, stdout_io:, stderr_io:, log_io:)
|
|
96
|
+
forwarder = WorkerForwarder.new(
|
|
97
|
+
shard: shard,
|
|
98
|
+
pid: pid,
|
|
99
|
+
log_io: log_io,
|
|
100
|
+
prefix_live: prefix_live?
|
|
101
|
+
)
|
|
102
|
+
threads = [
|
|
103
|
+
forwarder_thread(stdout_io, forwarder, :stdout),
|
|
104
|
+
forwarder_thread(stderr_io, forwarder, :stderr)
|
|
105
|
+
]
|
|
106
|
+
registry[pid] = {threads: threads, ios: [stdout_io, stderr_io], forwarder: forwarder}
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def finish_worker(pid)
|
|
110
|
+
entry = registry.delete(pid)
|
|
111
|
+
return unless entry
|
|
112
|
+
|
|
113
|
+
drain_forwarders(entry)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def shutdown_all!
|
|
117
|
+
registry.each_value { |entry| drain_forwarders(entry) }
|
|
118
|
+
registry.clear
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def default_log_directory
|
|
122
|
+
"tmp/polyrun/workers"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def disabled_by_env?
|
|
126
|
+
%w[0 false no off].include?(ENV["POLYRUN_WORKER_OUTPUT_ROUTING"].to_s.strip.downcase)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def truthy?(value)
|
|
130
|
+
return false if value.nil?
|
|
131
|
+
|
|
132
|
+
%w[1 true yes on].include?(value.to_s.strip.downcase)
|
|
133
|
+
end
|
|
134
|
+
private_class_method :truthy?
|
|
135
|
+
|
|
136
|
+
# rubocop:disable ThreadSafety/ClassInstanceVariable -- per-parent-process worker forwarder registry
|
|
137
|
+
def registry
|
|
138
|
+
@registry ||= {}
|
|
139
|
+
end
|
|
140
|
+
private_class_method :registry
|
|
141
|
+
# rubocop:enable ThreadSafety/ClassInstanceVariable
|
|
142
|
+
|
|
143
|
+
def forwarder_thread(io, forwarder, stream)
|
|
144
|
+
# rubocop:disable ThreadSafety/NewThread -- one reader thread per worker pipe
|
|
145
|
+
Thread.new do
|
|
146
|
+
loop do
|
|
147
|
+
forwarder.consume(stream, io.readpartial(4096))
|
|
148
|
+
end
|
|
149
|
+
rescue IOError, Errno::EPIPE
|
|
150
|
+
drain_remaining_output(io, forwarder, stream)
|
|
151
|
+
ensure
|
|
152
|
+
io.close unless io.closed?
|
|
153
|
+
end
|
|
154
|
+
# rubocop:enable ThreadSafety/NewThread
|
|
155
|
+
end
|
|
156
|
+
private_class_method :forwarder_thread
|
|
157
|
+
|
|
158
|
+
# EOFError subclasses IOError; keep drain rescues separate so a closed pipe
|
|
159
|
+
# during the final read does not escape the forwarder thread.
|
|
160
|
+
def drain_remaining_output(io, forwarder, stream)
|
|
161
|
+
remaining = io.read
|
|
162
|
+
forwarder.consume(stream, remaining) if remaining && !remaining.empty?
|
|
163
|
+
rescue IOError, Errno::EPIPE
|
|
164
|
+
nil
|
|
165
|
+
end
|
|
166
|
+
private_class_method :drain_remaining_output
|
|
167
|
+
|
|
168
|
+
def drain_forwarders(entry)
|
|
169
|
+
# Join first so threads can drain pipe buffers after the child exits.
|
|
170
|
+
# Closing read ends before join races and can drop the final bytes.
|
|
171
|
+
entry[:threads].each(&:join)
|
|
172
|
+
entry[:ios].each do |io|
|
|
173
|
+
io.close unless io.closed?
|
|
174
|
+
rescue IOError
|
|
175
|
+
nil
|
|
176
|
+
end
|
|
177
|
+
entry[:forwarder].close
|
|
178
|
+
end
|
|
179
|
+
private_class_method :drain_forwarders
|
|
180
|
+
end
|
|
181
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
require "time"
|
|
2
|
+
|
|
3
|
+
module Polyrun
|
|
4
|
+
module WorkerOutput
|
|
5
|
+
class LineForwarder
|
|
6
|
+
def initialize(shard:, pid:, log_io:, prefix_live:, tty_io:)
|
|
7
|
+
@shard = shard
|
|
8
|
+
@pid = pid
|
|
9
|
+
@log_io = log_io
|
|
10
|
+
@prefix_live = prefix_live
|
|
11
|
+
@tty_io = tty_io
|
|
12
|
+
@buffer = +""
|
|
13
|
+
@mutex = Mutex.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def consume(chunk)
|
|
17
|
+
return if chunk.nil? || chunk.empty?
|
|
18
|
+
|
|
19
|
+
@mutex.synchronize do
|
|
20
|
+
if progress_chunk?(chunk)
|
|
21
|
+
write_tty(chunk) if @prefix_live
|
|
22
|
+
@log_io&.write(chunk)
|
|
23
|
+
return
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
offset = @buffer.length
|
|
27
|
+
@buffer << chunk
|
|
28
|
+
line_prefix = nil
|
|
29
|
+
while (newline_index = @buffer.index("\n", offset))
|
|
30
|
+
line_prefix ||= prefix
|
|
31
|
+
emit_line(@buffer.slice!(0, newline_index + 1), line_prefix)
|
|
32
|
+
offset = 0
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def flush
|
|
38
|
+
@mutex.synchronize do
|
|
39
|
+
next if @buffer.empty?
|
|
40
|
+
|
|
41
|
+
emit_line(@buffer)
|
|
42
|
+
@buffer.clear
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def progress_chunk?(chunk)
|
|
49
|
+
chunk.include?("\r") && !chunk.include?("\n")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def emit_line(line, line_prefix = prefix)
|
|
53
|
+
prefixed = "#{line_prefix}#{line}"
|
|
54
|
+
@log_io&.write(prefixed)
|
|
55
|
+
write_tty(prefixed) if @prefix_live
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def prefix
|
|
59
|
+
"[#{Time.now.strftime("%Y-%m-%dT%H:%M:%S")} shard=#{@shard} pid=#{@pid}] "
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def write_tty(text)
|
|
63
|
+
@tty_io.write(text)
|
|
64
|
+
@tty_io.flush
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
class WorkerForwarder
|
|
69
|
+
def initialize(shard:, pid:, log_io:, prefix_live:)
|
|
70
|
+
@shard = shard
|
|
71
|
+
@pid = pid
|
|
72
|
+
@log_io = log_io
|
|
73
|
+
@stdout = LineForwarder.new(shard: shard, pid: pid, log_io: @log_io, prefix_live: prefix_live, tty_io: Polyrun::Log.stdout)
|
|
74
|
+
@stderr = LineForwarder.new(shard: shard, pid: pid, log_io: @log_io, prefix_live: prefix_live, tty_io: Polyrun::Log.stderr)
|
|
75
|
+
@write_mutex = Mutex.new
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def consume(stream, chunk)
|
|
79
|
+
@write_mutex.synchronize do
|
|
80
|
+
case stream
|
|
81
|
+
when :stdout then @stdout.consume(chunk)
|
|
82
|
+
when :stderr then @stderr.consume(chunk)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def close
|
|
88
|
+
@stdout.flush
|
|
89
|
+
@stderr.flush
|
|
90
|
+
@log_io.close
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
module Polyrun
|
|
2
|
+
# Writes a monotonic timestamp to +POLYRUN_WORKER_PING_FILE+ when the test process advances
|
|
3
|
+
# (typically once per example). When +location:+ is passed (path:line of the example), the file
|
|
4
|
+
# is two lines: timestamp, then that string. Parents use +--worker-idle-timeout+ to detect a worker with no
|
|
5
|
+
# progress *inside* a single example—unlike a background thread, +ping!+ does not run while Ruby
|
|
6
|
+
# is busy on the main thread, so a tight CPU loop or stuck native code leaves the timestamp stale.
|
|
7
|
+
#
|
|
8
|
+
# Prefer framework installs (call from helpers *after* loading the runner):
|
|
9
|
+
#
|
|
10
|
+
# require "polyrun/rspec_support"
|
|
11
|
+
# Polyrun::RSpecSupport.install_worker_ping!
|
|
12
|
+
#
|
|
13
|
+
# require "polyrun/minitest_support"
|
|
14
|
+
# Polyrun::MinitestSupport.install_worker_ping!
|
|
15
|
+
#
|
|
16
|
+
# Polyrun Quick runs +ping!+ automatically when requiring the Quick stack.
|
|
17
|
+
#
|
|
18
|
+
# Optional interval thread (+POLYRUN_WORKER_PING_THREAD=1+, +POLYRUN_WORKER_PING_INTERVAL_SEC+): call
|
|
19
|
+
# {#ensure_interval_ping_thread!} once at worker startup if you rely on periodic pings without per-example {#ping!};
|
|
20
|
+
# installers call this so the env toggle works out of the box.
|
|
21
|
+
module WorkerPing
|
|
22
|
+
# Load-time constant: `||=` can create two mutexes.
|
|
23
|
+
INTERVAL_PING_MX = Mutex.new
|
|
24
|
+
private_constant :INTERVAL_PING_MX
|
|
25
|
+
|
|
26
|
+
class << self
|
|
27
|
+
def ping!(location: nil)
|
|
28
|
+
path = ping_file_path
|
|
29
|
+
return if path.empty?
|
|
30
|
+
|
|
31
|
+
t = Process.clock_gettime(Process::CLOCK_MONOTONIC).to_s
|
|
32
|
+
loc = location.to_s.strip
|
|
33
|
+
payload = loc.empty? ? t : "#{t}\n#{loc}"
|
|
34
|
+
File.binwrite(path, payload)
|
|
35
|
+
rescue SystemCallError
|
|
36
|
+
# best-effort
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def ping_file_path
|
|
40
|
+
ENV["POLYRUN_WORKER_PING_FILE"].to_s.strip
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Starts a periodic +ping!+ thread when +POLYRUN_WORKER_PING_THREAD+ is truthy and +POLYRUN_WORKER_PING_FILE+ is set.
|
|
44
|
+
# Prefer per-example {#ping!}; safe to call more than once (idempotent).
|
|
45
|
+
# rubocop:disable ThreadSafety/ClassInstanceVariable -- idempotent once-per-process latch
|
|
46
|
+
def ensure_interval_ping_thread!
|
|
47
|
+
thread_flag = ENV["POLYRUN_WORKER_PING_THREAD"]
|
|
48
|
+
return unless %w[1 true yes].include?(thread_flag&.downcase)
|
|
49
|
+
|
|
50
|
+
path = ping_file_path
|
|
51
|
+
return if path.empty?
|
|
52
|
+
|
|
53
|
+
INTERVAL_PING_MX.synchronize do
|
|
54
|
+
return if @interval_ping_started
|
|
55
|
+
|
|
56
|
+
raw = ENV["POLYRUN_WORKER_PING_INTERVAL_SEC"].to_s.strip
|
|
57
|
+
interval = Float(raw.empty? ? "15" : raw, exception: false) || 15.0
|
|
58
|
+
interval = 1.0 if interval < 1.0
|
|
59
|
+
|
|
60
|
+
ping!
|
|
61
|
+
# rubocop:disable ThreadSafety/NewThread -- optional periodic ping alongside per-example ping!
|
|
62
|
+
Thread.new do
|
|
63
|
+
loop do
|
|
64
|
+
sleep(interval)
|
|
65
|
+
ping!
|
|
66
|
+
rescue SystemCallError, Interrupt
|
|
67
|
+
break
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
# rubocop:enable ThreadSafety/NewThread
|
|
71
|
+
@interval_ping_started = true
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
# rubocop:enable ThreadSafety/ClassInstanceVariable
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
data/lib/polyrun.rb
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
require_relative "polyrun/version"
|
|
2
|
+
require_relative "polyrun/error"
|
|
3
|
+
require_relative "polyrun/log"
|
|
4
|
+
require_relative "polyrun/debug"
|
|
5
|
+
require_relative "polyrun/config"
|
|
6
|
+
require_relative "polyrun/coverage/merge"
|
|
7
|
+
require_relative "polyrun/coverage/filter"
|
|
8
|
+
require_relative "polyrun/coverage/result"
|
|
9
|
+
require_relative "polyrun/coverage/formatter"
|
|
10
|
+
require_relative "polyrun/coverage/collector"
|
|
11
|
+
require_relative "polyrun/coverage/reporting"
|
|
12
|
+
require_relative "polyrun/coverage/rails"
|
|
13
|
+
require_relative "polyrun/partition/plan"
|
|
14
|
+
require_relative "polyrun/partition/paths"
|
|
15
|
+
require_relative "polyrun/partition/suite"
|
|
16
|
+
require_relative "polyrun/partition/paths_build"
|
|
17
|
+
require_relative "polyrun/queue/file_store"
|
|
18
|
+
require_relative "polyrun/data/fixtures"
|
|
19
|
+
require_relative "polyrun/data/cached_fixtures"
|
|
20
|
+
require_relative "polyrun/data/parallel_provisioning"
|
|
21
|
+
require_relative "polyrun/data/factory_instrumentation"
|
|
22
|
+
require_relative "polyrun/data/snapshot"
|
|
23
|
+
require_relative "polyrun/data/factory_counts"
|
|
24
|
+
require_relative "polyrun/prepare/assets"
|
|
25
|
+
require_relative "polyrun/prepare/artifacts"
|
|
26
|
+
require_relative "polyrun/database/shard"
|
|
27
|
+
require_relative "polyrun/database/url_builder"
|
|
28
|
+
require_relative "polyrun/database/provision"
|
|
29
|
+
require_relative "polyrun/database/clone_shards"
|
|
30
|
+
require_relative "polyrun/hooks"
|
|
31
|
+
require_relative "polyrun/env/ci"
|
|
32
|
+
require_relative "polyrun/timing/merge"
|
|
33
|
+
require_relative "polyrun/timing/summary"
|
|
34
|
+
require_relative "polyrun/reporting/junit"
|
|
35
|
+
# RSpec JSON formatter + JUnit is opt-in: require "polyrun/reporting/rspec_junit" (loads RSpec only inside RspecJunit.install!).
|
|
36
|
+
require_relative "polyrun/cli"
|
|
37
|
+
|
|
38
|
+
if defined?(Rails::Railtie)
|
|
39
|
+
require_relative "polyrun/railtie"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
module Polyrun
|
|
43
|
+
# Delegate to {Polyrun::Log} for swappable stderr/stdout (CLI and library messages).
|
|
44
|
+
def self.stderr=(io)
|
|
45
|
+
Log.stderr = io
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.stderr
|
|
49
|
+
Log.stderr
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def self.stdout=(io)
|
|
53
|
+
Log.stdout = io
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.stdout
|
|
57
|
+
Log.stdout
|
|
58
|
+
end
|
|
59
|
+
end
|
data/polyrun.gemspec
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require_relative "lib/polyrun/version"
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |spec|
|
|
4
|
+
spec.name = "polyrun"
|
|
5
|
+
spec.version = Polyrun::VERSION
|
|
6
|
+
spec.authors = ["Andrei Makarov"]
|
|
7
|
+
spec.email = ["contact@kiskolabs.com"]
|
|
8
|
+
spec.summary = "Parallel tests, coverage (SimpleCov-compatible) formatters, fixtures/snapshots, assets & DB provisioning—zero runtime deps"
|
|
9
|
+
spec.description = "Polyrun runs parallel test shards, merges SimpleCov-compatible coverage, emits CI reports, and prepares fixtures, snapshots, assets, and databases. It ships with no runtime gem dependencies beyond the standard library and vendored or native code."
|
|
10
|
+
spec.homepage = "https://github.com/amkisko/polyrun.rb"
|
|
11
|
+
spec.license = "MIT"
|
|
12
|
+
spec.required_ruby_version = ">= 3.4"
|
|
13
|
+
|
|
14
|
+
spec.files = (
|
|
15
|
+
Dir["lib/**/*", "sig/**/*.rbs", "bin/polyrun", "README.md", "CHANGELOG.md", "docs/SETUP_PROFILE.md", "docs/QUALITY.md", "docs/QUALITY_CONFIGURATION.md", "LICENSE", "CONTRIBUTING.md", "CODE_OF_CONDUCT.md", "SECURITY.md", "polyrun.gemspec"] +
|
|
16
|
+
Dir["ext/**/extconf.rb", "ext/**/*.c", "ext/**/*.h"]
|
|
17
|
+
).uniq.reject { |f| File.directory?(f) }
|
|
18
|
+
spec.bindir = "bin"
|
|
19
|
+
spec.executables = ["polyrun"]
|
|
20
|
+
spec.require_paths = ["lib"]
|
|
21
|
+
spec.extensions = ["ext/polyrun_coverage_merge/extconf.rb"]
|
|
22
|
+
spec.extra_rdoc_files = %w[README.md CHANGELOG.md LICENSE CONTRIBUTING.md CODE_OF_CONDUCT.md SECURITY.md]
|
|
23
|
+
|
|
24
|
+
spec.metadata = {
|
|
25
|
+
"homepage_uri" => spec.homepage,
|
|
26
|
+
"source_code_uri" => "#{spec.homepage}/tree/main",
|
|
27
|
+
"changelog_uri" => "#{spec.homepage}/blob/main/CHANGELOG.md",
|
|
28
|
+
"bug_tracker_uri" => "#{spec.homepage}/issues",
|
|
29
|
+
"documentation_uri" => "#{spec.homepage}#readme",
|
|
30
|
+
"allowed_push_host" => "https://rubygems.org",
|
|
31
|
+
"rubygems_mfa_required" => "true"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# Normative: zero runtime dependencies (stdlib + vendored/native code only).
|
|
35
|
+
# Ruby 3.5+: `benchmark` is no longer a default gem; keep scripts and `rake bench_merge` warning-free.
|
|
36
|
+
spec.add_development_dependency "benchmark", ">= 0.3"
|
|
37
|
+
spec.add_development_dependency "benchmark-ips", "~> 2"
|
|
38
|
+
spec.add_development_dependency "memory_profiler", "~> 1"
|
|
39
|
+
spec.add_development_dependency "stackprof", "~> 0.2"
|
|
40
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
41
|
+
spec.add_development_dependency "rspec", "~> 3.12"
|
|
42
|
+
spec.add_development_dependency "appraisal", "~> 2.5"
|
|
43
|
+
spec.add_development_dependency "standard", "~> 1.52"
|
|
44
|
+
spec.add_development_dependency "standard-custom", "~> 1.0"
|
|
45
|
+
spec.add_development_dependency "standard-performance", "~> 1.8"
|
|
46
|
+
spec.add_development_dependency "rubocop-rspec", "~> 3.8"
|
|
47
|
+
spec.add_development_dependency "rubocop-thread_safety", "~> 0.7"
|
|
48
|
+
spec.add_development_dependency "rbs", ">= 3.5"
|
|
49
|
+
end
|
data/sig/polyrun/cli.rbs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Polyrun
|
|
2
|
+
class Config
|
|
3
|
+
DEFAULT_FILENAMES: Array[String]
|
|
4
|
+
|
|
5
|
+
attr_reader path: String?
|
|
6
|
+
attr_reader raw: untyped
|
|
7
|
+
|
|
8
|
+
def self.load: (?path: String?, ?suite: String?, ?root: String) -> Config
|
|
9
|
+
def self.resolve_path: (String? explicit, ?root: String) -> String?
|
|
10
|
+
|
|
11
|
+
def initialize: (path: String?, raw: untyped) -> void
|
|
12
|
+
|
|
13
|
+
def partition: () -> untyped
|
|
14
|
+
def prepare: () -> untyped
|
|
15
|
+
def coverage: () -> untyped
|
|
16
|
+
def databases: () -> untyped
|
|
17
|
+
def start_config: () -> untyped
|
|
18
|
+
def version: () -> untyped
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Polyrun
|
|
2
|
+
module Debug
|
|
3
|
+
def self.enabled?: () -> bool
|
|
4
|
+
def self.log: (String message) -> void
|
|
5
|
+
def self.log_kv: (untyped pairs) -> void
|
|
6
|
+
def self.log_worker: (String message) -> void
|
|
7
|
+
def self.log_worker_kv: (untyped pairs) -> void
|
|
8
|
+
def self.parallel_worker_process?: () -> bool
|
|
9
|
+
def self.time: [T] (String label) { () -> T } -> T
|
|
10
|
+
def self.wall_clock: () -> String
|
|
11
|
+
end
|
|
12
|
+
end
|
data/sig/polyrun/log.rbs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Polyrun
|
|
2
|
+
module Log
|
|
3
|
+
def self.stderr=: (untyped io) -> void
|
|
4
|
+
def self.stderr: () -> untyped
|
|
5
|
+
def self.stdout=: (untyped io) -> void
|
|
6
|
+
def self.stdout: () -> untyped
|
|
7
|
+
def self.warn: (?untyped? msg) -> void
|
|
8
|
+
def self.puts: (?untyped? msg) -> void
|
|
9
|
+
def self.print: (?String msg) -> void
|
|
10
|
+
def self.reset_io!: () -> void
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Polyrun
|
|
2
|
+
module Quick
|
|
3
|
+
class Error < Polyrun::Error
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
class AssertionFailed < Quick::Error
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.capybara!: () -> void
|
|
10
|
+
|
|
11
|
+
def self.capybara?: () -> bool
|
|
12
|
+
|
|
13
|
+
def self.reset_capybara_flag!: () -> void
|
|
14
|
+
|
|
15
|
+
class Runner
|
|
16
|
+
def self.run: (?paths: untyped?, ?out: untyped, ?err: untyped, ?verbose: bool) -> Integer
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|