From 08562f075cef192036637017beafa6114dcb6e80 Mon Sep 17 00:00:00 2001 From: kg8m Date: Thu, 28 Dec 2023 00:13:20 +0900 Subject: [PATCH 1/4] create branch From e0148a2cb99db41dec31ccd44026afe2fc9fd21a Mon Sep 17 00:00:00 2001 From: kg8m Date: Thu, 28 Dec 2023 00:19:28 +0900 Subject: [PATCH 2/4] Support Ruby 3.3 --- .github/workflows/checks.yml | 7 ++++--- .github/workflows/dependabot-autolabeling.yml | 2 +- .github/workflows/update-rbs-collection.yml | 2 +- sig/patch/english.rbs | 2 +- sig/patch/pty.rbs | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index c9f1d91..987f7d6 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -15,6 +15,7 @@ jobs: ruby-version: - "3.1" - "3.2" + - "3.3" rails-version: - "~> 7.0.0" - "~> 7.1.0" @@ -61,7 +62,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.2" + ruby-version: "3.3" bundler-cache: true - name: RuboCop @@ -79,7 +80,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.2" + ruby-version: "3.3" bundler-cache: true - name: Run typecheck @@ -99,7 +100,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.2" + ruby-version: "3.3" bundler-cache: true - name: Check YARD docs diff --git a/.github/workflows/dependabot-autolabeling.yml b/.github/workflows/dependabot-autolabeling.yml index b93c41e..4182fd5 100644 --- a/.github/workflows/dependabot-autolabeling.yml +++ b/.github/workflows/dependabot-autolabeling.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.2" + ruby-version: "3.3" bundler-cache: true - name: Fetch Dependabot metadata diff --git a/.github/workflows/update-rbs-collection.yml b/.github/workflows/update-rbs-collection.yml index 7bba8fa..2d5c4fb 100644 --- a/.github/workflows/update-rbs-collection.yml +++ b/.github/workflows/update-rbs-collection.yml @@ -19,7 +19,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.2" + ruby-version: "3.3" bundler-cache: true - name: Generate token diff --git a/sig/patch/english.rbs b/sig/patch/english.rbs index f77bf5f..b49fa6d 100644 --- a/sig/patch/english.rbs +++ b/sig/patch/english.rbs @@ -1,3 +1,3 @@ -# https://ruby-doc.org/3.2.2/stdlibs/English/English.html +# https://ruby-doc.org/3.3.0/stdlibs/English/English.html # https://docs.ruby-lang.org/ja/latest/method/Kernel/v/CHILD_STATUS.html $CHILD_STATUS: Process::Status | nil diff --git a/sig/patch/pty.rbs b/sig/patch/pty.rbs index 92e37d0..217ffec 100644 --- a/sig/patch/pty.rbs +++ b/sig/patch/pty.rbs @@ -1,4 +1,4 @@ -# https://ruby-doc.org/3.2.2/exts/pty/PTY.html +# https://ruby-doc.org/3.3.0/exts/pty/PTY.html module PTY def self.spawn: (String command) { (IO r, IO w, Integer pid) -> void } -> void end From 84bea8587712a9cfbdb4d47c628cd83b5b16faf8 Mon Sep 17 00:00:00 2001 From: kg8m Date: Thu, 28 Dec 2023 00:19:41 +0900 Subject: [PATCH 3/4] Remove arch-specific Nokogiri and SQLite3 from `Gemfile.lock` Prevent errors as follows: ``` nokogiri-1.15.5-arm64-darwin requires ruby version < 3.3.dev, >= 2.7, which is incompatible with the current version, 3.3.0 ``` ``` sqlite3-1.6.9-arm64-darwin requires ruby version < 3.3.dev, >= 2.7, which is incompatible with the current version, 3.3.0 ``` --- Gemfile.lock | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2feb81e..1d47d2a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -143,12 +143,6 @@ GEM nokogiri (1.15.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.15.5-arm64-darwin) - racc (~> 1.4) - nokogiri (1.15.5-x86_64-darwin) - racc (~> 1.4) - nokogiri (1.15.5-x86_64-linux) - racc (~> 1.4) paint (2.3.0) parallel (1.24.0) parser (3.2.2.4) @@ -279,9 +273,6 @@ GEM sprockets (>= 3.0.0) sqlite3 (1.6.9) mini_portile2 (~> 2.8.0) - sqlite3 (1.6.9-arm64-darwin) - sqlite3 (1.6.9-x86_64-darwin) - sqlite3 (1.6.9-x86_64-linux) steep (1.6.0) activesupport (>= 5.1) concurrent-ruby (>= 1.1.10) From 270437a74528ebc14facef910bfc096079ac7d7a Mon Sep 17 00:00:00 2001 From: kg8m Date: Thu, 28 Dec 2023 00:20:38 +0900 Subject: [PATCH 4/4] Fix test failures for `NoMethodError` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` Failure/Error: expect { tanshuku_url.shortened_url }.to raise_error( NoMethodError, "undefined method `merge' for nil:NilClass" ) expected NoMethodError with "undefined method `merge' for nil:NilClass", got # with backtrace: # ./app/models/tanshuku/url.rb:176:in `shortened_url' # ./spec/models/tanshuku/url_spec.rb:1131:in `block (6 levels) in ' # ./spec/models/tanshuku/url_spec.rb:1131:in `block (5 levels) in ' # ./spec/models/tanshuku/url_spec.rb:1131:in `block (5 levels) in ' ``` Ruby 3.3 doesn’t show inspected object on `NoMethodError`. --- spec/models/tanshuku/url_spec.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/spec/models/tanshuku/url_spec.rb b/spec/models/tanshuku/url_spec.rb index ce8154e..2e9a377 100644 --- a/spec/models/tanshuku/url_spec.rb +++ b/spec/models/tanshuku/url_spec.rb @@ -1128,10 +1128,7 @@ context "and url_options isn’t given" do it "raises NoMethodError due to `nil.merge`" do - expect { tanshuku_url.shortened_url }.to raise_error( - NoMethodError, - "undefined method `merge' for nil:NilClass" - ) + expect { tanshuku_url.shortened_url }.to raise_error(NoMethodError, /\bundefined method `merge' for nil\b/) end end @@ -1141,7 +1138,7 @@ it "raises NoMethodError due to `nil.merge`" do expect { tanshuku_url.shortened_url(url_options) }.to raise_error( NoMethodError, - "undefined method `merge' for nil:NilClass" + /\bundefined method `merge' for nil\b/ ) end end