Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TAP output for CI #790

Merged
merged 2 commits into from
Jul 24, 2018
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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Master

## v190 (7/24/2018)

* Support TAP output for Heroku CI (https://github.com/heroku/heroku-buildpack-ruby/pull/790).

## v189 (7/10/2018)

* Colorize build failures and warnings. (https://github.com/heroku/heroku-buildpack-ruby/pull/788)
Expand Down
7 changes: 6 additions & 1 deletion bin/support/ruby_test
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ def execute_test(command)
end

def execute_command(command)
pipe(command, :user_env => true)
# Normally the `pipe` command will indent output so that it
# matches the build output, however in a test TAP depends on
# having no whitespace before output. To avoid adding whitespace
# for the original Kernel.puts to be used by passing in the
# Kernel object.
pipe(command, :user_env => true, :output_object => Kernel)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to indent by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default we want the indent or this code change would be much larger. We're depending on the indent for the output to look correct when we do things like bundle install on a normal build.

end

# $ bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR
Expand Down
4 changes: 3 additions & 1 deletion lib/language_pack/shell_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,13 @@ def wait_with_timeout
def pipe(command, options = {})
output = options[:buffer] || ""
silent = options[:silent]
# self.puts uses the method defined in this file
output_object = options[:output_object] || self
IO.popen(command_options_to_string(command, options)) do |io|
until io.eof?
buffer = io.gets
output << buffer
puts buffer unless silent
output_object.puts(buffer) unless silent
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/language_pack/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# This file is automatically generated by rake
module LanguagePack
class LanguagePack::Base
BUILDPACK_VERSION = "v189"
BUILDPACK_VERSION = "v190"
end
end
4 changes: 3 additions & 1 deletion spec/hatchet/ci_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

it "Works with a vanilla ruby app" do
Hatchet::Runner.new("ruby_no_rails_test").run_ci do |test_run|
# Expect success test run
# Test no whitespace in front of output
expect(test_run.output).to_not match(/^ +Finished in/)
expect(test_run.output).to match(/^Finished in/)
end
end

Expand Down