Skip to content

Commit 19eac9f

Browse files
authored
Add CI Gemfiles for Rails 8.0 (#58)
1 parent 0a012ef commit 19eac9f

File tree

8 files changed

+124
-155
lines changed

8 files changed

+124
-155
lines changed

.github/workflows/rspec.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ jobs:
2828
ruby: '3.3'
2929
- gemfile: rails-7.2-propshaft
3030
ruby: '3.3'
31+
- gemfile: rails-8.0
32+
ruby: '3.3'
33+
- gemfile: rails-8.0-propshaft
34+
ruby: '3.3'
3135
runs-on: ubuntu-latest
3236
env:
3337
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile

gemfiles/rails-7.2-propshaft.gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ group :test do
77
gem "capybara"
88
end
99

10-
gem "rails", "~> 7.2.0.rc1"
10+
gem "rails", "~> 7.2.0"
1111
gem "propshaft"
1212
gem "sqlite3", "~> 1.4"
1313
gem "devise"

gemfiles/rails-7.2.gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ group :test do
77
gem "capybara"
88
end
99

10-
gem "rails", "~> 7.2.0.rc1"
10+
gem "rails", "~> 7.2.0"
1111
gem "sprockets-rails"
1212
gem "sqlite3", "~> 1.4"
1313
gem "devise"

gemfiles/rails-8.0-propshaft.gemfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
source 'https://rubygems.org'
2+
3+
group :test do
4+
gem "rspec-rails"
5+
6+
gem "coveralls_reborn", require: false
7+
gem "capybara"
8+
end
9+
10+
gem "rails", github: "rails/rails", branch: "8-0-stable"
11+
gem "propshaft"
12+
gem "sqlite3"
13+
gem "devise"
14+
15+
gem "trestle", github: "TrestleAdmin/trestle"
16+
17+
gemspec path: "../"

gemfiles/rails-8.0.gemfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
source 'https://rubygems.org'
2+
3+
group :test do
4+
gem "rspec-rails"
5+
6+
gem "coveralls_reborn", require: false
7+
gem "capybara"
8+
end
9+
10+
gem "rails", github: "rails/rails", branch: "8-0-stable"
11+
gem "sprockets-rails"
12+
gem "sqlite3"
13+
gem "devise"
14+
15+
gem "trestle", github: "TrestleAdmin/trestle"
16+
17+
gemspec path: "../"
Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,32 @@
1+
require "active_support/core_ext/integer/time"
2+
13
Rails.application.configure do
24
# Settings specified here will take precedence over those in config/application.rb.
35

4-
# In the development environment your application's code is reloaded on
5-
# every request. This slows down response time but is perfect for development
6-
# since you don't have to restart the web server when you make code changes.
7-
config.cache_classes = false
6+
# Make code changes take effect immediately without server restart.
7+
config.enable_reloading = true
88

99
# Do not eager load code on boot.
1010
config.eager_load = false
1111

1212
# Show full error reports.
1313
config.consider_all_requests_local = true
1414

15-
# Enable/disable caching. By default caching is disabled.
16-
# Run rails dev:cache to toggle caching.
17-
if Rails.root.join('tmp', 'caching-dev.txt').exist?
15+
# Enable server timing.
16+
config.server_timing = true
17+
18+
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
19+
# Run rails dev:cache to toggle Action Controller caching.
20+
if Rails.root.join("tmp/caching-dev.txt").exist?
1821
config.action_controller.perform_caching = true
1922
config.action_controller.enable_fragment_cache_logging = true
20-
21-
config.cache_store = :memory_store
22-
config.public_file_server.headers = {
23-
'Cache-Control' => "public, max-age=#{2.days.to_i}"
24-
}
23+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
2524
else
2625
config.action_controller.perform_caching = false
27-
28-
config.cache_store = :null_store
2926
end
3027

31-
# Store uploaded files on the local file system (see config/storage.yml for options).
32-
# config.active_storage.service = :local
33-
34-
# Don't care if the mailer can't send.
35-
# config.action_mailer.raise_delivery_errors = false
36-
37-
# config.action_mailer.perform_caching = false
28+
# Change to :null_store to avoid any caching.
29+
config.cache_store = :memory_store
3830

3931
# Print deprecation notices to the Rails logger.
4032
config.active_support.deprecation = :log
@@ -45,18 +37,21 @@
4537
# Highlight code that triggered database queries in logs.
4638
config.active_record.verbose_query_logs = true
4739

48-
# Debug mode disables concatenation and preprocessing of assets.
49-
# This option may cause significant delays in view rendering with a large
50-
# number of complex assets.
51-
config.assets.debug = true
52-
53-
# Suppress logger output for asset requests.
54-
config.assets.quiet = true
40+
# Append comments with runtime information tags to SQL queries in logs.
41+
if config.active_record.respond_to?(:query_log_tags_enabled=)
42+
config.active_record.query_log_tags_enabled = true
43+
end
5544

5645
# Raises error for missing translations.
57-
# config.action_view.raise_on_missing_translations = true
46+
# config.i18n.raise_on_missing_translations = true
5847

59-
# Use an evented file watcher to asynchronously detect changes in source code,
60-
# routes, locales, etc. This feature depends on the listen gem.
61-
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
48+
# Annotate rendered view with file names.
49+
if config.respond_to?(:annotate_rendered_view_with_filenames=)
50+
config.action_view.annotate_rendered_view_with_filenames = true
51+
end
52+
53+
# Raise error when a before_action's only/except options reference missing actions.
54+
if ActionController::Base.respond_to?(:raise_on_missing_callback_actions)
55+
config.action_controller.raise_on_missing_callback_actions = true
56+
end
6257
end
Lines changed: 36 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,67 @@
1+
require "active_support/core_ext/integer/time"
2+
13
Rails.application.configure do
24
# Settings specified here will take precedence over those in config/application.rb.
35

46
# Code is not reloaded between requests.
5-
config.cache_classes = true
7+
config.enable_reloading = false
68

7-
# Eager load code on boot. This eager loads most of Rails and
8-
# your application in memory, allowing both threaded web servers
9-
# and those relying on copy on write to perform better.
10-
# Rake tasks automatically ignore this option for performance.
9+
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
1110
config.eager_load = true
1211

13-
# Full error reports are disabled and caching is turned on.
14-
config.consider_all_requests_local = false
15-
config.action_controller.perform_caching = true
16-
17-
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
18-
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
19-
# config.require_master_key = true
20-
21-
# Disable serving static files from the `/public` folder by default since
22-
# Apache or NGINX already handles this.
23-
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
12+
# Full error reports are disabled.
13+
config.consider_all_requests_local = false
2414

25-
# Compress CSS using a preprocessor.
26-
# config.assets.css_compressor = :sass
15+
# Turn on fragment caching in view templates.
16+
config.action_controller.perform_caching = true
2717

28-
# Do not fallback to assets pipeline if a precompiled asset is missed.
29-
config.assets.compile = false
18+
# Cache assets for far-future expiry since they are all digest stamped.
19+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
3020

3121
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
32-
# config.action_controller.asset_host = 'http://assets.example.com'
33-
34-
# Specifies the header that your server uses for sending files.
35-
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
36-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
22+
# config.asset_host = "http://assets.example.com"
3723

38-
# Store uploaded files on the local file system (see config/storage.yml for options).
39-
# config.active_storage.service = :local
40-
41-
# Mount Action Cable outside main process or domain.
42-
# config.action_cable.mount_path = nil
43-
# config.action_cable.url = 'wss://example.com/cable'
44-
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
24+
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
25+
config.assume_ssl = true
4526

4627
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
47-
# config.force_ssl = true
28+
config.force_ssl = true
4829

49-
# Use the lowest log level to ensure availability of diagnostic information
50-
# when problems arise.
51-
config.log_level = :debug
30+
# Skip http-to-https redirect for the default health check endpoint.
31+
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
5232

53-
# Prepend all log lines with the following tags.
33+
# Log to STDOUT with the current request id as a default log tag.
5434
config.log_tags = [ :request_id ]
35+
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
5536

56-
# Use a different cache store in production.
57-
# config.cache_store = :mem_cache_store
37+
# Change to "debug" to log everything (including potentially personally-identifiable information!)
38+
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
5839

59-
# Use a real queuing backend for Active Job (and separate queues per environment).
60-
# config.active_job.queue_adapter = :resque
61-
# config.active_job.queue_name_prefix = "dummy_production"
40+
# Prevent health checks from clogging up the logs.
41+
config.silence_healthcheck_path = "/up"
6242

63-
# config.action_mailer.perform_caching = false
43+
# Don't log any deprecations.
44+
config.active_support.report_deprecations = false
6445

65-
# Ignore bad email addresses and do not raise email delivery errors.
66-
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
67-
# config.action_mailer.raise_delivery_errors = false
46+
# Replace the default in-process memory cache store with a durable alternative.
47+
# config.cache_store = :mem_cache_store
6848

6949
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
7050
# the I18n.default_locale when a translation cannot be found).
7151
config.i18n.fallbacks = true
7252

73-
# Send deprecation notices to registered listeners.
74-
config.active_support.deprecation = :notify
75-
76-
# Use default logging formatter so that PID and timestamp are not suppressed.
77-
config.log_formatter = ::Logger::Formatter.new
78-
79-
# Use a different logger for distributed setups.
80-
# require 'syslog/logger'
81-
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
82-
83-
if ENV["RAILS_LOG_TO_STDOUT"].present?
84-
logger = ActiveSupport::Logger.new(STDOUT)
85-
logger.formatter = config.log_formatter
86-
config.logger = ActiveSupport::TaggedLogging.new(logger)
87-
end
88-
8953
# Do not dump schema after migrations.
9054
config.active_record.dump_schema_after_migration = false
9155

92-
# Inserts middleware to perform automatic connection switching.
93-
# The `database_selector` hash is used to pass options to the DatabaseSelector
94-
# middleware. The `delay` is used to determine how long to wait after a write
95-
# to send a subsequent read to the primary.
96-
#
97-
# The `database_resolver` class is used by the middleware to determine which
98-
# database is appropriate to use based on the time delay.
99-
#
100-
# The `database_resolver_context` class is used by the middleware to set
101-
# timestamps for the last write to the primary. The resolver uses the context
102-
# class timestamps to determine how long to wait before reading from the
103-
# replica.
56+
# Only use :id for inspections in production.
57+
config.active_record.attributes_for_inspect = [ :id ]
58+
59+
# Enable DNS rebinding protection and other `Host` header attacks.
60+
# config.hosts = [
61+
# "example.com", # Allow requests from example.com
62+
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
63+
# ]
10464
#
105-
# By default Rails will store a last write timestamp in the session. The
106-
# DatabaseSelector middleware is designed as such you can define your own
107-
# strategy for connection switching and pass that into the middleware through
108-
# these configuration options.
109-
# config.active_record.database_selector = { delay: 2.seconds }
110-
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
111-
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
65+
# Skip DNS rebinding protection for the default health check endpoint.
66+
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
11267
end
Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,45 @@
1+
# The test environment is used exclusively to run your application's
2+
# test suite. You never need to work with it otherwise. Remember that
3+
# your test database is "scratch space" for the test suite and is wiped
4+
# and recreated between test runs. Don't rely on the data there!
5+
16
Rails.application.configure do
27
# Settings specified here will take precedence over those in config/application.rb.
38

4-
# The test environment is used exclusively to run your application's
5-
# test suite. You never need to work with it otherwise. Remember that
6-
# your test database is "scratch space" for the test suite and is wiped
7-
# and recreated between test runs. Don't rely on the data there!
8-
config.cache_classes = true
9+
# While tests run files are not watched, reloading is not necessary.
10+
config.enable_reloading = false
911

10-
if ENV["CI"] || ENV["TEST_EAGER_LOAD"]
11-
config.eager_load = true
12-
else
13-
# Do not eager load code on boot. This avoids loading your whole application
14-
# just for the purpose of running a single test. If you are using a tool that
15-
# preloads Rails for running tests, you may have to set it to true.
16-
config.eager_load = false
17-
end
12+
# Eager loading loads your entire application. When running a single test locally,
13+
# this is usually not necessary, and can slow down your test suite. However, it's
14+
# recommended that you enable it in continuous integration systems to ensure eager
15+
# loading is working properly before deploying your code.
16+
config.eager_load = ENV["CI"].present?
1817

1918
# Configure public file server for tests with Cache-Control for performance.
2019
if config.respond_to?(:public_file_server)
2120
config.public_file_server.enabled = true
22-
config.public_file_server.headers = {
23-
'Cache-Control' => 'public, max-age=3600'
24-
}
21+
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
2522
else
2623
config.serve_static_files = true
2724
config.static_cache_control = 'public, max-age=3600'
2825
end
2926

30-
# Show full error reports and disable caching.
31-
config.consider_all_requests_local = true
32-
config.action_controller.perform_caching = false
27+
# Show full error reports.
28+
config.consider_all_requests_local = true
3329
config.cache_store = :null_store
3430

35-
# Raise exceptions instead of rendering exception templates.
36-
config.action_dispatch.show_exceptions = :all
31+
# Render exception templates for rescuable exceptions and raise for other exceptions.
32+
config.action_dispatch.show_exceptions = :rescuable
3733

3834
# Disable request forgery protection in test environment.
3935
config.action_controller.allow_forgery_protection = false
4036

41-
# Store uploaded files on the local file system in a temporary directory.
42-
# config.active_storage.service = :test
43-
44-
# config.action_mailer.perform_caching = false
45-
46-
# Tell Action Mailer not to deliver emails to the real world.
47-
# The :test delivery method accumulates sent emails in the
48-
# ActionMailer::Base.deliveries array.
49-
# config.action_mailer.delivery_method = :test
50-
5137
# Print deprecation notices to the stderr.
5238
config.active_support.deprecation = :stderr
5339

54-
# Debug mode disables concatenation and preprocessing of assets.
55-
# This option may cause significant delays in view rendering with a large
56-
# number of complex assets.
57-
unless ENV["CI"]
58-
config.assets.digest = false
59-
config.assets.debug = true
60-
end
61-
6240
# Raises error for missing translations.
63-
# config.action_view.raise_on_missing_translations = true
41+
# config.i18n.raise_on_missing_translations = true
42+
43+
# Annotate rendered view with file names.
44+
# config.action_view.annotate_rendered_view_with_filenames = true
6445
end

0 commit comments

Comments
 (0)