Skip to content

Commit

Permalink
Test with Rails main (#207)
Browse files Browse the repository at this point in the history
This adds gemfiles for Rails `main` branch so that CI can provide early
warnings regarding compatibility with the upcoming version of Rails.
The corresponding `Gemfile.lock` files are excluded from version control
since they would quickly become stale.
  • Loading branch information
jonathanhefner authored Jan 1, 2024
1 parent 3f8980c commit f6760ac
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ jobs:
- Gemfile
- gemfiles/rails_7_0_propshaft.gemfile
- gemfiles/rails_7_1_propshaft.gemfile
- gemfiles/rails_main_propshaft.gemfile
- gemfiles/rails_7_0_sprockets.gemfile
- gemfiles/rails_7_1_sprockets.gemfile
- gemfiles/rails_main_sprockets.gemfile
continue-on-error: [ false ]

name: ${{ format('Tests (Ruby {0}, {1})', matrix.ruby-version, matrix.gemfile) }}
Expand All @@ -30,7 +32,7 @@ jobs:

- name: Remove Gemfile lock
run: |
rm $BUNDLE_GEMFILE.lock
rm -f $BUNDLE_GEMFILE.lock
- name: Install Ruby
uses: ruby/setup-ruby@v1
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
/test/dummy/public/assets
.byebug_history
*.gem

# Ignore Gemfile.lock files for Rails main branch.
/gemfiles/rails_main*.gemfile.lock
10 changes: 10 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,13 @@ appraise "rails_7_1_propshaft" do
gem "rails", "~> 7.1.0"
gem "propshaft"
end

appraise "rails_main_sprockets" do
gem "rails", github: "rails/rails", branch: "main"
gem "sprockets-rails"
end

appraise "rails_main_propshaft" do
gem "rails", github: "rails/rails", branch: "main"
gem "propshaft"
end
23 changes: 23 additions & 0 deletions gemfiles/rails_main_propshaft.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", branch: "main", git: "https://github.com/rails/rails.git"
gem "sqlite3"
gem "propshaft"

group :development do
gem "appraisal"
end

group :test do
gem "turbo-rails"
gem "stimulus-rails"
gem "byebug"
gem "rexml"
gem "capybara"
gem "selenium-webdriver"
gem "webdrivers"
end

gemspec path: "../"
23 changes: 23 additions & 0 deletions gemfiles/rails_main_sprockets.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", branch: "main", git: "https://github.com/rails/rails.git"
gem "sqlite3"
gem "sprockets-rails"

group :development do
gem "appraisal"
end

group :test do
gem "turbo-rails"
gem "stimulus-rails"
gem "byebug"
gem "rexml"
gem "capybara"
gem "selenium-webdriver"
gem "webdrivers"
end

gemspec path: "../"
4 changes: 4 additions & 0 deletions test/installer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def with_new_rails_app
gemfile = File.read("Gemfile")
gemfile.gsub!(/^gem "importmap-rails".*/, "")
gemfile << %(gem "importmap-rails", path: #{File.expand_path("..", __dir__).inspect}\n)
if Rails::VERSION::PRE == "alpha"
gemfile.gsub!(/^gem "rails".*/, "")
gemfile << %(gem "rails", path: #{Gem.loaded_specs["rails"].full_gem_path.inspect}\n)
end
File.write("Gemfile", gemfile)

run_command("bundle", "install")
Expand Down

0 comments on commit f6760ac

Please sign in to comment.