Skip to content

Commit f26cb7a

Browse files
authored
Merge pull request #673 from sparklemotion/flavorjones/ruby-4-native-support
dep: add native gem support for Ruby 4.0, drop Ruby 3.1 support
2 parents 9789b37 + d479c81 commit f26cb7a

File tree

6 files changed

+31
-27
lines changed

6 files changed

+31
-27
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ env:
2323
jobs:
2424
ruby_versions:
2525
outputs:
26-
setup_ruby: "['3.1', '3.2', '3.3', '3.4']"
27-
image_tag: "['3.1', '3.2', '3.3', '3.4']"
26+
setup_ruby: "['3.2', '3.3', '3.4', '4.0']"
27+
image_tag: "['3.2', '3.3', '3.4', '4.0']"
2828
runs-on: ubuntu-latest
2929
steps:
3030
- run: echo "generating rubies ..."
@@ -38,9 +38,9 @@ jobs:
3838
BUNDLE_WITHOUT: "" # we need rubocop, obviously
3939
steps:
4040
- uses: actions/checkout@v6
41-
- uses: ruby/setup-ruby@v1
41+
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
4242
with:
43-
ruby-version: "3.3"
43+
ruby-version: "3.4"
4444
bundler-cache: true
4545
- run: bundle exec rake rubocop
4646

@@ -51,7 +51,8 @@ jobs:
5151
- uses: actions/checkout@v6
5252
- uses: ruby/setup-ruby-pkgs@v1
5353
with:
54-
ruby-version: "3.3"
54+
setup-ruby-ref: ruby/setup-ruby/d3e3bd032ad2222a8ac878bbccf2aba78864e134
55+
ruby-version: "3.4"
5556
bundler-cache: true
5657
apt-get: libsqlite3-dev
5758
- run: bundle exec rake compile -- --enable-system-libraries
@@ -82,6 +83,7 @@ jobs:
8283
- uses: actions/checkout@v6
8384
- uses: ruby/setup-ruby-pkgs@v1
8485
with:
86+
setup-ruby-ref: ruby/setup-ruby/d3e3bd032ad2222a8ac878bbccf2aba78864e134
8587
ruby-version: ${{ matrix.ruby }}
8688
bundler-cache: true
8789
apt-get: libsqlite3-dev
@@ -150,6 +152,7 @@ jobs:
150152
- uses: actions/checkout@v6
151153
- uses: ruby/setup-ruby-pkgs@v1
152154
with:
155+
setup-ruby-ref: ruby/setup-ruby/d3e3bd032ad2222a8ac878bbccf2aba78864e134
153156
ruby-version: ${{ matrix.ruby }}
154157
bundler-cache: true
155158
apt-get: libsqlcipher-dev
@@ -166,7 +169,8 @@ jobs:
166169
- uses: actions/checkout@v6
167170
- uses: ruby/setup-ruby-pkgs@v1
168171
with:
169-
ruby-version: "3.3"
172+
setup-ruby-ref: ruby/setup-ruby/d3e3bd032ad2222a8ac878bbccf2aba78864e134
173+
ruby-version: "3.4"
170174
bundler-cache: true
171175
apt-get: valgrind
172176
- uses: actions/cache@v4
@@ -191,9 +195,9 @@ jobs:
191195
with:
192196
path: ports/archives
193197
key: ports-archives-tarball-${{ hashFiles('ext/sqlite3/extconf.rb','dependencies.yml') }}
194-
- uses: ruby/setup-ruby@v1
198+
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
195199
with:
196-
ruby-version: "3.3"
200+
ruby-version: "3.4"
197201
bundler-cache: true
198202
- run: bundle exec ruby ./ext/sqlite3/extconf.rb --download-dependencies
199203
- id: rcd_image_version
@@ -209,9 +213,9 @@ jobs:
209213
with:
210214
path: ports/archives
211215
key: ports-archives-tarball-${{ hashFiles('ext/sqlite3/extconf.rb','dependencies.yml') }}
212-
- uses: ruby/setup-ruby@v1
216+
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
213217
with:
214-
ruby-version: "3.3"
218+
ruby-version: "3.4"
215219
bundler-cache: true
216220
- run: ./bin/test-gem-build gems ruby
217221
- uses: actions/upload-artifact@v5
@@ -237,6 +241,7 @@ jobs:
237241
- uses: actions/checkout@v6
238242
- uses: ruby/setup-ruby-pkgs@v1
239243
with:
244+
setup-ruby-ref: ruby/setup-ruby/d3e3bd032ad2222a8ac878bbccf2aba78864e134
240245
ruby-version: ${{ matrix.ruby }}
241246
apt-get: libsqlite3-dev pkg-config
242247
mingw: sqlite3
@@ -344,7 +349,7 @@ jobs:
344349
runs-on: ${{ matrix.os }}
345350
steps:
346351
- uses: actions/checkout@v6
347-
- uses: ruby/setup-ruby@v1
352+
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
348353
with:
349354
ruby-version: "${{ matrix.ruby }}"
350355
- uses: actions/download-artifact@v6
@@ -360,13 +365,12 @@ jobs:
360365
fail-fast: false
361366
matrix:
362367
include:
363-
- { ruby: "3.1", flavor: "alpine3.18" }
364-
- { ruby: "3.1", flavor: "alpine3.19" }
365368
- { ruby: "3.2", flavor: "alpine3.18" }
366369
- { ruby: "3.2", flavor: "alpine3.19" }
367370
- { ruby: "3.3", flavor: "alpine3.18" }
368371
- { ruby: "3.3", flavor: "alpine3.19" }
369372
- { ruby: "3.4", flavor: "alpine" }
373+
- { ruby: "4.0", flavor: "alpine" }
370374
runs-on: ubuntu-latest
371375
container:
372376
image: ruby:${{matrix.ruby}}-${{matrix.flavor}}

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ group :test do
88
gem "ruby_memcheck", "3.0.1" if Gem::Platform.local.os == "linux"
99

