Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Library/Homebrew/test/test_bot/setup_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "test_bot"
require "dev-cmd/test-bot"

RSpec.describe Homebrew::TestBot::Setup do
subject(:setup) { described_class.new }
Expand All @@ -11,7 +11,7 @@
.exactly(3).times
.and_return(instance_double(Homebrew::TestBot::Step, passed?: true))

expect(setup.run!(args: instance_double(Homebrew::CLI::Args)).passed?).to be(true)
expect(setup.run!(args: instance_double(Homebrew::Cmd::TestBotCmd::Args)).passed?).to be(true)
end
end
end
6 changes: 5 additions & 1 deletion Library/Homebrew/test_bot.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: true # rubocop:todo Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

require "test_bot/step"
Expand All @@ -23,14 +23,17 @@ module TestBot

HOMEBREW_TAP_REGEX = %r{^([\w-]+)/homebrew-([\w-]+)$}

sig { params(args: Homebrew::Cmd::TestBotCmd::Args).returns(T::Boolean) }
def cleanup?(args)
args.cleanup? || GitHub::Actions.env_set?
end

sig { params(args: Homebrew::Cmd::TestBotCmd::Args).returns(T::Boolean) }
def local?(args)
args.local? || GitHub::Actions.env_set?
end

sig { params(tap: T.nilable(String)).returns(T.nilable(Tap)) }
def resolve_test_tap(tap = nil)
return Tap.fetch(tap) if tap

Expand All @@ -52,6 +55,7 @@ def resolve_test_tap(tap = nil)
end
end

sig { params(args: Homebrew::Cmd::TestBotCmd::Args).void }
def run!(args)
$stdout.sync = true
$stderr.sync = true
Expand Down
4 changes: 4 additions & 0 deletions Library/Homebrew/test_bot/bottles_fetch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
module Homebrew
module TestBot
class BottlesFetch < TestFormulae
sig { returns(T::Array[String]) }
attr_accessor :testing_formulae

sig { params(args: Homebrew::Cmd::TestBotCmd::Args).void }
def run!(args:)
info_header "Testing formulae:"
puts testing_formulae
Expand All @@ -19,6 +21,7 @@ def run!(args:)

private

sig { returns(T::Hash[Symbol, T::Set[String]]) }
def formulae_by_tag
tags = Hash.new { |hash, key| hash[key] = Set.new }

Expand All @@ -38,6 +41,7 @@ def formulae_by_tag
tags
end

sig { params(tag: Symbol, formulae: T::Set[String], args: Homebrew::Cmd::TestBotCmd::Args).void }
def fetch_bottles!(tag, formulae, args:)
test_header(:BottlesFetch, method: "fetch_bottles!(#{tag})")

Expand Down
4 changes: 3 additions & 1 deletion Library/Homebrew/test_bot/cleanup_after.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# typed: true # rubocop:todo Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

module Homebrew
module TestBot
class CleanupAfter < TestCleanup
sig { params(args: Homebrew::Cmd::TestBotCmd::Args).void }
def run!(args:)
if ENV["HOMEBREW_GITHUB_ACTIONS"].present? && ENV["GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED"].blank? &&
# don't need to do post-build cleanup unless testing test-bot itself.
Expand All @@ -27,6 +28,7 @@ def run!(args:)

private

sig { void }
def pkill_if_needed
pgrep = ["pgrep", "-f", HOMEBREW_CELLAR.to_s]

Expand Down
3 changes: 2 additions & 1 deletion Library/Homebrew/test_bot/cleanup_before.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# typed: true # rubocop:todo Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

module Homebrew
module TestBot
class CleanupBefore < TestCleanup
sig { params(args: Homebrew::Cmd::TestBotCmd::Args).void }
def run!(args:)
test_header(:CleanupBefore)

Expand Down
Loading
Loading