brew-test-bot: general cleanup.
This commit is contained in:
parent
2901fd393e
commit
e4045fa7e5
@ -70,21 +70,29 @@ class Step
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.run test, command, output_on_success = false
|
def self.run test, command, puts_output = false
|
||||||
step = new test, command
|
step = new test, command
|
||||||
step.puts_command
|
step.puts_command
|
||||||
|
|
||||||
command = "#{step.command} &>#{step.log_file_path}"
|
command = "#{step.command}"
|
||||||
if command.start_with? 'git '
|
unless puts_output and not ARGV.include? "--log"
|
||||||
Dir.chdir step.repository { `#{command}` }
|
command += " &>#{step.log_file_path}"
|
||||||
else
|
|
||||||
`#{command}`
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
output = nil
|
||||||
|
if command.start_with? 'git '
|
||||||
|
Dir.chdir step.repository do
|
||||||
|
output = `#{command}`
|
||||||
|
end
|
||||||
|
else
|
||||||
|
output = `#{command}`
|
||||||
|
end
|
||||||
|
output = IO.read(step.log_file_path) if ARGV.include? "--log"
|
||||||
|
|
||||||
step.status = $?.success? ? :passed : :failed
|
step.status = $?.success? ? :passed : :failed
|
||||||
step.puts_result
|
step.puts_result
|
||||||
puts IO.read(step.log_file_path) if output_on_success
|
|
||||||
step.write_html
|
step.write_html
|
||||||
|
puts output if puts_output and output and not output.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -215,8 +223,8 @@ class Test
|
|||||||
test "brew audit #{formula}"
|
test "brew audit #{formula}"
|
||||||
test "brew install --verbose --build-bottle #{formula}"
|
test "brew install --verbose --build-bottle #{formula}"
|
||||||
return unless steps.last.status == :passed
|
return unless steps.last.status == :passed
|
||||||
test "brew test #{formula}" if defined? Formula.factory(formula).test
|
|
||||||
test "brew bottle #{formula}", true
|
test "brew bottle #{formula}", true
|
||||||
|
test "brew test #{formula}" if defined? Formula.factory(formula).test
|
||||||
test "brew uninstall #{formula}"
|
test "brew uninstall #{formula}"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -230,7 +238,9 @@ class Test
|
|||||||
if ARGV.include? "--cleanup"
|
if ARGV.include? "--cleanup"
|
||||||
test "git fetch origin"
|
test "git fetch origin"
|
||||||
test "git reset --hard origin/master"
|
test "git reset --hard origin/master"
|
||||||
|
test "brew cleanup"
|
||||||
test "git clean --force -dx"
|
test "git clean --force -dx"
|
||||||
|
test "git gc"
|
||||||
else
|
else
|
||||||
unless ARGV.include? "--skip-cleanup"
|
unless ARGV.include? "--skip-cleanup"
|
||||||
git('diff --exit-code HEAD 2>/dev/null')
|
git('diff --exit-code HEAD 2>/dev/null')
|
||||||
@ -240,8 +250,8 @@ class Test
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test cmd, output_on_success = false
|
def test cmd, puts_output = false
|
||||||
Step.run self, cmd, output_on_success
|
Step.run self, cmd, puts_output
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_results
|
def check_results
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user