Skip to content

Commit 88a120f

Browse files
authored
dep: Add native Ruby 4 support, drop Ruby 3.1 support (v1.19.x) (#3592)
**What problem is this PR intended to solve?** #3590, bumping some other dev dependencies along the way Note that this will be the first release of v1.19.x which is an extension of v1.18.x. **Have you included adequate test coverage?** Existing coverage is adequate. **Does this change affect the behavior of either the C or the Java implementations?** No functional changes.
2 parents 6803740 + f8c8f74 commit 88a120f

30 files changed

+159
-230
lines changed

.cross_rubies

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
3.1.0:aarch64-linux-gnu
2-
3.1.0:aarch64-linux-musl
3-
3.1.0:arm-linux-gnu
4-
3.1.0:arm-linux-musl
5-
3.1.0:arm64-darwin
6-
3.1.0:x64-mingw-ucrt
7-
3.1.0:x86_64-darwin
8-
3.1.0:x86_64-linux-gnu
9-
3.1.0:x86_64-linux-musl
10-
3.2.0:aarch64-linux-gnu
11-
3.2.0:aarch64-linux-musl
12-
3.2.0:arm-linux-gnu
13-
3.2.0:arm-linux-musl
14-
3.2.0:arm64-darwin
15-
3.2.0:x64-mingw-ucrt
16-
3.2.0:x86_64-darwin
17-
3.2.0:x86_64-linux-gnu
18-
3.2.0:x86_64-linux-musl
19-
3.3.5:aarch64-linux-gnu
20-
3.3.5:aarch64-linux-musl
21-
3.3.5:arm-linux-gnu
22-
3.3.5:arm-linux-musl
23-
3.3.5:arm64-darwin
24-
3.3.5:x64-mingw-ucrt
25-
3.3.5:x86_64-darwin
26-
3.3.5:x86_64-linux-gnu
27-
3.3.5:x86_64-linux-musl
28-
3.4.0:aarch64-linux-gnu
29-
3.4.0:aarch64-linux-musl
30-
3.4.0:arm-linux-gnu
31-
3.4.0:arm-linux-musl
32-
3.4.0:arm64-darwin
33-
3.4.0:x64-mingw-ucrt
34-
3.4.0:x86_64-darwin
35-
3.4.0:x86_64-linux-gnu
36-
3.4.0:x86_64-linux-musl
1+
3.2.9:aarch64-linux-gnu
2+
3.2.9:aarch64-linux-musl
3+
3.2.9:arm-linux-gnu
4+
3.2.9:arm-linux-musl
5+
3.2.9:arm64-darwin
6+
3.2.9:x64-mingw-ucrt
7+
3.2.9:x86_64-darwin
8+
3.2.9:x86_64-linux-gnu
9+
3.2.9:x86_64-linux-musl
10+
3.3.10:aarch64-linux-gnu
11+
3.3.10:aarch64-linux-musl
12+
3.3.10:arm-linux-gnu
13+
3.3.10:arm-linux-musl
14+
3.3.10:arm64-darwin
15+
3.3.10:x64-mingw-ucrt
16+
3.3.10:x86_64-darwin
17+
3.3.10:x86_64-linux-gnu
18+
3.3.10:x86_64-linux-musl
19+
3.4.8:aarch64-linux-gnu
20+
3.4.8:aarch64-linux-musl
21+
3.4.8:arm-linux-gnu
22+
3.4.8:arm-linux-musl
23+
3.4.8:arm64-darwin
24+
3.4.8:x64-mingw-ucrt
25+
3.4.8:x86_64-darwin
26+
3.4.8:x86_64-linux-gnu
27+
3.4.8:x86_64-linux-musl
28+
4.0.0:aarch64-linux-gnu
29+
4.0.0:aarch64-linux-musl
30+
4.0.0:arm-linux-gnu
31+
4.0.0:arm-linux-musl
32+
4.0.0:arm64-darwin
33+
4.0.0:x64-mingw-ucrt
34+
4.0.0:x86_64-darwin
35+
4.0.0:x86_64-linux-gnu
36+
4.0.0:x86_64-linux-musl

.github/workflows/ci.yml

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
- uses: actions/checkout@v4
7171
with:
7272
submodules: true
73-
- uses: ruby/setup-ruby@v1
73+
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
7474
with:
7575
ruby-version: "3.3"
7676
bundler-cache: true
@@ -99,9 +99,9 @@ jobs:
9999
needs: ["basic"]
100100
outputs:
101101
# these are usually the same, but are different once we get to ruby release candidates
102-
setup_ruby: "['3.1', '3.2', '3.3', '3.4']"
103-
setup_ruby_win: "['3.1', '3.2', '3.3', '3.4']"
104-
image_tag: "['3.1', '3.2', '3.3', '3.4']"
102+
setup_ruby: "['3.2', '3.3', '3.4', '4.0']"
103+
setup_ruby_win: "['3.2', '3.3', '3.4', '4.0']"
104+
image_tag: "['3.2', '3.3', '3.4', '4.0']"
105105
runs-on: ubuntu-latest
106106
steps:
107107
- run: echo "generating rubies ..."
@@ -113,7 +113,7 @@ jobs:
113113
rcd_image_version: ${{steps.rcd_image_version.outputs.rcd_image_version}}
114114
steps:
115115
- uses: actions/checkout@v4
116-
- uses: ruby/setup-ruby@v1
116+
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
117117
with:
118118
ruby-version: "3.4"
119119
bundler-cache: true
@@ -271,14 +271,13 @@ jobs:
271271
matrix:
272272
sys: ["enable", "disable"]
273273
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }}
274-
include:
275-
- { ruby: "3.1", os: macos-14 }
276-
runs-on: ${{ matrix.os || 'macos-latest' }}
274+
os: [ macos-15-intel, macos-15 ]
275+
runs-on: ${{ matrix.os }}
277276
steps:
278277
- uses: actions/checkout@v4
279278
with:
280279
submodules: true
281-
- uses: ruby/setup-ruby@v1
280+
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
282281
with:
283282
ruby-version: ${{matrix.ruby}}
284283
bundler-cache: true
@@ -328,8 +327,6 @@ jobs:
328327
matrix:
329328
sys: ["enable", "disable"]
330329
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby_win) }}
331-
exclude:
332-
- ruby: "3.1" # because Ruby 3.1 devkit is built with a version of GCC too old for modern msys2 2025-08
333330
runs-on: windows-2022
334331
steps:
335332
- name: configure git crlf
@@ -341,6 +338,7 @@ jobs:
341338
submodules: true
342339
- uses: ruby/setup-ruby-pkgs@v1
343340
with:
341+
setup-ruby-ref: ruby/setup-ruby/d3e3bd032ad2222a8ac878bbccf2aba78864e134
344342
ruby-version: "${{matrix.ruby}}"
345343
mingw: "libxml2 libxslt"
346344
bundler-cache: true
@@ -358,13 +356,13 @@ jobs:
358356
strategy:
359357
fail-fast: false
360358
matrix:
361-
ruby: ["jruby-9.4"]
359+
ruby: ["jruby-10.0"]
362360
runs-on: ubuntu-latest
363361
steps:
364362
- uses: actions/checkout@v4
365363
with:
366364
submodules: true
367-
- uses: ruby/setup-ruby@v1
365+
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
368366
with:
369367
ruby-version: ${{matrix.ruby}}
370368
bundler-cache: true
@@ -392,6 +390,7 @@ jobs:
392390
submodules: true
393391
- uses: ruby/setup-ruby-pkgs@v1
394392
with:
393+
setup-ruby-ref: ruby/setup-ruby/d3e3bd032ad2222a8ac878bbccf2aba78864e134
395394
ruby-version: truffleruby
396395
bundler-cache: true
397396
bundler: 2.5.10
@@ -515,6 +514,7 @@ jobs:
515514
submodules: true
516515
- uses: ruby/setup-ruby-pkgs@v1
517516
with:
517+
setup-ruby-ref: ruby/setup-ruby/d3e3bd032ad2222a8ac878bbccf2aba78864e134
518518
ruby-version: "${{matrix.ruby}}"
519519
apt-get: "libxml2-dev libxslt1-dev pkg-config"
520520
- uses: actions/download-artifact@v4
@@ -530,14 +530,13 @@ jobs:
530530
matrix:
531531
sys: ["enable", "disable"]
532532
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }}
533-
include:
534-
- { ruby: "3.1", os: macos-14 }
535-
runs-on: ${{ matrix.os || 'macos-latest' }}
533+
os: [ macos-15-intel, macos-15 ]
534+
runs-on: ${{ matrix.os }}
536535
steps:
537536
- uses: actions/checkout@v4
538537
with:
539538
submodules: true
540-
- uses: ruby/setup-ruby@v1
539+
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
541540
with:
542541
ruby-version: "${{matrix.ruby}}"
543542
- uses: actions/download-artifact@v4
@@ -553,15 +552,14 @@ jobs:
553552
matrix:
554553
sys: ["enable", "disable"]
555554
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby_win) }}
556-
exclude:
557-
- ruby: "3.1" # because Ruby 3.1 devkit is built with a version of GCC too old for modern msys2 2025-08
558555
runs-on: windows-2022
559556
steps:
560557
- uses: actions/checkout@v4
561558
with:
562559
submodules: true
563560
- uses: ruby/setup-ruby-pkgs@v1
564561
with:
562+
setup-ruby-ref: ruby/setup-ruby/d3e3bd032ad2222a8ac878bbccf2aba78864e134
565563
ruby-version: "${{matrix.ruby}}"
566564
mingw: "libxml2 libxslt"
567565
- uses: actions/download-artifact@v4
@@ -617,7 +615,7 @@ jobs:
617615
- uses: actions/checkout@v4
618616
with:
619617
submodules: true
620-
- uses: ruby/setup-ruby@v1
618+
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
621619
with:
622620
ruby-version: "${{matrix.ruby}}"
623621
- uses: actions/download-artifact@v4
@@ -642,15 +640,15 @@ jobs:
642640
ruby: ${{ fromJSON(needs.ruby_versions.outputs.image_tag) }}
643641
include:
644642
# declare docker image for each platform
645-
- { platform: aarch64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add bash build-base &&" }
646-
- { platform: arm-linux-musl, docker_tag: "-alpine", bootstrap: "apk add bash build-base &&" }
647-
- { platform: x86_64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add bash build-base &&" }
643+
- { runner: ubuntu-latest, platform: aarch64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add bash build-base &&" }
644+
- { runner: ubuntu-latest, platform: arm-linux-musl, docker_tag: "-alpine", bootstrap: "apk add bash build-base &&" }
645+
- { runner: ubuntu-latest, platform: x86_64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add bash build-base &&" }
648646
# declare docker platform for each platform
649-
- { platform: aarch64-linux-gnu, docker_platform: "--platform=linux/arm64/v8" }
650-
- { platform: aarch64-linux-musl, docker_platform: "--platform=linux/arm64/v8" }
651-
- { platform: arm-linux-gnu, docker_platform: "--platform=linux/arm/v7" }
652-
- { platform: arm-linux-musl, docker_platform: "--platform=linux/arm/v7" }
653-
runs-on: ubuntu-latest
647+
- { runner: ubuntu-24.04-arm, platform: aarch64-linux-gnu, docker_platform: "--platform=linux/arm64/v8" }
648+
- { runner: ubuntu-24.04-arm, platform: aarch64-linux-musl, docker_platform: "--platform=linux/arm64/v8" }
649+
- { runner: ubuntu-24.04-arm, platform: arm-linux-gnu, docker_platform: "--platform=linux/arm/v7" }
650+
- { runner: ubuntu-24.04-arm, platform: arm-linux-musl, docker_platform: "--platform=linux/arm/v7" }
651+
runs-on: ${{ matrix.runner || 'ubuntu-latest' }}
654652
steps:
655653
- uses: actions/checkout@v4
656654
with:
@@ -660,7 +658,6 @@ jobs:
660658
name: cruby-${{ matrix.platform }}-gem
661659
path: gems
662660
- run: |
663-
docker run --rm --privileged alekitto/qemu-user-static --reset -p yes
664661
docker run --rm -v $PWD:/nokogiri -w /nokogiri \
665662
${{ matrix.docker_platform }} ruby:${{ matrix.ruby }}${{ matrix.docker_tag }} \
666663
sh -c "
@@ -679,14 +676,14 @@ jobs:
679676
- x86_64-darwin
680677
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }}
681678
include:
682-
- { platform: arm64-darwin, os: macos-14 }
683-
- { platform: x86_64-darwin, os: macos-13 }
679+
- { platform: arm64-darwin, os: macos-15 }
680+
- { platform: x86_64-darwin, os: macos-15-intel }
684681
runs-on: ${{ matrix.os }}
685682
steps:
686683
- uses: actions/checkout@v4
687684
with:
688685
submodules: true
689-
- uses: ruby/setup-ruby@v1
686+
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
690687
with:
691688
ruby-version: "${{ matrix.ruby }}"
692689
- uses: actions/download-artifact@v4
@@ -706,7 +703,7 @@ jobs:
706703
- uses: actions/checkout@v4
707704
with:
708705
submodules: true
709-
- uses: ruby/setup-ruby@v1
706+
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
710707
with:
711708
ruby-version: "${{matrix.ruby}}"
712709
- uses: actions/download-artifact@v4
@@ -737,19 +734,19 @@ jobs:
737734
strategy:
738735
fail-fast: false
739736
matrix:
740-
jruby: ["9.4"]
741-
jre: ["8", "11"]
737+
jruby: ["10.0"]
738+
jre: ["21", "25"]
742739
name: "jruby-${{matrix.jruby}}-jre${{matrix.jre}}-install"
743740
runs-on: ubuntu-latest
741+
container:
742+
image: "jruby:${{matrix.jruby}}-jre${{matrix.jre}}"
744743
steps:
744+
- run: apt update && apt install -y build-essential git
745745
- uses: actions/checkout@v4
746746
with:
747747
submodules: true
748748
- uses: actions/download-artifact@v4
749749
with:
750750
name: jruby-gem
751751
path: gems
752-
- run: |
753-
docker run --rm -v "$PWD:/nokogiri" -w /nokogiri \
754-
jruby:${{matrix.jruby}}-jre${{matrix.jre}} \
755-
./scripts/test-gem-install gems
752+
- run: ./scripts/test-gem-install gems

.github/workflows/downstream.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,18 @@ jobs:
3131
name: rails-html-sanitizer
3232
command: "bundle exec rake test"
3333
ruby: "3.4"
34-
# # pending a fix for https://github.com/sparklemotion/nokogiri/pull/3348
35-
# - url: https://github.com/rgrove/sanitize
36-
# name: sanitize
37-
# command: "bundle exec rake test"
38-
# ruby: "3.4"
34+
- url: https://github.com/rgrove/sanitize
35+
name: sanitize
36+
command: "bundle exec rake test"
37+
ruby: "3.4"
3938
- url: https://github.com/ebeigarts/signer
4039
name: signer
4140
command: "bundle exec rake spec"
4241
ruby: "3.2"
4342
- url: https://github.com/WinRb/Viewpoint
4443
name: viewpoint
4544
command: "bundle exec rspec spec"
46-
ruby: "3.1"
45+
ruby: "3.2"
4746
- url: https://github.com/rails/rails
4847
name: xmlmini
4948
command: "cd activesupport && bundle exec rake test TESTOPTS=-n/XmlMini/"
@@ -89,9 +88,10 @@ jobs:
8988
working-directory: ${{matrix.name}}
9089
run: |
9190
bundle remove nokogiri || true
92-
bundle add nokogiri --path=".." --skip-install
91+
bundle remove bundler || true
9392
if grep "add_development_dependency.*\bbundler\b" *gemspec ; then
9493
sed -i 's/.*add_development_dependency.*\bbundler\b.*//' *gemspec
9594
fi
95+
bundle add nokogiri --path=".." --skip-install
9696
bundle install --jobs=1
9797
${{matrix.command}}

.github/workflows/generate-ci-images.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
tag: ["alpine", "mri-3.1", "mri-3.2", "mri-3.3", "mri-3.4", "ubuntu", "upstream-libxml"]
14+
tag: ["alpine", "mri-3.2", "mri-3.3", "mri-3.4", "mri-4.0", "ubuntu", "upstream-libxml"]
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
1818
with:
1919
submodules: true
2020
- uses: ruby/setup-ruby@v1
2121
with:
22-
ruby-version: "3.1"
22+
ruby-version: "3.4"
2323
bundler-cache: true
24-
bundler: latest
2524
- uses: docker/setup-buildx-action@v3
2625
- uses: docker/login-action@v3
2726
with:

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ inherit_from:
2222

2323
AllCops:
2424
SuggestExtensions: false
25-
TargetRubyVersion: "3.1"
25+
TargetRubyVersion: "3.2"
2626

2727
Style/TrailingCommaInArrayLiteral:
2828
EnforcedStyleForMultiline: consistent_comma

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ bundle install
105105

106106
### Advanced
107107

108-
Please install the latest or previous version of CRuby (e.g., 3.2 or 3.1 as of 2023-01), and a recent version of JRuby. We recommend using `rbenv`, which is used in test scripts when necessary to test gems against multiple rubies.
108+
Please install the latest or previous version of CRuby (e.g., 4.0 or 3.4 as of 2025-12), and a recent version of JRuby. We recommend using `rbenv`, which is used in test scripts when necessary to test gems against multiple rubies.
109109

110110
Please install a system version of libxml2/libxslt (see [Installing Nokogiri](https://nokogiri.org/tutorials/installing_nokogiri.html#installing-using-standard-system-libraries) for details) so that you can test against both the packaged libraries and your system libraries.
111111

Gemfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ gemspec
66

77
group :development do
88
# bootstrapping
9-
gem "bundler", "~> 2.3"
109
gem "rake", "13.2.1"
1110

1211
# building extensions
13-
gem "rake-compiler", "1.2.8"
14-
gem "rake-compiler-dock", "1.7.0"
12+
gem "rake-compiler", "1.3.1"
13+
gem "rake-compiler-dock", "1.11.1"
1514

1615
# parser generator
1716
gem "rexical", "1.0.8"
1817

1918
# tests
20-
gem "minitest", "5.25.4"
21-
gem "minitest-parallel_fork", "2.0.0"
19+
gem "minitest", "6.0.1"
20+
gem "minitest-mock", "5.27.0"
21+
gem "minitest-parallel_fork", "2.1.1"
2222
gem "ruby_memcheck", "3.0.0"
2323
gem "rubyzip", "~> 2.3.2"
2424
gem "simplecov", "= 0.21.2"

0 commit comments

Comments
 (0)