GitHub Actions CI - Gem/Rails Engine - Ruby v3.3.1/Bundler エラー

概要

私は Ruby gem / Rails エンジン、blacklight_allmaps を作成し、CI に GitHub Actions を使用しています。昨日、Ruby v3.2 のテスト ビルドは問題なく合格しましたが、Ruby v3.3 のテストは奇妙なエラーで失敗し始めました。

Could not find gems matching 'blacklight_allmaps (= 0.2.0)' valid for all
resolution platforms () in source at
`/home/runner/work/blacklight-allmaps/blacklight-allmaps`.
The source contains the following gems matching 'blacklight_allmaps (= 0.2.0)':
  * blacklight_allmaps-0.2.0
Done generating test app
/opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/resolver.rb:336:in `raise_not_found!': Could not find gems matching 'blacklight_allmaps (= 0.2.0)' valid for all resolution platforms () in source at `/home/runner/work/blacklight-allmaps/blacklight-allmaps`. (Bundler::GemNotFound)
The source contains the following gems matching 'blacklight_allmaps (= 0.2.0)':
  * blacklight_allmaps-0.2.0
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/definition.rb:613:in `block in materialize'
    from <internal:kernel>:187:in `loop'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/definition.rb:600:in `materialize'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/definition.rb:203:in `specs'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/definition.rb:270:in `specs_for'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/runtime.rb:18:in `setup'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler.rb:162:in `setup'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/setup.rb:26:in `block in <top (required)>'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/ui/shell.rb:159:in `with_level'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/ui/shell.rb:111:in `silence'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/setup.rb:26:in `<top (required)>'
    from <internal:/opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
    from <internal:/opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/rubygems.rb:1382:in `<top (required)>'
    from <internal:gem_prelude>:2:in `require'
    from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
/opt/hostedtoolcache/Ruby/3.3.1/x64/bin/ruby -I/opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.0/lib:/opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/gems/3.3.0/gems/rspec-support-3.13.1/lib /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
/opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/resolver.rb:336:in `raise_not_found!': Could not find gems matching 'blacklight_allmaps (= 0.2.0)' valid for all resolution platforms () in source at `/home/runner/work/blacklight-allmaps/blacklight-allmaps`. (Bundler::GemNotFound)
The source contains the following gems matching 'blacklight_allmaps (= 0.2.0)':
  * blacklight_allmaps-0.2.0
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/definition.rb:613:in `block in materialize'
    from <internal:kernel>:187:in `loop'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/definition.rb:600:in `materialize'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/definition.rb:203:in `specs'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/definition.rb:270:in `specs_for'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/runtime.rb:18:in `setup'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler.rb:162:in `setup'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/setup.rb:26:in `block in <top (required)>'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/ui/shell.rb:159:in `with_level'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/ui/shell.rb:111:in `silence'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/bundler/setup.rb:26:in `<top (required)>'
    from <internal:/opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
    from <internal:/opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
    from /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/3.3.0/rubygems.rb:1382:in `<top (required)>'
    from <internal:gem_prelude>:2:in `require'
    from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
/opt/hostedtoolcache/Ruby/3.3.1/x64/bin/ruby -I/opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.0/lib:/opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/gems/3.3.0/gems/rspec-support-3.13.1/lib /opt/hostedtoolcache/Ruby/3.3.1/x64/lib/ruby/gems/3.3.0/gems/rspec-core-3.13.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed

CI に合格した 2 週間前のテスト ビルドを再実行すると、同じエラーで失敗するようになりました: https://github.com/bplmaps/blacklight-allmaps/actions/runs/8668487468

これはおそらく、最近の Ruby v3.3.1 および Bundler v2.5.9 リリースに関連しているようですが、Ruby を v3.3.0 に、Bundler を v2.5.5 に固定しようとしても、依然として同じエラーが表示されます。

何か提案がある人はいますか?トラブルシューティングの方法についてアイデアが不足しています。

Ruby v3.3.0 および Blunder v2.5.5 にロールバックしようとしましたが、このエラーは依然として発生します。

解決策

CI ワークフローのバンドルにプラットフォームを強制的に組み込むことで、この問題は解決されました。

GitHub Actions CI ワークフロー ファイルに、「プラットフォーム バージョンをロック」エントリを追加しました。

...
      - name: Lock platform version
        run: bundle lock --add-platform ruby
      - name: Install dependencies
        run: bundle install
...

この変更を適用すると、Ruby v3.3.1 には使用できるバンドル プラットフォームが追加され、その後、私が作成しているローカルの blacklight_allmaps gem が解決されます。

なぜこれが必要なのか正確にはわかりません…これは私にとって Ruby チェーンのかなり上の方にありますが、これによりビルドが完成し、テストが適切に実行されるようになります。

私が勝ちを取ります。