Skip to content

Commit

Permalink
Add Rails 7.0 and 7.1 to the test matrix (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuczynski authored Oct 18, 2023
1 parent d25870d commit 432a6a0
Show file tree
Hide file tree
Showing 110 changed files with 2,135 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,31 @@ appraise 'rails-6.1' do
gem 'psych', '>= 4'
end

# Temporarily exclude Truffleruby and JRuby from testing in Rails 7.x until they fix the issues upstream.
# See https://github.com/rubyconfig/config/pull/344#issuecomment-1766209753
# if (RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '2.7') || RUBY_ENGINE != 'ruby'
if RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '2.7'
appraise 'rails-7.0' do
gem 'activerecord-jdbcsqlite3-adapter', '~> 70.1', platform: :jruby
gem 'sqlite3', '~> 1.6.4', platform: :ruby
gem 'bootsnap', '>= 1.4.4'
gem 'rails', '7.0.8'
gem 'rspec-rails', '~> 6.0.3'
gem 'sprockets-rails', '~> 3.4.2'
gem 'psych', '>= 4'
end

appraise 'rails-7.1' do
gem 'activerecord-jdbcsqlite3-adapter', '~> 70.1', platform: :jruby
gem 'sqlite3', '~> 1.6.6', platform: :ruby
gem 'bootsnap', '>= 1.16.0'
gem 'rails', '7.1.0'
gem 'rspec-rails', '~> 6.0.3'
gem 'sprockets-rails', '~> 3.4.2'
gem 'psych', '>= 4'
end
end

appraise 'sinatra' do
gem 'sinatra', '2.0.8.1'
end
13 changes: 13 additions & 0 deletions gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord-jdbcsqlite3-adapter", "~> 70.1", platform: :jruby
gem "sqlite3", "~> 1.6.4", platform: :ruby
gem "bootsnap", ">= 1.4.4"
gem "rails", "7.0.8"
gem "rspec-rails", "~> 6.0.3"
gem "sprockets-rails", "~> 3.4.2"
gem "psych", ">= 4"

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

source "https://rubygems.org"

gem "activerecord-jdbcsqlite3-adapter", "~> 70.1", platform: :jruby
gem "sqlite3", "~> 1.6.6", platform: :ruby
gem "bootsnap", ">= 1.16.0"
gem "rails", "7.1.0"
gem "rspec-rails", "~> 6.0.3"
gem "sprockets-rails", "~> 3.4.2"
gem "psych", ">= 4"

gemspec path: "../"
7 changes: 7 additions & 0 deletions spec/app/rails_7.0/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.

# Mark the database schema as having been generated.
db/schema.rb linguist-generated

# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
35 changes: 35 additions & 0 deletions spec/app/rails_7.0/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-*

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore uploaded files in development.
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep

/public/assets

# Ignore master key for decrypting credentials and more.
/config/master.key
1 change: 1 addition & 0 deletions spec/app/rails_7.0/.ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby-3.2.2
72 changes: 72 additions & 0 deletions spec/app/rails_7.0/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.2.2"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.8"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

# Use sqlite3 as the database for Active Record
gem "sqlite3", "~> 1.4"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"

# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"

# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

# Use Sass to process CSS
# gem "sassc-rails"

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri mingw x64_mingw ]
end

group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"

# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
# gem "rack-mini-profiler"

# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
end

group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "selenium-webdriver"

end
24 changes: 24 additions & 0 deletions spec/app/rails_7.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# README

This README would normally document whatever steps are necessary to get the
application up and running.

Things you may want to cover:

* Ruby version

* System dependencies

* Configuration

* Database creation

* Database initialization

* How to run the test suite

* Services (job queues, cache servers, search engines, etc.)

* Deployment instructions

* ...
6 changes: 6 additions & 0 deletions spec/app/rails_7.0/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative "config/application"

