Skip to content

Commit

Permalink
Merge pull request #1043 from Homebrew/selective_analytics
Browse files Browse the repository at this point in the history
Selectively report analytics.
  • Loading branch information
MikeMcQuaid committed Apr 26, 2024
2 parents 85ba7b4 + 18501eb commit 326b5c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/test.rb
Expand Up @@ -43,7 +43,7 @@ def info_header(text)
puts Formatter.headline(text, color: :cyan)
end

def test(*arguments, named_args: nil, env: {}, verbose: @verbose, ignore_failures: false)
def test(*arguments, named_args: nil, env: {}, verbose: @verbose, ignore_failures: false, report_analytics: false)
step = Step.new(
arguments,
named_args:,
Expand All @@ -55,7 +55,7 @@ def test(*arguments, named_args: nil, env: {}, verbose: @verbose, ignore_failure
step.run(dry_run: @dry_run, fail_fast: @fail_fast)
@steps << step

if ENV["HOMEBREW_TEST_BOT_ANALYTICS"].present?
if ENV["HOMEBREW_TEST_BOT_ANALYTICS"].present? && report_analytics
::Utils::Analytics.report_test_bot_test(step.command_short, step.passed?)
end

Expand Down
10 changes: 5 additions & 5 deletions lib/tests/formulae.rb
Expand Up @@ -499,14 +499,14 @@ def formula!(formula_name, args:)
test("brew", "install", *install_args,
named_args: formula_name,
env: env.merge({ "HOMEBREW_DEVELOPER" => nil }),
ignore_failures:)
ignore_failures:, report_analytics: true)
steps.last.passed?
end

livecheck(formula) if !args.skip_livecheck? && !skip_online_checks

test "brew", "style", "--formula", formula_name
test "brew", "audit", "--formula", *audit_args unless formula.deprecated?
test "brew", "style", "--formula", formula_name, report_analytics: true
test "brew", "audit", "--formula", *audit_args, report_analytics: true unless formula.deprecated?
unless install_step_passed
if ignore_failures
skipped formula_name, "install failed"
Expand All @@ -530,7 +530,7 @@ def formula!(formula_name, args:)
bottle_reinstall_formula(formula, new_formula, args:)
end
@built_formulae << formula.full_name
test("brew", "linkage", "--test", named_args: formula_name, ignore_failures:)
test("brew", "linkage", "--test", named_args: formula_name, ignore_failures:, report_analytics: true)
failed_linkage_or_test_messages ||= []
failed_linkage_or_test_messages << "linkage failed" unless steps.last.passed?

Expand All @@ -557,7 +557,7 @@ def formula!(formula_name, args:)

# Intentionally not passing --retry here to avoid papering over
# flaky tests when a formula isn't being pulled in as a dependent.
test("brew", "test", "--verbose", named_args: formula_name, env:, ignore_failures:)
test("brew", "test", "--verbose", named_args: formula_name, env:, ignore_failures:, report_analytics: true)
failed_linkage_or_test_messages << "test failed" unless steps.last.passed?
end

Expand Down

0 comments on commit 326b5c3

Please sign in to comment.