diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8d641b2..92ffaaff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -478,25 +478,37 @@ jobs: working-directory: ./bindings/python test-ruby: + name: Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-22.04, macos-13, windows-2022] ruby-version: ["3.2", "3.3"] - name: Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - name: Set up Ruby & Rust - uses: oxidize-rb/actions/setup-ruby-and-rust@main + + - name: Install Ruby + uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - cargo-cache: true - cache-version: v1 working-directory: ./bindings/ruby + - name: Install MSYS2 UCRT64 DevKit + if: runner.os == 'Windows' + shell: powershell + run: ridk install 3 + + - uses: dtolnay/rust-toolchain@stable + + - uses: Swatinem/rust-cache@v2 + with: + cache-all-crates: "true" + key: ${{ matrix.os }} + workspaces: bindings/ruby + - uses: actions/setup-python@v5 with: python-version: 3.11 @@ -506,11 +518,13 @@ jobs: - name: Start background server run: | python -m pip install -r ./css-inline/tests/requirements-test.txt - # Starts the server in background python ./css-inline/tests/server.py & shell: bash - run: bundle exec rake test + env: + BINDGEN_EXTRA_CLANG_ARGS_x64-mingw-ucrt: "-IC:/msys64/ucrt64/include" + BINDGEN_EXTRA_CLANG_ARGS_x86_64-pc-windows-msvc: "-IC:/msys64/ucrt64/include" working-directory: ./bindings/ruby test-wasm: diff --git a/bindings/ruby/Gemfile.lock b/bindings/ruby/Gemfile.lock index e4653b3e..02620b00 100644 --- a/bindings/ruby/Gemfile.lock +++ b/bindings/ruby/Gemfile.lock @@ -2,6 +2,7 @@ PATH remote: . specs: css_inline (0.14.3) + rb_sys (~> 0.9.108) GEM remote: https://rubygems.org/ @@ -26,7 +27,9 @@ GEM rake (13.0.6) rake-compiler (1.2.3) rake - rb_sys (0.9.79) + rake-compiler-dock (1.9.1) + rb_sys (0.9.115) + rake-compiler-dock (= 1.9.1) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -50,7 +53,6 @@ DEPENDENCIES nokogiri (~> 1.15) premailer (~> 1.21) rake-compiler (~> 1.2.0) - rb_sys (~> 0.9) rspec BUNDLED WITH diff --git a/bindings/ruby/Rakefile b/bindings/ruby/Rakefile index 8707b6e6..9a20bb55 100644 --- a/bindings/ruby/Rakefile +++ b/bindings/ruby/Rakefile @@ -2,6 +2,8 @@ require "rake/extensiontask" require 'rspec/core/rake_task' +require "rb_sys" +require "rb_sys/toolchain_info" task default: :spec @@ -15,14 +17,7 @@ spec.files -= Dir["ext/**/*"] Rake::ExtensionTask.new("css_inline", spec) do |c| c.lib_dir = "lib/css_inline" c.cross_compile = true - c.cross_platform = [ - "aarch64-linux", - "arm64-darwin", - "x64-mingw-ucrt", - "x64-mingw32", - "x86_64-darwin", - "x86_64-linux", - "x86_64-linux-musl"] + c.cross_platform = RbSys::ToolchainInfo.supported_ruby_platforms end task :dev do diff --git a/bindings/ruby/css_inline.gemspec b/bindings/ruby/css_inline.gemspec index 2c6215c4..fba69adb 100644 --- a/bindings/ruby/css_inline.gemspec +++ b/bindings/ruby/css_inline.gemspec @@ -25,8 +25,9 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 3.2.0" spec.required_rubygems_version = ">= 3.3.26" + spec.add_dependency 'rb_sys', '~> 0.9.108' + spec.add_development_dependency "rake-compiler", "~> 1.2.0" - spec.add_development_dependency "rb_sys", "~> 0.9" spec.add_development_dependency "benchmark-ips", "~> 2.10" spec.add_development_dependency "premailer", "~> 1.21" spec.add_development_dependency "nokogiri", "~> 1.15"