Skip to content

Commit

Permalink
ci: update test-gem-installation to work on windows
Browse files Browse the repository at this point in the history
Also modify test-nokogumbo-compatibility to skip 2.0.4 on Windows
because it's missing the LDFLAGS fix from #2167, #2202, and
nokogumbo#163.
  • Loading branch information
flavorjones committed Nov 17, 2022
1 parent 15110d6 commit bec9da5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/test-gem-installation
Expand Up @@ -115,7 +115,7 @@ describe gemspec.full_name do
it "has ldflags pointing to the shared object file" do
ldflags = Nokogiri::VERSION_INFO["nokogiri"]["ldflags"]
if ::RUBY_PLATFORM.match?(/mingw|mswin/)
if gemspec.platform.cpu
if gemspec.platform.is_a?(Gem::Platform) && gemspec.platform.cpu
assert_includes(ldflags, "-L#{File.join(nokogiri_lib_dir, ruby_maj_min)}")
else
assert_includes(ldflags, "-L#{nokogiri_lib_dir}")
Expand Down
14 changes: 10 additions & 4 deletions scripts/test-nokogumbo-compatibility
Expand Up @@ -20,6 +20,16 @@ if Gem::Requirement.new(">= 3.2.0").satisfied_by?(Gem::Version.new(RUBY_VERSION)
exit 0
end

nokogumbo_version = if /\d+\.\d+\.\d+/.match?(ARGV[0])
ARGV[0]
end

NOKOGUMBO_WINDOWS_CONSTRAINT = ">= 2.0.5"
if Gem.win_platform? && !Gem::Requirement.new(NOKOGUMBO_WINDOWS_CONSTRAINT).satisfied_by?(Gem::Version.new(nokogumbo_version))
puts "Skip: Nokogumbo must be #{NOKOGUMBO_WINDOWS_CONSTRAINT} on Windows"
exit 0
end

# this line needs to come before the bundler bit, to assert that we're running against an
# already-installed version (and not some other version that bundler/inline might install if it came
# first)
Expand All @@ -28,10 +38,6 @@ raise "could not find installed gem" unless gemspec

require "bundler/inline"

nokogumbo_version = if /\d+\.\d+\.\d+/.match?(ARGV[0])
ARGV[0]
end

gemfile(true) do
source "https://rubygems.org"
gem "minitest"
Expand Down

0 comments on commit bec9da5

Please sign in to comment.