Skip to content

Commit

Permalink
dep: drop Ruby 3.0 (#3368)
Browse files Browse the repository at this point in the history
**What problem is this PR intended to solve?**

Drop support for Ruby 3.0. Bump min Ruby to 3.1.
  • Loading branch information
flavorjones authored Dec 11, 2024
2 parents abe8662 + 5830f3d commit 42cd756
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 221 deletions.
8 changes: 0 additions & 8 deletions .cross_rubies
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
3.0.0:aarch64-linux
3.0.0:arm-linux
3.0.0:arm64-darwin
3.0.0:x64-mingw32
3.0.0:x86-linux
3.0.0:x86-mingw32
3.0.0:x86_64-darwin
3.0.0:x86_64-linux
3.1.0:aarch64-linux
3.1.0:arm-linux
3.1.0:arm64-darwin
Expand Down
142 changes: 54 additions & 88 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,42 @@ jobs:
- run: bundle exec rake compile -- --enable-system-libraries
- run: bundle exec rake test

#
# SECTION meta - control variables
#
ruby_versions:
needs: ["basic"]
outputs:
minors: "['3.1', '3.2', '3.3']"
runs-on: ubuntu-latest
steps:
- run: echo "generating rubies ..."

rcd_image_version:
needs: ["basic"]
runs-on: ubuntu-latest
outputs:
rcd_image_version: ${{steps.rcd_image_version.outputs.rcd_image_version}}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
bundler: latest
- id: rcd_image_version
run: bundle exec ruby -e 'require "rake_compiler_dock"; puts "rcd_image_version=#{RakeCompilerDock::IMAGE_VERSION}"' >> $GITHUB_OUTPUT

#
# SECTION run the test suite across a broad matrix of rubies, configs, and systems
#
linux:
needs: ["basic"]
needs: ["basic", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: ubuntu-latest
container:
image: ghcr.io/sparklemotion/nokogiri-test:mri-${{matrix.ruby}}
Expand All @@ -117,12 +143,12 @@ jobs:
- run: bundle exec rake test:bench

valgrind:
needs: ["linux"]
needs: ["linux", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
mem: ["ruby"]
include:
- sys: "disable"
Expand Down Expand Up @@ -233,12 +259,12 @@ jobs:
- run: bundle exec rake test:valgrind

osx:
needs: ["basic"]
needs: ["basic", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -288,12 +314,12 @@ jobs:
nix-shell --packages ruby bundler libxml2 libxslt --run 'bundle exec rake test'
windows:
needs: ["basic"]
needs: ["basic", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: windows-2022
steps:
- name: configure git crlf
Expand Down Expand Up @@ -442,21 +468,6 @@ jobs:
#
# SECTION the end-to-end gem installation tests
#
rcd_image_version:
needs: ["basic"]
runs-on: ubuntu-latest
outputs:
rcd_image_version: ${{steps.rcd_image_version.outputs.rcd_image_version}}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
bundler: latest
- id: rcd_image_version
run: bundle exec ruby -e 'require "rake_compiler_dock"; puts "rcd_image_version=#{RakeCompilerDock::IMAGE_VERSION}"' >> $GITHUB_OUTPUT

generic-package:
needs: ["rcd_image_version"]
name: "generic-package"
Expand All @@ -482,12 +493,12 @@ jobs:
retention-days: 1

generic-linux-install:
needs: ["generic-package"]
needs: ["generic-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -504,12 +515,12 @@ jobs:
- run: ./scripts/test-gem-install gems --${{matrix.sys}}-system-libraries

generic-darwin-install:
needs: ["generic-package"]
needs: ["generic-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -525,35 +536,12 @@ jobs:
- run: ./scripts/test-gem-install gems --${{matrix.sys}}-system-libraries

generic-windows-install:
needs: ["generic-package"]
needs: ["generic-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.0"]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ruby/setup-ruby-pkgs@v1
with:
ruby-version: "${{matrix.ruby}}"
mingw: "libxml2 libxslt"
- uses: actions/download-artifact@v4
with:
name: generic-gem
path: gems
- run: ./scripts/test-gem-install gems --${{matrix.sys}}-system-libraries
shell: bash

generic-windows-install-ucrt:
needs: ["generic-package"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -581,7 +569,6 @@ jobs:
- "arm-linux"
- "arm64-darwin"
- "x64-mingw-ucrt"
- "x64-mingw32"
- "x86-linux"
- "x86-mingw32" # github actions does not support this runtime as of 2022-12, but let's build anyway
- "x86_64-darwin"
Expand All @@ -608,11 +595,11 @@ jobs:
retention-days: 1

cruby-x86-linux-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -630,11 +617,11 @@ jobs:
./scripts/test-gem-install gems
cruby-aarch64-linux-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -652,11 +639,11 @@ jobs:
./scripts/test-gem-install gems
cruby-arm-linux-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -674,11 +661,11 @@ jobs:
./scripts/test-gem-install gems
cruby-x86_64-linux-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -711,11 +698,11 @@ jobs:
- run: ./scripts/test-gem-install gems

cruby-x86_64-darwin-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: macos-13
steps:
- uses: actions/checkout@v4
Expand All @@ -731,11 +718,11 @@ jobs:
- run: ./scripts/test-gem-install gems

cruby-arm64-darwin-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: macos-14
steps:
- uses: actions/checkout@v4
Expand All @@ -750,33 +737,12 @@ jobs:
path: gems
- run: ./scripts/test-gem-install gems

cruby-x64-mingw32-install:
needs: ["cruby-package"]
strategy:
fail-fast: false
matrix:
ruby: ["3.0"]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ruby/setup-ruby@v1
with:
ruby-version: "${{matrix.ruby}}"
- uses: actions/download-artifact@v4
with:
name: cruby-x64-mingw32-gem
path: gems
- run: ./scripts/test-gem-install gems
shell: bash

cruby-x64-mingw-ucrt-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-ci-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
tag: ["alpine", "mri-3.0", "mri-3.1", "mri-3.2", "mri-3.3", "ubuntu", "upstream-libxml"]
tag: ["alpine", "mri-3.1", "mri-3.2", "mri-3.3", "ubuntu", "upstream-libxml"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inherit_from:

AllCops:
SuggestExtensions: false
TargetRubyVersion: "3.0"
TargetRubyVersion: "3.1"

Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: consistent_comma
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ You can help sponsor the maintainers of this software through one of these organ

Requirements:

- Ruby >= 3.0
- Ruby >= 3.1
- JRuby >= 9.4.0.0

If you are compiling the native extension against a system version of libxml2:
Expand Down
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ test_script:

environment:
matrix:
- ruby_version: 32
- ruby_version: 33
INSTALL_PACKAGES: "mingw-w64-i686-libyaml"
- ruby_version: 32
- ruby_version: 33
INSTALL_PACKAGES: "mingw-w64-i686-libxslt mingw-w64-i686-libyaml"
EXTCONF_PARAMS: "--use-system-libraries"

- ruby_version: 30
- ruby_version: 31
INSTALL_PACKAGES: "mingw-w64-i686-libyaml"
- ruby_version: 30
- ruby_version: 31
INSTALL_PACKAGES: "mingw-w64-i686-libxslt mingw-w64-i686-libyaml"
EXTCONF_PARAMS: "--use-system-libraries"
11 changes: 2 additions & 9 deletions ext/nokogiri/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1117,14 +1117,7 @@ def compile
end
env["RANLIB"] = "#{host}-ranlib"
if windows?
# NOTE: that in any particular windows gem package, we only ever compile against either
# msvcrt (ruby <= 3.0) or ucrt (ruby > 3.0), so even though this gets evaluated only once
# per gem (and not per-version-of-ruby), it's OK.
env["CFLAGS"] = if RbConfig::CONFIG["RUBY_SO_NAME"].include?("msvcrt")
concat_flags(env["CFLAGS"], "-D_RUBY_MSVCRT")
else
concat_flags(env["CFLAGS"], "-D_RUBY_UCRT")
end
concat_flags(env["CFLAGS"], "-D_RUBY_UCRT")
end
end

Expand All @@ -1141,7 +1134,7 @@ def compile
have_func("xmlCtxtSetOptions") # introduced in libxml2 2.13.0
have_func("xmlCtxtGetOptions") # introduced in libxml2 2.14.0
have_func("xmlSwitchEncodingName") # introduced in libxml2 2.13.0
have_func("rb_category_warning") # introduced in Ruby 3.0
have_func("rb_category_warning") # introduced in Ruby 3.0 but had trouble resolving this symbol in truffleruby

other_library_versions_string = OTHER_LIBRARY_VERSIONS.map { |k, v| [k, v].join(":") }.join(",")
append_cppflags(%[-DNOKOGIRI_OTHER_LIBRARY_VERSIONS="\\"#{other_library_versions_string}\\""])
Expand Down
2 changes: 1 addition & 1 deletion nokogiri.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Gem::Specification.new do |spec|

spec.license = "MIT"

spec.required_ruby_version = ">= 3.0.0"
spec.required_ruby_version = ">= 3.1.0"

spec.homepage = "https://nokogiri.org"
spec.metadata = {
Expand Down
Loading

0 comments on commit 42cd756

Please sign in to comment.