From 4faeac7454bcbbfe310ed45f78a9d425661801bc Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 18 Sep 2024 11:38:18 -0400 Subject: [PATCH] Drop support for Ruby 3.0 (#563) * Drop support for Ruby 3.0 Primarily because it doesn't support Process._fork, but also because it's been EOL for many months. * ci: bump fedora to 40 because fedora 35 distributes ruby 3.0 * Drop mingw32 (non-ucrt) native gems Because windows rubyinstaller builds with UCRT starting with ruby 3.1. --- .github/workflows/ci.yml | 21 +++++++-------------- .rubocop.yml | 2 +- CHANGELOG.md | 5 +++++ INSTALLATION.md | 4 +--- bin/test-gem-file-contents | 32 +++++--------------------------- rakelib/native.rake | 3 +-- sqlite3.gemspec | 2 +- test/test_discarding.rb | 1 - 8 files changed, 21 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ac6e3ac..4155f77d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: fail-fast: false matrix: os: [ubuntu, macos, windows] - ruby: ["3.3", "3.2", "3.1", "3.0"] + ruby: ["3.3", "3.2", "3.1"] syslib: [enable, disable] include: # additional compilation flags for homebrew @@ -86,10 +86,10 @@ jobs: # reported at https://github.com/sparklemotion/sqlite3-ruby/issues/354 # TODO remove once https://github.com/flavorjones/mini_portile/issues/118 is fixed needs: basic - name: "fedora:35" + name: "fedora:40" runs-on: ubuntu-latest container: - image: fedora:35 + image: fedora:40 steps: - run: | dnf group install -y "C Development Tools and Libraries" @@ -122,7 +122,7 @@ jobs: fail-fast: false matrix: os: [ubuntu, macos, windows] - ruby: ["3.3", "3.0"] # oldest and newest + ruby: ["3.3", "3.1"] # oldest and newest include: - { os: windows, ruby: mingw } - { os: windows, ruby: mswin } @@ -213,7 +213,7 @@ jobs: fail-fast: false matrix: os: [ubuntu, macos, windows] - ruby: ["3.3", "3.2", "3.1", "3.0"] + ruby: ["3.3", "3.2", "3.1"] syslib: [enable, disable] include: # additional compilation flags for homebrew @@ -246,7 +246,6 @@ jobs: - arm-linux-musl - arm64-darwin - x64-mingw-ucrt - - x64-mingw32 - x86-linux-gnu - x86-linux-musl - x86_64-darwin @@ -284,7 +283,7 @@ jobs: - x86-linux-musl - x86_64-linux-gnu - x86_64-linux-musl - ruby: ["3.3", "3.2", "3.1", "3.0"] + ruby: ["3.3", "3.2", "3.1"] include: # declare docker image for each platform - { platform: aarch64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" } @@ -322,15 +321,12 @@ jobs: fail-fast: false matrix: os: [windows-latest, macos-13, macos-14] - ruby: ["3.3", "3.2", "3.1", "3.0"] + ruby: ["3.3", "3.2", "3.1"] include: - os: macos-13 platform: x86_64-darwin - os: macos-14 platform: arm64-darwin - - os: windows-latest - ruby: "3.0" - platform: x64-mingw32 - os: windows-latest ruby: "3.1" platform: x64-mingw-ucrt @@ -359,7 +355,6 @@ jobs: fail-fast: false matrix: include: - - { ruby: "3.0", flavor: "alpine" } - { ruby: "3.1", flavor: "alpine3.18" } - { ruby: "3.1", flavor: "alpine3.19" } - { ruby: "3.2", flavor: "alpine3.18" } @@ -376,6 +371,4 @@ jobs: name: cruby-x86_64-linux-musl-gem path: gems - run: apk add build-base - - if: matrix.ruby == '3.0' # https://github.com/rake-compiler/rake-compiler/pull/236 - run: gem update --system - run: ./bin/test-gem-install ./gems diff --git a/.rubocop.yml b/.rubocop.yml index faeea9f9..62458687 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -13,7 +13,7 @@ inherit_gem: AllCops: SuggestExtensions: false - TargetRubyVersion: 3.0 + TargetRubyVersion: 3.1 Naming/InclusiveLanguage: Enabled: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c584b9e..5fc24cd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## next / unreleased +### Ruby + +- This release drops support for Ruby 3.0. [#563] @flavorjones + + ### Fork safety improvements Sqlite itself is [not fork-safe](https://www.sqlite.org/howtocorrupt.html#_carrying_an_open_database_connection_across_a_fork_). Specifically, writing in a child process to a database connection that was created in the parent process may corrupt the database file. To mitigate this risk, sqlite3-ruby has implemented the following changes: diff --git a/INSTALLATION.md b/INSTALLATION.md index 50e5055c..e3dd5f3f 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -14,15 +14,13 @@ In v2.0.0 and later, native (precompiled) gems are available for recent Ruby ver - `arm-linux-gnu` (requires: glibc >= 2.29) - `arm-linux-musl` - `arm64-darwin` -- `x64-mingw32` / `x64-mingw-ucrt` +- `x64-mingw-ucrt` - `x86-linux-gnu` (requires: glibc >= 2.17) - `x86-linux-musl` - `x86_64-darwin` - `x86_64-linux-gnu` (requires: glibc >= 2.17) - `x86_64-linux-musl` -⚠ Ruby 3.0 linux users must use Rubygems >= 3.3.22 in order to use these gems. - ⚠ Musl linux users should update to Bundler >= 2.5.6 to avoid https://github.com/rubygems/rubygems/issues/7432 If you are using one of these Ruby versions on one of these platforms, the native gem is the recommended way to install sqlite3-ruby. diff --git a/bin/test-gem-file-contents b/bin/test-gem-file-contents index 284c4fea..8ae6bea7 100755 --- a/bin/test-gem-file-contents +++ b/bin/test-gem-file-contents @@ -65,22 +65,7 @@ Minitest::Reporters.use!([Minitest::Reporters::SpecReporter.new]) puts "Testing '#{gemfile}' (#{gemspec.platform})" describe File.basename(gemfile) do - let(:all_supported_ruby_versions) { - ["3.0", "3.1", "3.2", "3.3"] - } - let(:native_supported_ruby_versions) { ["3.0", "3.1", "3.2", "3.3"] } - let(:ucrt_supported_ruby_versions) { ["3.1", "3.2", "3.3"] } - let(:platform_supported_ruby_versions) do - if gemspec.platform.to_s == "x64-mingw-ucrt" - ucrt_supported_ruby_versions - elsif gemspec.platform.to_s == "x64-mingw32" - native_supported_ruby_versions - ucrt_supported_ruby_versions - elsif gemspec.platform.cpu - native_supported_ruby_versions - else - all_supported_ruby_versions - end - end + let(:supported_ruby_versions) { ["3.1", "3.2", "3.3"] } describe "setup" do it "gemfile contains some files" do @@ -147,7 +132,7 @@ describe File.basename(gemfile) do end it "sets required_ruby_version appropriately" do - all_supported_ruby_versions.each do |v| + supported_ruby_versions.each do |v| assert( gemspec.required_ruby_version.satisfied_by?(Gem::Version.new(v)), "required_ruby_version='#{gemspec.required_ruby_version}' should support ruby #{v}" @@ -181,7 +166,7 @@ describe File.basename(gemfile) do end it "contains expected shared library files " do - platform_supported_ruby_versions.each do |version| + supported_ruby_versions.each do |version| actual = gemfile_contents.find do |p| File.fnmatch?("lib/sqlite3/#{version}/sqlite3_native.{so,bundle}", p, File::FNM_EXTGLOB) end @@ -197,26 +182,19 @@ describe File.basename(gemfile) do File.fnmatch?("lib/sqlite3/**/*.{so,bundle}", p, File::FNM_EXTGLOB) end assert_equal( - platform_supported_ruby_versions.length, + supported_ruby_versions.length, actual.length, "did not expect extra shared library files" ) end it "sets required_ruby_version appropriately" do - unsupported_versions = all_supported_ruby_versions - platform_supported_ruby_versions - platform_supported_ruby_versions.each do |v| + supported_ruby_versions.each do |v| assert( gemspec.required_ruby_version.satisfied_by?(Gem::Version.new(v)), "required_ruby_version='#{gemspec.required_ruby_version}' should support ruby #{v}" ) end - unsupported_versions.each do |v| - refute( - gemspec.required_ruby_version.satisfied_by?(Gem::Version.new(v)), - "required_ruby_version='#{gemspec.required_ruby_version}' should not support ruby #{v}" - ) - end end it "does not set metadata for msys2" do diff --git a/rakelib/native.rake b/rakelib/native.rake index ff9177a8..4d29758e 100644 --- a/rakelib/native.rake +++ b/rakelib/native.rake @@ -6,7 +6,7 @@ require "rake/extensiontask" require "rake_compiler_dock" require "yaml" -cross_rubies = ["3.3.0", "3.2.0", "3.1.0", "3.0.0"] +cross_rubies = ["3.3.0", "3.2.0", "3.1.0"] cross_platforms = [ "aarch64-linux-gnu", "aarch64-linux-musl", @@ -14,7 +14,6 @@ cross_platforms = [ "arm-linux-musl", "arm64-darwin", "x64-mingw-ucrt", - "x64-mingw32", "x86-linux-gnu", "x86-linux-musl", "x86_64-darwin", diff --git a/sqlite3.gemspec b/sqlite3.gemspec index 4174ba12..8283fbed 100644 --- a/sqlite3.gemspec +++ b/sqlite3.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |s| s.licenses = ["BSD-3-Clause"] - s.required_ruby_version = Gem::Requirement.new(">= 3.0") + s.required_ruby_version = Gem::Requirement.new(">= 3.1") s.homepage = "https://github.com/sparklemotion/sqlite3-ruby" s.metadata = { diff --git a/test/test_discarding.rb b/test/test_discarding.rb index 20339ac1..d4fd05c9 100644 --- a/test/test_discarding.rb +++ b/test/test_discarding.rb @@ -39,7 +39,6 @@ def in_a_forked_process def test_fork_discards_an_open_readwrite_connection skip("interpreter doesn't support fork") unless Process.respond_to?(:fork) skip("valgrind doesn't handle forking") if i_am_running_in_valgrind - skip("ruby 3.0 doesn't have Process._fork") if RUBY_VERSION < "3.1.0" GC.start begin