1010
gem "rake-compiler", "1.3.0"
11-
gem "rake-compiler-dock", "1.10.0"
11+
gem "rake-compiler-dock", "1.11.0"
1212
end
1313

1414
group :development do

INSTALLATION.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,38 @@ This document will help you install the `sqlite3` ruby gem. It also contains ins
77

88
### Native Gems (recommended)
99

10-
In v2.0.0 and later, native (precompiled) gems are available for recent Ruby versions on these platforms:
10+
In v2.5.0 and later, native (precompiled) gems are available for recent Ruby versions on these platforms:
1111

1212
- `aarch64-linux-gnu` (requires: glibc >= 2.29)
1313
- `aarch64-linux-musl`
1414
- `arm-linux-gnu` (requires: glibc >= 2.29)
1515
- `arm-linux-musl`
1616
- `arm64-darwin`
1717
- `x64-mingw-ucrt`
18-
- `x86-linux-gnu` (requires: glibc >= 2.17)
18+
- `x86-linux-gnu` (requires: glibc >= 2.29)
1919
- `x86-linux-musl`
2020
- `x86_64-darwin`
21-
- `x86_64-linux-gnu` (requires: glibc >= 2.17)
21+
- `x86_64-linux-gnu` (requires: glibc >= 2.29)
2222
- `x86_64-linux-musl`
2323

2424
⚠ Musl linux users should update to Bundler >= 2.5.6 to avoid https://github.com/rubygems/rubygems/issues/7432
2525

2626
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.
2727

28-
For example, on a linux system running Ruby 3.1:
28+
For example, on a linux system running Ruby 3.4:
2929

3030
``` text
3131
$ ruby -v
32-
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
32+
ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [x86_64-linux]
3333
3434
$ time gem install sqlite3
35-
Fetching sqlite3-1.5.0-x86_64-linux.gem
36-
Successfully installed sqlite3-1.5.0-x86_64-linux
35+
Fetching sqlite3-2.8.1-x86_64-linux-gnu.gem
36+
Successfully installed sqlite3-2.8.1-x86_64-linux-gnu
3737
1 gem installed
3838
39-
real 0m4.274s
40-
user 0m0.734s
41-
sys 0m0.165s
39+
real 0m1.273s
40+
user 0m0.496s
41+
sys 0m0.078s
4242
```
4343

4444
#### Avoiding the precompiled native gem

bin/test-gem-file-contents

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Minitest::Reporters.use!([Minitest::Reporters::SpecReporter.new])
6565

6666
puts "Testing '#{gemfile}' (#{gemspec.platform})"
6767
describe File.basename(gemfile) do
68-
let(:supported_ruby_versions) { ["3.1", "3.2", "3.3", "3.4"] }
68+
let(:supported_ruby_versions) { ["3.2", "3.3", "3.4", "4.0"] }
6969

7070
describe "setup" do
7171
it "gemfile contains some files" do

rakelib/native.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ cross_platforms = [
1919
"x86_64-darwin",
2020
"x64-mingw-ucrt"
2121
]
22-
RakeCompilerDock.set_ruby_cc_version("~> 3.1")
22+
RakeCompilerDock.set_ruby_cc_version(">= 3.2")
2323

2424
Gem::PackageTask.new(SQLITE3_SPEC).define # packaged_tarball version of the gem for platform=ruby
2525
task "package" => cross_platforms.map { |p| "gem:#{p}" } # "package" task for all the native platforms

sqlite3.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
1818

1919
s.licenses = ["BSD-3-Clause"]
2020

21-
s.required_ruby_version = Gem::Requirement.new(">= 3.1")
21+
s.required_ruby_version = Gem::Requirement.new(">= 3.2")
2222

2323
s.homepage = "https://github.com/sparklemotion/sqlite3-ruby"
2424
s.metadata = {

0 commit comments

Comments
 (0)