Class: Perfgate::CLI::RunComparisonReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/perfgate/cli/run_comparison_reporter.rb

Overview

Handles baseline run's optional --compare PATH step: loads the reference bundle (tolerating a missing one, since the spec's GitHub Actions example downloads it with continue-on-error), compares it against the freshly-run result, saves and reports the comparison, and returns the CI exit code. Split out of RunCommand to keep both classes under RuboCop's length limits.

Instance Method Summary collapse

Constructor Details

#initialize(reference_path:, output_root:, format:) ⇒ RunComparisonReporter

Returns a new instance of RunComparisonReporter.



18
19
20
21
22
# File 'lib/perfgate/cli/run_comparison_reporter.rb', line 18

def initialize(reference_path:, output_root:, format:)
  @reference_path = reference_path
  @output_root = output_root
  @format = format
end

Instance Method Details

#call(config:, run_result:, run_dir:) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/perfgate/cli/run_comparison_reporter.rb', line 24

def call(config:, run_result:, run_dir:)
  reference_run = load_reference
  return missing_baseline_report(config, run_dir) unless reference_run

  comparison_result = Comparison::Engine.compare(baseline_run: reference_run, candidate_run: run_result,
                                                 config: config)
  report_comparison(config, comparison_result, run_dir)
end