Skip to content

Commit

Permalink
ext: add Ruby 3.4 to the precompiled native gems (#3376)
Browse files Browse the repository at this point in the history
**What problem is this PR intended to solve?**

ext: add Ruby 3.4 to the precompiled native gems

Closes #3273.


**Have you included adequate test coverage?**

Yes.


**Does this change affect the behavior of either the C or the Java
implementations?**

CRuby only, obvs.
  • Loading branch information
flavorjones authored Dec 14, 2024
2 parents ca8a4e6 + 802bb7a commit 1788b0d
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 16 deletions.
9 changes: 9 additions & 0 deletions .cross_rubies
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@
3.3.5:x86_64-darwin
3.3.5:x86_64-linux-gnu
3.3.5:x86_64-linux-musl
3.4.0:aarch64-linux-gnu
3.4.0:aarch64-linux-musl
3.4.0:arm-linux-gnu
3.4.0:arm-linux-musl
3.4.0:arm64-darwin
3.4.0:x64-mingw-ucrt
3.4.0:x86_64-darwin
3.4.0:x86_64-linux-gnu
3.4.0:x86_64-linux-musl
26 changes: 14 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ jobs:
ruby_versions:
needs: ["basic"]
outputs:
minors: "['3.1', '3.2', '3.3']"
setup_ruby: "['3.1', '3.2', '3.3', '3.4.0-rc1']"
setup_ruby_windows: "['3.1', '3.2', '3.3', 'head']"
nokogiri_test_image: "['3.1', '3.2', '3.3', '3.4-rc']"
runs-on: ubuntu-latest
steps:
- run: echo "generating rubies ..."
Expand Down Expand Up @@ -124,7 +126,7 @@ jobs:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
ruby: ${{ fromJSON(needs.ruby_versions.outputs.nokogiri_test_image) }}
runs-on: ubuntu-latest
container:
image: ghcr.io/sparklemotion/nokogiri-test:mri-${{matrix.ruby}}
Expand All @@ -148,7 +150,7 @@ jobs:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
ruby: ${{ fromJSON(needs.ruby_versions.outputs.nokogiri_test_image) }}
mem: ["ruby"]
include:
- sys: "disable"
Expand Down Expand Up @@ -264,7 +266,7 @@ jobs:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -319,7 +321,7 @@ jobs:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby_windows) }}
runs-on: windows-2022
steps:
- name: configure git crlf
Expand Down Expand Up @@ -496,7 +498,7 @@ jobs:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -518,7 +520,7 @@ jobs:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -539,7 +541,7 @@ jobs:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby_windows) }}
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -596,7 +598,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -624,7 +626,7 @@ jobs:
- arm-linux-musl
- x86_64-linux-gnu
- x86_64-linux-musl
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }}
include:
# declare docker image for each platform
- { platform: aarch64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add bash build-base &&" }
Expand Down Expand Up @@ -663,7 +665,7 @@ jobs:
platform:
- arm64-darwin
- x86_64-darwin
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }}
include:
- { platform: arm64-darwin, os: macos-14 }
- { platform: x86_64-darwin, os: macos-13 }
Expand All @@ -686,7 +688,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby_windows) }}
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 3 additions & 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.1", "mri-3.2", "mri-3.3", "ubuntu", "upstream-libxml"]
tag: ["alpine", "mri-3.1", "mri-3.2", "mri-3.3", "mri-3.4-rc", "ubuntu", "upstream-libxml"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -35,3 +35,5 @@ jobs:
push: true
tags: ghcr.io/sparklemotion/nokogiri-test:${{matrix.tag}}
file: oci-images/nokogiri-test/${{matrix.tag}}.dockerfile
cache-from: type=registry,ref=ghcr.io/sparklemotion/nokogiri-test:${{ matrix.tag }}-cache
cache-to: type=registry,ref=ghcr.io/sparklemotion/nokogiri-test:${{ matrix.tag }}-cache,mode=max
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ Nokogiri follows [Semantic Versioning](https://semver.org/), please see the [REA

#### Ruby

This release introduces native gem support for Ruby 3.4.

This release ends support for Ruby 3.0, for which [upstream support ended 2024-04-23](https://www.ruby-lang.org/en/downloads/branches/).

This release ships separate precompiled GNU and Musl gems for all linux platforms. Previously both GNU and Musl target systems could use and install the same gem, e.g., the platform gem for `x86_64-linux`. Now, however, the precompiled gem platforms would be `x86_64-linux-gnu` and `x86_64-linux-musl`. So long as you're on `bundler >= 2.5.6` this should be seamless other than perhaps needing to update the platforms in your "Gemfile.lock".

This release drops precompiled native platform gems for `x86-linux` and `x86-mingw32`. **These platforms are still supported.** Users on these platforms must install the "ruby platform" gem which requires a compiler toolchain. See [Installing the `ruby` platform gem](https://nokogiri.org/tutorials/installing_nokogiri.html#installing-the-ruby-platform-gem) in the installation docs. (#3369, #3081)


Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ group :development do

# building extensions
gem "rake-compiler", "1.2.8"
gem "rake-compiler-dock", "1.6.0"
gem "rake-compiler-dock", "1.7.0.rc1"

# parser generator
gem "rexical", "1.0.8"
Expand Down
46 changes: 46 additions & 0 deletions oci-images/nokogiri-test/mri-3.4-rc.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM ruby:3.4-rc

# include_file debian-prelude.step
# -*- dockerfile -*-

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y apt-utils


# include_file valgrind-from-source.step
# -*- dockerfile -*-

RUN apt-get install -y libc6-dbg
RUN wget https://sourceware.org/pub/valgrind/valgrind-3.21.0.tar.bz2 && \
tar -xf valgrind-3.21.0.tar.bz2 && \
cd valgrind-3.21.0 && \
./configure && \
make && \
make install


# include_file debian-libxml-et-al.step
# -*- dockerfile -*-

RUN apt-get install -y libxslt-dev libxml2-dev zlib1g-dev pkg-config
RUN apt-get install -y libyaml-dev # for psych 5


# include_file update-bundler.step
# -*- dockerfile -*-

RUN gem install bundler


# include_file bundle-install.step
# -*- dockerfile -*-

COPY Gemfile nokogiri/
COPY Gemfile.lock nokogiri/
COPY nokogiri.gemspec nokogiri/

RUN gem install bundler -v "$(grep -A 1 "BUNDLED WITH" nokogiri/Gemfile.lock | tail -n 1)"
RUN cd nokogiri && bundle install

6 changes: 4 additions & 2 deletions rakelib/docker.rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ module DockerHelper
IMAGE_DIR = "oci-images/nokogiri-test"
IMAGE_NAME = "ghcr.io/sparklemotion/nokogiri-test"
RUBIES = {
# engine → array of ruby minor versions
mri: File.read(".cross_rubies").lines.map { _1.split(":").first }.uniq.map { _1.split(".").take(2).join(".") },
# engine → array of ruby minor version docker tags
mri: ["3.1", "3.2", "3.3", "3.4-rc"],
}

class << self
Expand Down Expand Up @@ -87,6 +87,8 @@ module DockerHelper
push: true
tags: #{IMAGE_NAME}:${{matrix.tag}}
file: #{IMAGE_DIR}/${{matrix.tag}}.dockerfile
cache-from: type=registry,ref=ghcr.io/sparklemotion/nokogiri-test:${{ matrix.tag }}-cache
cache-to: type=registry,ref=ghcr.io/sparklemotion/nokogiri-test:${{ matrix.tag }}-cache,mode=max
YAML

puts "writing #{filename} ..."
Expand Down

0 comments on commit 1788b0d

Please sign in to comment.