Skip to content

Commit 84aa942

Browse files
authored
Require Ruby 3.0+, test Ruby 3.4 in CI, support Ruby development versions (#322)
1 parent 91bb771 commit 84aa942

8 files changed

+59
-30
lines changed

Diff for: .github/workflows/ci.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3'] # 3.4+ is not yet supported by google-protobuf
12-
os: ['ubuntu-latest', 'windows-latest']
11+
ruby:
12+
- '3.0'
13+
- '3.1'
14+
- '3.2'
15+
- '3.3'
16+
- '3.4'
17+
os:
18+
- 'ubuntu-latest'
19+
- 'windows-latest'
1320
runs-on: ${{ matrix.os }}
1421
steps:
15-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
1623
- uses: ruby/setup-ruby@v1
1724
with:
1825
ruby-version: ${{ matrix.ruby }}
@@ -21,4 +28,4 @@ jobs:
2128
run: bundle exec rake test
2229
- name: RuboCop
2330
run: bundle exec rake lint
24-
if: matrix.ruby != '3.1' && matrix.ruby != '3.2' && matrix.ruby != '3.3'
31+
if: matrix.ruby == '3.0'

Diff for: Gemfile.lock

+23-20
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,35 @@ PATH
77
GEM
88
remote: https://rubygems.org/
99
specs:
10-
ast (2.4.1)
11-
diff-lcs (1.5.0)
12-
docile (1.4.0)
13-
google-protobuf (3.25.5)
14-
parallel (1.20.1)
10+
ast (2.4.2)
11+
bigdecimal (3.1.9)
12+
diff-lcs (1.5.1)
13+
docile (1.4.1)
14+
google-protobuf (4.29.3)
15+
bigdecimal
16+
rake (>= 13)
17+
parallel (1.26.3)
1518
parser (2.7.2.0)
1619
ast (~> 2.4.1)
1720
powerpack (0.1.3)
1821
rainbow (2.2.2)
1922
rake
20-
rake (13.0.3)
23+
rake (13.2.1)
2124
rake-compiler (0.9.9)
2225
rake
23-
rspec (3.12.0)
24-
rspec-core (~> 3.12.0)
25-
rspec-expectations (~> 3.12.0)
26-
rspec-mocks (~> 3.12.0)
27-
rspec-core (3.12.2)
28-
rspec-support (~> 3.12.0)
29-
rspec-expectations (3.12.3)
26+
rspec (3.13.0)
27+
rspec-core (~> 3.13.0)
28+
rspec-expectations (~> 3.13.0)
29+
rspec-mocks (~> 3.13.0)
30+
rspec-core (3.13.2)
31+
rspec-support (~> 3.13.0)
32+
rspec-expectations (3.13.3)
3033
diff-lcs (>= 1.2.0, < 2.0)
31-
rspec-support (~> 3.12.0)
32-
rspec-mocks (3.12.6)
34+
rspec-support (~> 3.13.0)
35+
rspec-mocks (3.13.2)
3336
diff-lcs (>= 1.2.0, < 2.0)
34-
rspec-support (~> 3.12.0)
35-
rspec-support (3.12.1)
37+
rspec-support (~> 3.13.0)
38+
rspec-support (3.13.2)
3639
rubocop (0.49.1)
3740
parallel (~> 1.10)
3841
parser (>= 2.3.3.1, < 3.0)
@@ -42,14 +45,14 @@ GEM
4245
unicode-display_width (~> 1.0, >= 1.0.1)
4346
rubocop-rspec (1.15.1)
4447
rubocop (>= 0.42.0)
45-
ruby-progressbar (1.10.1)
48+
ruby-progressbar (1.13.0)
4649
simplecov (0.22.0)
4750
docile (~> 1.1)
4851
simplecov-html (~> 0.11)
4952
simplecov_json_formatter (~> 0.1)
50-
simplecov-html (0.12.3)
53+
simplecov-html (0.13.1)
5154
simplecov_json_formatter (0.1.4)
52-
unicode-display_width (1.7.0)
55+
unicode-display_width (1.8.0)
5356

5457
PLATFORMS
5558
ruby
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Init_pg_query
2+
ruby_abi_version

Diff for: ext/pg_query/ext_symbols_with_ruby_abi_version.sym

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_Init_pg_query
2+
_ruby_abi_version

Diff for: ext/pg_query/extconf.rb

+19-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,25 @@
2121
$INCFLAGS = "-I#{File.join(__dir__, 'include', 'postgres', 'port', 'win32_msvc')} " + $INCFLAGS
2222
end
2323

24-
SYMFILE =
25-
if RUBY_PLATFORM =~ /freebsd/
26-
File.join(__dir__, 'pg_query_ruby_freebsd.sym')
27-
elsif RUBY_PLATFORM !~ /cygwin|mswin|mingw|bccwin|wince|emx/
28-
File.join(__dir__, 'pg_query_ruby.sym')
29-
end
24+
# "ruby_abi_version" is a required symbol to be exported on Ruby 3.2+ development releases
25+
# See https://github.com/ruby/ruby/pull/5474 and https://github.com/ruby/ruby/pull/6231
26+
def export_ruby_abi_version
27+
return false if RUBY_PATCHLEVEL >= 0 # Not a development release
28+
m = /(\d+)\.(\d+)/.match(RUBY_VERSION)
29+
return false if m.nil?
30+
major = m[1].to_i
31+
minor = m[2].to_i
32+
major >= 3 && minor >= 2
33+
end
34+
35+
def ext_symbols_filename
36+
name = 'ext_symbols'
37+
name += '_freebsd' if RUBY_PLATFORM =~ /freebsd/
38+
name += '_with_ruby_abi_version' if export_ruby_abi_version
39+
"#{name}.sym"
40+
end
41+
42+
SYMFILE = File.join(__dir__, ext_symbols_filename)
3043

3144
if RUBY_PLATFORM =~ /darwin/
3245
$DLDFLAGS << " -Wl,-exported_symbols_list #{SYMFILE}" unless defined?(::Rubinius)

Diff for: pg_query.gemspec

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Gem::Specification.new do |s|
1212
s.license = 'BSD-3-Clause'
1313
s.homepage = 'https://github.com/pganalyze/pg_query'
1414

15+
s.required_ruby_version = '>= 3.0'
16+
1517
s.extensions = %w[ext/pg_query/extconf.rb]
1618

1719
s.files = Dir['CHANGELOG.md', 'LICENSE', 'README.md', 'Rakefile', 'lib/**/*.rb',

0 commit comments

Comments
 (0)