Skip to content

Commit

Permalink
Add Rails 8 to build
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Nov 8, 2024
1 parent 72d59aa commit 92db634
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
ruby-version: '3.3'
- run: script/update_rubygems_and_install_bundler
- run: bundle install --standalone
- run: bundle binstubs --all
Expand All @@ -44,6 +44,14 @@ jobs:
env:
RAILS_VERSION: 'main'

# Rails 8.0 builds >= 3.2
- ruby: 3.3
env:
RAILS_VERSION: '~> 8.0.0'
- ruby: 3.2
env:
RAILS_VERSION: '~> 8.0.0'

# Rails 7.2 builds >= 3.1
- ruby: 3.3
env:
Expand Down
23 changes: 8 additions & 15 deletions Gemfile-rails-dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ def add_net_gems_dependency
end
end

def add_sqlite3_gem_dependency
# sqlite3 is an optional, unspecified, dependency and Rails 6.0 only supports `~> 1.4`
def add_sqlite3_gem_dependency(rails_version)
# sqlite3 is an optional, unspecified, dependency and Rails 8.0 only supports `~> 2.0`
if RUBY_VERSION.to_f < 3
# sqlite3 1.7.x doesn't work on all platforms for Ruby 2.x
gem 'sqlite3', '~> 1.4', '< 1.7', platforms: [:ruby]
elsif rails_version.to_f >= 8
gem 'sqlite3', '~> 2.0', platforms: [:ruby]
else
gem 'sqlite3', '~> 1.4', platforms: [:ruby]
gem 'sqlite3', '~> 1.7', platforms: [:ruby]
end
end

Expand All @@ -29,21 +31,12 @@ when /main/
gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', platforms: [:jruby]
gem 'selenium-webdriver', require: false

# Rails 8 requires 2.0.0
gem 'sqlite3', '~> 2.0', platforms: [:ruby]
when /stable$/
gem_list = %w[rails railties actionmailer actionpack activerecord activesupport activejob actionview]
gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', platforms: [:jruby]

gem_list.each do |rails_gem|
gem rails_gem, :git => "https://github.com/rails/rails.git", :branch => version
end
add_sqlite3_gem_dependency
when nil, false, ""
gem "rails", "~> 7.0.0"
gem "rails", "~> 8.0.0"
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
gem 'selenium-webdriver', require: false
add_sqlite3_gem_dependency
gem 'sqlite3', '~> 2.0', platforms: [:ruby]
else
version_number = version.split(' ').last
add_net_gems_dependency if version_number < '7.0'
Expand All @@ -58,5 +51,5 @@ else
else
gem 'selenium-webdriver', require: false
end
add_sqlite3_gem_dependency
add_sqlite3_gem_dependency(version_number)
end
2 changes: 1 addition & 1 deletion example_app_generator/generate_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
elsif Rails::VERSION::STRING > '8'
gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 2.0'"
else
gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.4'"
gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.7'"
end

# remove webdrivers
Expand Down

0 comments on commit 92db634

Please sign in to comment.