From 842303ebd184d58c9f6d1c0df9bf77e3c9a0810e Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Wed, 9 Jan 2019 21:40:30 +0100 Subject: [PATCH 1/7] do not generate manpages on Windows --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From b31d03de5544e71a13eab6138281aace3e88b803 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Wed, 9 Jan 2019 21:43:10 +0100 Subject: [PATCH 2/7] Rudimentary Azure Pipelines CI configuration for Windows --- azure-pipelines.yml | 6 ++++++ azure-pipelines/steps.yml | 25 +++++++++++++++++++++++++ bundler.gemspec | 1 + 3 files changed, 32 insertions(+) create mode 100644 azure-pipelines.yml create mode 100644 azure-pipelines/steps.yml 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/steps.yml b/azure-pipelines/steps.yml new file mode 100644 index 00000000000..2f8dcf65359 --- /dev/null +++ b/azure-pipelines/steps.yml @@ -0,0 +1,25 @@ +steps: + +- task: UseRubyVersion@0 + inputs: + versionSpec: '= 2.4' + +- script: | + ruby -v + ridk version + displayName: 'ruby -v + ridk version' + +- script: | + ruby bin/rake spec:deps + displayName: 'ruby bin/rake spec:deps' + +- script: | + ruby bin/rspec --format progress -r rspec_junit_formatter --format RspecJunitFormatter -o rspec/bundler-junit-results.xml + 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/bundler.gemspec b/bundler.gemspec index 12b1b59b985..4cc67f51a1a 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -46,6 +46,7 @@ Gem::Specification.new do |s| s.add_development_dependency "rdiscount", "~> 2.2" s.add_development_dependency "ronn", "~> 0.7.3" s.add_development_dependency "rspec", "~> 3.6" + s.add_development_dependency "rspec_junit_formatter", "~> 0.2.3" base_dir = File.dirname(__FILE__).gsub(%r{([^A-Za-z0-9_\-.,:\/@\n])}, "\\\\\\1") s.files = IO.popen("git -C #{base_dir} ls-files -z", &:read).split("\x0").select {|f| f.match(%r{^(lib|exe)/}) } From 20c5091bc0e4e94ae3e0f57e188056b6c26fdec8 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Fri, 11 Jan 2019 20:34:50 +0100 Subject: [PATCH 3/7] avoid readline crash (workaround for #6902) --- azure-pipelines/steps.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/azure-pipelines/steps.yml b/azure-pipelines/steps.yml index 2f8dcf65359..eae79b0a6bd 100644 --- a/azure-pipelines/steps.yml +++ b/azure-pipelines/steps.yml @@ -9,6 +9,12 @@ steps: ridk version displayName: 'ruby -v + ridk version' +- script: | + mkdir tmp + cd tmp + mkdir home + displayName: 'work around readline crash' + - script: | ruby bin/rake spec:deps displayName: 'ruby bin/rake spec:deps' From b51b2be11f4d53768080471b53d48d5337f617ba Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Mon, 14 Jan 2019 21:38:15 +0100 Subject: [PATCH 4/7] patch readline in site_ruby (workaround for #6907) --- azure-pipelines/rbreadline.diff | 41 +++++++++++++++++++++++++++++++++ azure-pipelines/steps.yml | 6 ++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 azure-pipelines/rbreadline.diff 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 index eae79b0a6bd..8c8b0c172ff 100644 --- a/azure-pipelines/steps.yml +++ b/azure-pipelines/steps.yml @@ -13,7 +13,11 @@ steps: mkdir tmp cd tmp mkdir home - displayName: 'work around readline crash' + 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 From c0027070058144bed46f7760a65118be20c76e89 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Sun, 10 Feb 2019 21:37:16 +0100 Subject: [PATCH 5/7] remove added dependency --- bundler.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/bundler.gemspec b/bundler.gemspec index 9deaf34f3a5..5d494bcb0ae 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -47,7 +47,6 @@ Gem::Specification.new do |s| s.add_development_dependency "ronn", "~> 0.7.3" s.add_development_dependency "rspec", "~> 3.6" s.add_development_dependency "rubocop", "= 0.50.0" - s.add_development_dependency "rspec_junit_formatter", "~> 0.2.3" base_dir = File.dirname(__FILE__).gsub(%r{([^A-Za-z0-9_\-.,:\/@\n])}, "\\\\\\1") s.files = IO.popen("git -C #{base_dir} ls-files -z", &:read).split("\x0").select {|f| f.match(%r{^(lib|exe)/}) } From 4a1f0740a4945ef3691ad946ab573434abda76f0 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Mon, 11 Feb 2019 00:14:49 +0100 Subject: [PATCH 6/7] always exit `ruby bin/rspec` with code 0 --- azure-pipelines/steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/steps.yml b/azure-pipelines/steps.yml index 8c8b0c172ff..68346ac27d5 100644 --- a/azure-pipelines/steps.yml +++ b/azure-pipelines/steps.yml @@ -24,7 +24,7 @@ steps: displayName: 'ruby bin/rake spec:deps' - script: | - ruby bin/rspec --format progress -r rspec_junit_formatter --format RspecJunitFormatter -o rspec/bundler-junit-results.xml + ruby bin/rspec --format progress -r rspec_junit_formatter --format RspecJunitFormatter -o rspec/bundler-junit-results.xml || exit 0 displayName: 'ruby bin/rspec' - task: PublishTestResults@2 From 8ace8a56cdc75bba5fcfc65fc65545de4e99e824 Mon Sep 17 00:00:00 2001 From: Jan Piotrowski Date: Mon, 11 Feb 2019 00:30:04 +0100 Subject: [PATCH 7/7] manually install rspec_junit_formatter --- azure-pipelines/steps.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/steps.yml b/azure-pipelines/steps.yml index 68346ac27d5..548847c9103 100644 --- a/azure-pipelines/steps.yml +++ b/azure-pipelines/steps.yml @@ -22,9 +22,13 @@ steps: - 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 bin/rspec --format progress -r rspec_junit_formatter --format RspecJunitFormatter -o rspec/bundler-junit-results.xml || exit 0 + 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