Closed etagwerker closed 1 year ago
I was just about to post the same question.
In https://github.com/avo-hq/avo/ we want to test the package against a few ruby 2.x versions and 3.0. We are using the https://github.com/ddnexus/pagy gem and they use different versions for ruby 2.x and 3.x.
Thank you for your support!
Not sure how this would work. I am on 2.7 and when I run this script it raises an error that it can't install pagy 4 on ruby <2.7 (the host's ruby).
Just as a clarification pagy 3 is for ruby <3.x and pagy 4 for ruby >=3.0.
["6.0", "6.1"].each do |rails_version|
appraise "rails-#{rails_version}-ruby-2.6" do
gem "rails", "~> #{rails_version}.0"
end
appraise "rails-#{rails_version}-ruby-2.7" do
gem "rails", "~> #{rails_version}.0"
end
appraise "rails-#{rails_version}-ruby-3.0" do
ruby "3.0"
gem "rails", "~> #{rails_version}.0"
gem "pagy", "~> 4.0"
end
end
@etagwerker you can also try https://github.com/thoughtbot/appraisal/pull/176
@adrianthedev you can also try https://github.com/thoughtbot/appraisal/pull/176
My immediate feeling is that #176 would be the right way to do this (I'm going to look at this once I fix several bundler compatibility issues we currently have as I write this).
On projects with multiple Rubies and Appraisal, I typically do this instead: https://github.com/thoughtbot/administrate/blob/main/.circleci/config.yml (see https://github.com/thoughtbot/administrate/pull/1932 for using GitHub Actions instead)
So unlike in your examples, we're running a different Ruby version per container and keep the same Appraisal per Ruby version.
I'm going to close this as it's not moved along in a long time — and hopefully #176 if good enough as a solution for most cases.
Hi there,
First of all thanks a lot for building and maintaining
appraisal
! Secondly, I was wondering if there is a "best practice" for using the gem with multiple rubies?In
rubycritic
we are using this gem but don't want certain rubies to runrake test
withappraisal
because it's a known issue that the gem doesn't have a passing test suite with some combinations ofsimplecov
and ruby 3.0 and ruby 2.4: https://github.com/whitesmith/rubycritic/blob/main/travis_scripts/script.sh#L4-L8I was wondering if you had any suggestions for appraising certain gemfiles with certain rubies.
Maybe it's a matter of documenting this issue in the README.md so it guides users into doing the right thing? Maybe you can set up your CI configuration to do something like this:
I'm not sure if that is possible with the current version.
Another way to support multiple rubies could be something like this:
That way, when you run
bundle exec appraisal rake test
the gem knows what gemsets to appraise based on the current ruby version.Please let me know your thoughts on this.
Thanks!