Rails.application.load_tasks
2 changes: 2 additions & 0 deletions spec/app/rails_7.0/app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//= link_tree ../images
//= link_directory ../stylesheets .css
15 changes: 15 additions & 0 deletions spec/app/rails_7.0/app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/
4 changes: 4 additions & 0 deletions spec/app/rails_7.0/app/channels/application_cable/channel.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
2 changes: 2 additions & 0 deletions spec/app/rails_7.0/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ApplicationController < ActionController::Base
end
2 changes: 2 additions & 0 deletions spec/app/rails_7.0/app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module ApplicationHelper
end
7 changes: 7 additions & 0 deletions spec/app/rails_7.0/app/jobs/application_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked

# Most jobs are safe to ignore if the underlying records are no longer available
# discard_on ActiveJob::DeserializationError
end
4 changes: 4 additions & 0 deletions spec/app/rails_7.0/app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: "[email protected]"
layout "mailer"
end
3 changes: 3 additions & 0 deletions spec/app/rails_7.0/app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
end
15 changes: 15 additions & 0 deletions spec/app/rails_7.0/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Rails70</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>

<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
</head>

<body>
<%= yield %>
</body>
</html>
13 changes: 13 additions & 0 deletions spec/app/rails_7.0/app/views/layouts/mailer.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
/* Email styles need to be inline */
</style>
</head>

<body>
<%= yield %>
</body>
</html>
1 change: 1 addition & 0 deletions spec/app/rails_7.0/app/views/layouts/mailer.text.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= yield %>
4 changes: 4 additions & 0 deletions spec/app/rails_7.0/bin/rails
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path("../config/application", __dir__)
require_relative "../config/boot"
require "rails/commands"
4 changes: 4 additions & 0 deletions spec/app/rails_7.0/bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env ruby
require_relative "../config/boot"
require "rake"
Rake.application.run
33 changes: 33 additions & 0 deletions spec/app/rails_7.0/bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env ruby
require "fileutils"

# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end

FileUtils.chdir APP_ROOT do
# This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.

puts "== Installing dependencies =="
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")

# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
# end

puts "\n== Preparing database =="
system! "bin/rails db:prepare"

puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"

puts "\n== Restarting application server =="
system! "bin/rails restart"
end
6 changes: 6 additions & 0 deletions spec/app/rails_7.0/config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file is used by Rack-based servers to start the application.

require_relative "config/environment"

run Rails.application
Rails.application.load_server
22 changes: 22 additions & 0 deletions spec/app/rails_7.0/config/application.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require_relative "boot"

require "rails/all"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Rails70
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0

# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
end
end
4 changes: 4 additions & 0 deletions spec/app/rails_7.0/config/boot.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

require "bundler/setup" # Set up gems listed in the Gemfile.
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
10 changes: 10 additions & 0 deletions spec/app/rails_7.0/config/cable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
development:
adapter: async

test:
adapter: test

production:
adapter: redis
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix: rails_7_0_production
1 change: 1 addition & 0 deletions spec/app/rails_7.0/config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
runqm+roryWrkk0F/sVZW0qvIaKaHm59Xm/GmayLuXyXDZZyYqgLk9aAUgAI2s+P7jm9Gd6R/iTD2JzIgpnuSkXVgwvSdqJmsfNvBpPXqybV47N/wShIPrz0wVLhMd3GxxpPU78E9qjPrwGy4Bet4kTqpcYD4yCSor1Xk5t2CuW7AXRY6Upu8kAGvnboh4Ti4GBS0/vF9/60PcbOBgUeKoODER+Fu+G6kJyWnm+IZ5Qa/OJDOAEWcxE94Q+ROZJCpECFluqbiS9AheAgYlaxNvMV0JUnwlsHeYiZ25pXoKQDgVNX9kiDmnCeMA/37XGc8sfGrItDGtgCs+EPNY3vQdjbmYUKHMQOe6oGMT1FD7mROGz/UTX+uD99GnwD4mD8ZIaSIZNhRAXM9K+RZNgBQ638h01pHQvJRFw2--1Vs5gdueN+4mgih/--g7BjaCFISMqxM8wBagNNHw==
Loading

0 comments on commit 432a6a0

Please sign in to comment.