diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 07a80fb..87285c1 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -43,7 +43,7 @@ - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.4" + ruby-version-file: .ruby-version - uses: oxidize-rb/actions/cross-gem@v1 id: cross-gem @@ -88,7 +88,7 @@ - uses: oxidize-rb/actions/setup-ruby-and-rust@v1 with: - ruby-version: "3.4" + ruby-version-file: .ruby-version bundler-cache: true cargo-cache: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad553f9..376d949 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,22 @@ jobs: run: bundle exec rake - name: Compile rust ext run: bundle exec rake compile:release + + rspec_ruby_version_file: + name: "RSpec (ruby-version-file)" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: oxidize-rb/actions/setup-ruby-and-rust@v1 + with: + ruby-version-file: .ruby-version + rustup-toolchain: stable + bundler-cache: true + cargo-cache: false + - name: Run ruby tests + run: bundle exec rake + - name: Compile rust ext + run: bundle exec rake compile:release static_type_check: name: "Type Check" runs-on: ubuntu-latest @@ -49,7 +65,7 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - ruby-version: 3.3 + ruby-version-file: .ruby-version - name: Run static type checks run: bundle exec srb tc notify_on_failure: diff --git a/.gitignore b/.gitignore index 93bf3b3..8cafb89 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,11 @@ /target/ /vendor +# Locally-built native extensions (installed into versioned directories) +# Keep this narrowly scoped so we don't accidentally ignore real Ruby source dirs +# like lib/code_ownership/private/. +/lib/code_ownership/[0-9]*.[0-9]*/ + Gemfile.lock # rspec failure tracking diff --git a/.rubocop.yml b/.rubocop.yml index 6f345ad..4a24fc7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,6 +12,8 @@ AllCops: NewCops: enable Exclude: - vendor/bundle/**/** + - tmp/**/** + - target/**/** TargetRubyVersion: 3.2 Metrics/ParameterLists: diff --git a/.ruby-version b/.ruby-version index 4f5e697..1454f6e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.4.5 +4.0.1 diff --git a/code_ownership.gemspec b/code_ownership.gemspec index 282940c..8b27e9d 100644 --- a/code_ownership.gemspec +++ b/code_ownership.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| 'public gem pushes.' end - spec.required_ruby_version = '>= 3.2' + spec.required_ruby_version = Gem::Requirement.new('>= 3.2', '< 4.1.dev') # https://guides.rubygems.org/make-your-own-gem/#adding-an-executable # and diff --git a/ext/code_ownership/extconf.rb b/ext/code_ownership/extconf.rb index 60ca23a..d15d818 100644 --- a/ext/code_ownership/extconf.rb +++ b/ext/code_ownership/extconf.rb @@ -3,7 +3,8 @@ require 'mkmf' require 'rb_sys/mkmf' -create_rust_makefile('code_ownership/code_ownership') do |ext| +ruby_minor = RUBY_VERSION[/\d+\.\d+/] +create_rust_makefile("code_ownership/#{ruby_minor}/code_ownership") do |ext| ext.extra_cargo_args += ['--crate-type', 'cdylib'] ext.extra_cargo_args += ['--package', 'code_ownership'] end diff --git a/lib/code_ownership/version.rb b/lib/code_ownership/version.rb index 1b99d6e..4b66e08 100644 --- a/lib/code_ownership/version.rb +++ b/lib/code_ownership/version.rb @@ -2,5 +2,5 @@ # frozen_string_literal: true module CodeOwnership - VERSION = '2.1.0' + VERSION = '2.1.1' end diff --git a/rakelib/compile.rake b/rakelib/compile.rake index e8a3e11..ee9efa9 100644 --- a/rakelib/compile.rake +++ b/rakelib/compile.rake @@ -1,5 +1,6 @@ require 'rb_sys/extensiontask' RbSys::ExtensionTask.new('code_ownership', GEMSPEC) do |ext| - ext.lib_dir = 'lib/code_ownership' + ruby_minor = RUBY_VERSION[/\d+\.\d+/] + ext.lib_dir = "lib/code_ownership/#{ruby_minor}" end diff --git a/sorbet/config b/sorbet/config index 26caf17..f5e49d9 100644 --- a/sorbet/config +++ b/sorbet/config @@ -1,3 +1,5 @@ --dir=. --ignore=/spec +--ignore=/tmp +--ignore=/target --ignore=/vendor/bundle