Skip to content

Commit e48f77f

Browse files
authored
Ruby 4.0.1 + publishable platform gems for Ruby 4.0 (#154)
* Pin Ruby 4.0.1 and align CI with .ruby-version Use .ruby-version as the single source of truth for typecheck and release jobs, and add a CI job that runs the suite on the pinned patch version. * Build versioned native extension paths for Ruby 3.2-4.0 Install the compiled extension into lib/code_ownership/<major.minor>/ so cross-gem can package multiple Ruby minors into a single platform gem without overwriting. * Ignore build artifacts in RuboCop and Sorbet Exclude tmp/ and target/ from static analysis to avoid scanning vendored/compiled build outputs. * Narrow gitignore for versioned native extension dirs Only ignore lib/code_ownership/<major.minor>/ so new Ruby source files under lib/code_ownership/* aren't accidentally hidden. * Cap required_ruby_version at Ruby 4.0 This gem ships native binaries through Ruby 4.0, so restrict installs to < 4.1.dev until we add 4.1 builds and CI coverage. * Bump 2.1.1
1 parent ff7f05b commit e48f77f

File tree

10 files changed

+35
-8
lines changed

10 files changed

+35
-8
lines changed

.github/workflows/cd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
- uses: ruby/setup-ruby@v1
4545
with:
46-
ruby-version: "3.4"
46+
ruby-version-file: .ruby-version
4747

4848
- uses: oxidize-rb/actions/cross-gem@v1
4949
id: cross-gem
@@ -88,7 +88,7 @@
8888

8989
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
9090
with:
91-
ruby-version: "3.4"
91+
ruby-version-file: .ruby-version
9292
bundler-cache: true
9393
cargo-cache: false
9494

.github/workflows/ci.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ jobs:
4040
run: bundle exec rake
4141
- name: Compile rust ext
4242
run: bundle exec rake compile:release
43+
44+
rspec_ruby_version_file:
45+
name: "RSpec (ruby-version-file)"
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
50+
with:
51+
ruby-version-file: .ruby-version
52+
rustup-toolchain: stable
53+
bundler-cache: true
54+
cargo-cache: false
55+
- name: Run ruby tests
56+
run: bundle exec rake
57+
- name: Compile rust ext
58+
run: bundle exec rake compile:release
4359
static_type_check:
4460
name: "Type Check"
4561
runs-on: ubuntu-latest
@@ -49,7 +65,7 @@ jobs:
4965
uses: ruby/setup-ruby@v1
5066
with:
5167
bundler-cache: true
52-
ruby-version: 3.3
68+
ruby-version-file: .ruby-version
5369
- name: Run static type checks
5470
run: bundle exec srb tc
5571
notify_on_failure:

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
/target/
1010
/vendor
1111

12+
# Locally-built native extensions (installed into versioned directories)
13+
# Keep this narrowly scoped so we don't accidentally ignore real Ruby source dirs
14+
# like lib/code_ownership/private/.
15+
/lib/code_ownership/[0-9]*.[0-9]*/
16+
1217
Gemfile.lock
1318

1419
# rspec failure tracking

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ AllCops:
1212
NewCops: enable
1313
Exclude:
1414
- vendor/bundle/**/**
15+
- tmp/**/**
16+
- target/**/**
1517
TargetRubyVersion: 3.2
1618

1719
Metrics/ParameterLists:

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.4.5
1+
4.0.1

code_ownership.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
2121
'public gem pushes.'
2222
end
2323

24-
spec.required_ruby_version = '>= 3.2'
24+
spec.required_ruby_version = Gem::Requirement.new('>= 3.2', '< 4.1.dev')
2525

2626
# https://guides.rubygems.org/make-your-own-gem/#adding-an-executable
2727
# and

ext/code_ownership/extconf.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
require 'mkmf'
44
require 'rb_sys/mkmf'
55

6-
create_rust_makefile('code_ownership/code_ownership') do |ext|
6+
ruby_minor = RUBY_VERSION[/\d+\.\d+/]
7+
create_rust_makefile("code_ownership/#{ruby_minor}/code_ownership") do |ext|
78
ext.extra_cargo_args += ['--crate-type', 'cdylib']
89
ext.extra_cargo_args += ['--package', 'code_ownership']
910
end

lib/code_ownership/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# frozen_string_literal: true
33

44
module CodeOwnership
5-
VERSION = '2.1.0'
5+
VERSION = '2.1.1'
66
end

rakelib/compile.rake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'rb_sys/extensiontask'
22

33
RbSys::ExtensionTask.new('code_ownership', GEMSPEC) do |ext|
4-
ext.lib_dir = 'lib/code_ownership'
4+
ruby_minor = RUBY_VERSION[/\d+\.\d+/]
5+
ext.lib_dir = "lib/code_ownership/#{ruby_minor}"
56
end

sorbet/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
--dir=.
22
--ignore=/spec
3+
--ignore=/tmp
4+
--ignore=/target
35
--ignore=/vendor/bundle

0 commit comments

Comments
 (0)