diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000000..9d1535f8cd4 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,6 @@ +jobs: +- job: Windows + pool: + vmImage: 'vs2017-win2016' + steps: + - template: azure-pipelines/steps.yml diff --git a/azure-pipelines/rbreadline.diff b/azure-pipelines/rbreadline.diff new file mode 100644 index 00000000000..c1395776103 --- /dev/null +++ b/azure-pipelines/rbreadline.diff @@ -0,0 +1,41 @@ +diff --git a/rbreadline.rb b/rbreadline.rb +index c710961..e35408c 100644 +--- a/rbreadline.rb ++++ b/rbreadline.rb +@@ -16,6 +16,7 @@ end + + module RbReadline + require 'etc' ++ require 'io/console' + + RL_LIBRARY_VERSION = "5.2" + RL_READLINE_VERSION = 0x0502 +@@ -1092,6 +1093,9 @@ module RbReadline + @current_readline_init_include_level = 0 + @current_readline_init_lineno = 0 + ++ # Used in windows ++ @is_pipe = false ++ + ENV["HOME"] ||= "#{ENV["HOMEDRIVE"]}#{ENV["HOMEPATH"]}" + if !File.directory? ENV["HOME"] + raise RuntimeError.new("HOME environment variable (or HOMEDRIVE and HOMEPATH) must be set and point to a directory") +@@ -4490,6 +4494,10 @@ module RbReadline + end + + def rl_getc(stream) ++ # below added as test for whether we're connected to a pipe or a keyboard. ++ # Pipe connection is probably running under a test suite. ++ return (stream.getc || EOF rescue EOF) if @is_pipe ++ + while (@kbhit.Call == 0) + # If there is no input, yield the processor for other threads + sleep(@_keyboard_input_timeout) +@@ -4740,6 +4748,7 @@ module RbReadline + def readline_internal_charloop() + lastc = -1 + eof_found = false ++ @is_pipe = (!@rl_outstream.winsize rescue true) + + while (!@rl_done) + lk = @_rl_last_command_was_kill diff --git a/azure-pipelines/steps.yml b/azure-pipelines/steps.yml new file mode 100644 index 00000000000..548847c9103 --- /dev/null +++ b/azure-pipelines/steps.yml @@ -0,0 +1,39 @@ +steps: + +- task: UseRubyVersion@0 + inputs: + versionSpec: '= 2.4' + +- script: | + ruby -v + ridk version + displayName: 'ruby -v + ridk version' + +- script: | + mkdir tmp + cd tmp + mkdir home + displayName: 'work around readline crash (for https://github.com/bundler/bundler/issues/6902)' + +- script: | + git apply --ignore-space-change --ignore-whitespace azure-pipelines\rbreadline.diff --directory=C:/hostedtoolcache/windows/Ruby/2.4.3/x64/lib/ruby/site_ruby --unsafe-paths + displayName: 'patch local readline implementation (for https://github.com/bundler/bundler/issues/6907)' + +- script: | + ruby bin/rake spec:deps + displayName: 'ruby bin/rake spec:deps' + +- script: | + gem install --no-document --conservative rspec_junit_formatter + displayName: 'gem install rspec_junit_formatter' + +- script: | + ruby -r rspec_junit_formatter bin/rspec --format progress --format RspecJunitFormatter -o rspec/bundler-junit-results.xml || exit 0 + displayName: 'ruby bin/rspec' + +- task: PublishTestResults@2 + inputs: + testRunner: JUnit + testResultsFiles: rspec/bundler-junit-results.xml + displayName: Publish test results + condition: succeededOrFailed() diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9355bfb33f4..7cc363087cf 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -41,7 +41,7 @@ module Gem $debug = false -Spec::Manpages.setup +Spec::Manpages.setup unless Gem.win_platform? Spec::Rubygems.setup FileUtils.rm_rf(Spec::Path.gem_repo1) ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -r#{Spec::Path.spec_dir}/support/hax.rb"