Skip to content

Commit

Permalink
Require Ruby 3.0+, test Ruby 3.4 in CI, support Ruby development vers…
Browse files Browse the repository at this point in the history
…ions (#322)
  • Loading branch information
PikachuEXE authored Feb 5, 2025
1 parent 91bb771 commit 84aa942
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 30 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3'] # 3.4+ is not yet supported by google-protobuf
os: ['ubuntu-latest', 'windows-latest']
ruby:
- '3.0'
- '3.1'
- '3.2'
- '3.3'
- '3.4'
os:
- 'ubuntu-latest'
- 'windows-latest'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
Expand All @@ -21,4 +28,4 @@ jobs:
run: bundle exec rake test
- name: RuboCop
run: bundle exec rake lint
if: matrix.ruby != '3.1' && matrix.ruby != '3.2' && matrix.ruby != '3.3'
if: matrix.ruby == '3.0'
43 changes: 23 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,35 @@ PATH
GEM
remote: https://rubygems.org/
specs:
ast (2.4.1)
diff-lcs (1.5.0)
docile (1.4.0)
google-protobuf (3.25.5)
parallel (1.20.1)
ast (2.4.2)
bigdecimal (3.1.9)
diff-lcs (1.5.1)
docile (1.4.1)
google-protobuf (4.29.3)
bigdecimal
rake (>= 13)
parallel (1.26.3)
parser (2.7.2.0)
ast (~> 2.4.1)
powerpack (0.1.3)
rainbow (2.2.2)
rake
rake (13.0.3)
rake (13.2.1)
rake-compiler (0.9.9)
rake
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rspec-support (~> 3.13.0)
rspec-support (3.13.2)
rubocop (0.49.1)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
Expand All @@ -42,14 +45,14 @@ GEM
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-rspec (1.15.1)
rubocop (>= 0.42.0)
ruby-progressbar (1.10.1)
ruby-progressbar (1.13.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
unicode-display_width (1.7.0)
unicode-display_width (1.8.0)

PLATFORMS
ruby
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions ext/pg_query/ext_symbols_freebsd_with_ruby_abi_version.sym
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Init_pg_query
ruby_abi_version
2 changes: 2 additions & 0 deletions ext/pg_query/ext_symbols_with_ruby_abi_version.sym
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_Init_pg_query
_ruby_abi_version
25 changes: 19 additions & 6 deletions ext/pg_query/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,25 @@
$INCFLAGS = "-I#{File.join(__dir__, 'include', 'postgres', 'port', 'win32_msvc')} " + $INCFLAGS
end

SYMFILE =
if RUBY_PLATFORM =~ /freebsd/
File.join(__dir__, 'pg_query_ruby_freebsd.sym')
elsif RUBY_PLATFORM !~ /cygwin|mswin|mingw|bccwin|wince|emx/
File.join(__dir__, 'pg_query_ruby.sym')
end
# "ruby_abi_version" is a required symbol to be exported on Ruby 3.2+ development releases
# See https://github.com/ruby/ruby/pull/5474 and https://github.com/ruby/ruby/pull/6231
def export_ruby_abi_version
return false if RUBY_PATCHLEVEL >= 0 # Not a development release
m = /(\d+)\.(\d+)/.match(RUBY_VERSION)
return false if m.nil?
major = m[1].to_i
minor = m[2].to_i
major >= 3 && minor >= 2
end

def ext_symbols_filename
name = 'ext_symbols'
name += '_freebsd' if RUBY_PLATFORM =~ /freebsd/
name += '_with_ruby_abi_version' if export_ruby_abi_version
"#{name}.sym"
end

SYMFILE = File.join(__dir__, ext_symbols_filename)

if RUBY_PLATFORM =~ /darwin/
$DLDFLAGS << " -Wl,-exported_symbols_list #{SYMFILE}" unless defined?(::Rubinius)
Expand Down
2 changes: 2 additions & 0 deletions pg_query.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Gem::Specification.new do |s|
s.license = 'BSD-3-Clause'
s.homepage = 'https://github.com/pganalyze/pg_query'

s.required_ruby_version = '>= 3.0'

s.extensions = %w[ext/pg_query/extconf.rb]

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

0 comments on commit 84aa942

Please sign in to comment.