From af1397a33f0cad871a01d3d6a3ad2eac39088ad9 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Mon, 1 Apr 2024 18:19:42 +0200 Subject: [PATCH] CI: Add a CI run on mswin build tools libtest build is forced to use GNU tools instead of MSVC, since the GNUmakefile isn't compatible. --- .github/workflows/ci.yml | 9 ++++++++- spec/ffi/embed-test/embed-test.rb | 6 +++++- spec/ffi/long_double_spec.rb | 6 +++++- spec/ffi/spec_helper.rb | 4 +++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 83a5ce011..5b90d9f81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,6 +58,9 @@ jobs: exclude: - os: windows-latest ruby: truffleruby-head + include: + - os: windows-latest + ruby: ruby-mswin runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -72,10 +75,14 @@ jobs: - run: bundle exec rake libffi - run: bundle exec rake compile + - if: matrix.os == 'windows-latest' + # force the use of GNU make.exe on MSWIN platform for building libtest.dll + run: bundle exec rake test MAKE=make + - if: matrix.os != 'windows-latest' run: bundle exec rake test FFI_TEST_GC=true - - run: bundle exec rake bench:all + - run: bundle exec rake bench:all MAKE=make if: ${{ matrix.ruby != 'truffleruby-head' && matrix.ruby != 'jruby-head' }} env: ITER: 10 diff --git a/spec/ffi/embed-test/embed-test.rb b/spec/ffi/embed-test/embed-test.rb index 4011e52a4..c1ceb9378 100755 --- a/spec/ffi/embed-test/embed-test.rb +++ b/spec/ffi/embed-test/embed-test.rb @@ -18,7 +18,11 @@ Dir.chdir(File.dirname(EXT)) nul = File.open(File::NULL) -make = system('type gmake', { :out => nul, :err => nul }) && 'gmake' || 'make' +make = if RUBY_PLATFORM =~ /mswin/i + 'nmake' +else + system('type gmake', { :out => nul, :err => nul }) && 'gmake' || 'make' +end # create Makefile system(RbConfig.ruby, "extconf.rb") diff --git a/spec/ffi/long_double_spec.rb b/spec/ffi/long_double_spec.rb index 5311b94fc..fbe3f6bdd 100644 --- a/spec/ffi/long_double_spec.rb +++ b/spec/ffi/long_double_spec.rb @@ -47,4 +47,8 @@ module LibTest expect(v).to be_within(0.01).of(0.1) end end -end unless ['truffleruby', 'jruby'].include?(RUBY_ENGINE) || /x64-mingw32/ =~ RUBY_PLATFORM + + # * Truffleruby and JRuby don't support long double + # * x64-mingw32 with MSVCRT crashes + # * The libtest.dll on mswin is built by gcc currently (since the GNUmakefile is not compatible to MSVC), which crashes at long double +end unless ['truffleruby', 'jruby'].include?(RUBY_ENGINE) || /x64-mingw32|mswin/ =~ RUBY_PLATFORM diff --git a/spec/ffi/spec_helper.rb b/spec/ffi/spec_helper.rb index faa396310..ae987ab84 100644 --- a/spec/ffi/spec_helper.rb +++ b/spec/ffi/spec_helper.rb @@ -9,7 +9,9 @@ RSpec.configure do |c| c.filter_run_excluding gc_dependent: true unless ENV['FFI_TEST_GC'] == 'true' - c.filter_run_excluding( :ractor ) unless defined?(Ractor) && RUBY_VERSION >= "3.1" && (RUBY_VERSION !~ /^3.3./ || RUBY_PLATFORM !~ /mingw/) + + # Ractor is only usable on ruby-3.1+, but it hangs on Windows on ruby-3.3 and 3.4 + c.filter_run_excluding( :ractor ) unless defined?(Ractor) && RUBY_VERSION >= "3.1" && (RUBY_VERSION !~ /^3.[34]./ || RUBY_PLATFORM !~ /mingw|mswin/) end module TestLibrary