slack-ruby / slack-ruby-bot-server-events

Slack commands, interactive buttons, and events extension for slack-ruby-bot-server.
MIT License
71 stars 10 forks source link

Add Ruby 3 and Mongo 5 to CI #14

Closed crazyoptimist closed 2 years ago

crazyoptimist commented 2 years ago
crazyoptimist commented 2 years ago

@dblock

dblock commented 2 years ago

@dblock

  • Failed to figure out Ruby 3 with postgresql, guess it has something to do with passing yaml file differently according to ruby3 upgrade, but couldn't figure it out so far.

The interface for YAML.safe_load is different in whatever ships with Ruby 3.1.1, copy-paste https://github.com/slack-ruby/slack-ruby-bot-server/blob/7623dcd9176ac8a85fb3154378baa298f45c40ac/spec/database_adapters/activerecord/activerecord.rb.

  • Failed to fix Danger failure, please check the workflow file if I'm missing something.

Not sure what its problem is, I gave it its own Gemfile like in slack-ruby-bot-server and it worked, https://github.com/slack-ruby/slack-ruby-bot-server-events/pull/15.

crazyoptimist commented 2 years ago

The interface for YAML.safe_load is different in whatever ships with Ruby 3.1.1, copy-paste https://github.com/slack-ruby/slack-ruby-bot-server/blob/7623dcd9176ac8a85fb3154378baa298f45c40ac/spec/database_adapters/activerecord/activerecord.rb.

I tried it already and failed. But let me try again.

dangerpr-bot commented 2 years ago
1 Message
:book: We really appreciate pull requests that demonstrate issues, even without a fix. That said, the next step is to try and fix the failing tests!

Generated by :no_entry_sign: Danger

dblock commented 2 years ago

The interface for YAML.safe_load is different in whatever ships with Ruby 3.1.1, copy-paste https://github.com/slack-ruby/slack-ruby-bot-server/blob/7623dcd9176ac8a85fb3154378baa298f45c40ac/spec/database_adapters/activerecord/activerecord.rb.

I tried it already and failed. But let me try again.

Show me a failure if you're still having trouble.

Add a CHANGELOG saying "Added support for Ruby 3.1." when both mongodb/postgresql work.

crazyoptimist commented 2 years ago
An error occurred while loading ./spec/slack-ruby-bot-server-events/version_spec.rb.
Failure/Error: ActiveRecord::Tasks::DatabaseTasks.create(db_config)

ArgumentError:
  wrong number of arguments (given 3, expected 2)
crazyoptimist commented 2 years ago

db_config is parsed correctly as I tried to print out:

{"adapter"=>"postgresql", "pool"=>10, "timeout"=>5000, "encoding"=>"unicode", "database"=>"slack_ruby_bot_server_events_test", "url"=>"postgresql://test:password@localhost/slack_ruby_bot_server_events_test"}
crazyoptimist commented 2 years ago

Something to do with this one maybe?
https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

But curious I just copied it from slack-ruby-bot-server which works without issues

dblock commented 2 years ago

Something to do with this one maybe? https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

But curious I just copied it from slack-ruby-bot-server which works without issues

If you look at the call stack of that error you'll notice that it's bringing in ActiveRecord 5 and errors like so.

An error occurred while loading ./spec/slack-ruby-bot-server-events/api/endpoints/slack/actions_endpoint_spec.rb.
Failure/Error: ActiveRecord::Tasks::DatabaseTasks.create(db_config)

ArgumentError:
  wrong number of arguments (given 3, expected 2)
# /Users/dblock/.rvm/gems/ruby-3.1.1/gems/activerecord-5.0.7.2/lib/active_record/type/adapter_specific_registry.rb:7:in `add_modifier'
# /Users/dblock/.rvm/gems/ruby-3.1.1/gems/activerecord-5.0.7.2/lib/active_record/type.rb:22:in `add_modifier'

ActiveRecord 5 is just not compatible with this version of Ruby anymore, so we should just let bundler pick compatible versions. Then, once you move it up to 6, there are more problems that can be fixed the same way as slack-ruby-bot-server. Change this in Gemfile:

when 'activerecord' then
  gem 'activerecord'
  gem 'otr-activerecord'
  gem 'virtus'
  gem 'cursor_pagination', github: 'dblock/cursor_pagination', branch: 'misc' # rubocop:disable Bundler/OrderedGems
  gem 'pg'
crazyoptimist commented 2 years ago

I didn't know bundler was smart to pick compatible versions. Thanks!!

crazyoptimist commented 2 years ago

Danger yells again this time, everything else is passing! @dblock

crazyoptimist commented 2 years ago

CI log doesn't give any clue for why danger failed :(

dblock commented 2 years ago

It does, see above: https://github.com/slack-ruby/slack-ruby-bot-server-events/pull/14#issuecomment-1075396697

I am guessing those dates are wrong (should be year/...)? Not sure why it didn't complain before, probably because some dependent gem got updated and it's now seeing these problems?

Change #### 0.3.1 (2/4/2021) to #### 0.3.1 (2021/04/02)

dblock commented 2 years ago

@CrazyOptimist If you have time, take a look at https://github.com/slack-ruby/slack-ruby-bot-server/issues/148