Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update gemfiles and CI settings for newer Rails versions #127

Merged
merged 4 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,19 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [2.7, '3.0']
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
gemfile:
- rails_7.1
- rails_7.0
- rails_6.1
- rails_6.0
- rails_5.2
exclude:
- ruby: '3.0'
gemfile: rails_5.2
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec rake db:create db:schema:load test
- run: bundle exec rake db:create db:schema:load test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ test/**/Gemfile.lock
*.iml
*.sqlite3
.tool-versions
gems.locked
gemfiles/*.lock

37 changes: 21 additions & 16 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
appraise "rails-6.0" do
gem "actionpack", "~> 6.0.0"
gem "activerecord", "~> 6.0.0"
end
appraise "rails-6.1" do
gem "actionpack", "~> 6.1.0"
gem "activerecord", "~> 6.1.0"
# frozen_string_literal: true

appraise 'rails-6.0' do
gem 'actionpack', '~> 6.0.0'
gem 'activerecord', '~> 6.0.0'
gem 'sqlite3', '~> 1.4.0'
end
appraise "rails-7.0" do
gem "actionpack", "~> 7.0.0"
gem "activerecord", "~> 7.0.0"
gem "sqlite3", "~> 1.4.0"

appraise 'rails-6.1' do
gem 'actionpack', '~> 6.1.0'
gem 'activerecord', '~> 6.1.0'
gem 'sqlite3', '~> 1.4.0'
end

appraise "rails-5.2" do
gem "actionpack", "~> 5.2.0"
gem "activerecord", "~> 5.2.0"
gem "sqlite3", "~> 1.3.8"
end
appraise 'rails-7.0' do
gem 'actionpack', '~> 7.0.0'
gem 'activerecord', '~> 7.0.0'
gem 'sqlite3', '~> 1.4.0'
end
appraise 'rails-7.1' do
gem 'actionpack', '~> 7.1.0'
gem 'activerecord', '~> 7.q.0'
gem 'sqlite3', '~> 1.4.0'
end
7 changes: 2 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ Rake::TestTask.new(:test) do |t|
t.test_files = FileList["test/**/*_test.rb"]
end

begin
require File.expand_path("test/dummy/config/application", __dir__)
Rails.application.load_tasks
rescue LoadError
end
require File.expand_path("test/dummy/config/application", __dir__)
Rails.application.load_tasks

desc "Running Tests"
task default: :test
7 changes: 3 additions & 4 deletions gemfiles/rails_6.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

source "https://rubygems.org"

gem "appraisal"
gem "minitest-capybara"
gem "cells-erb"
gem "cells-rails"
gem "reform-rails"
gem "trailblazer"
gem "trailblazer-cells"
gem "trailblazer-loader"
gem "sqlite3"
gem "minitest-capybara"
gem "appraisal"
gem "actionpack", "~> 6.0.0"
gem "activerecord", "~> 6.0.0"
gem "sqlite3", "~> 1.4.0"

gemspec path: "../"
7 changes: 3 additions & 4 deletions gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

source "https://rubygems.org"

gem "appraisal"
gem "minitest-capybara"
gem "cells-erb"
gem "cells-rails"
gem "reform-rails"
gem "trailblazer"
gem "trailblazer-cells"
gem "trailblazer-loader"
gem "sqlite3"
gem "minitest-capybara"
gem "appraisal"
gem "actionpack", "~> 6.1.0"
gem "activerecord", "~> 6.1.0"
gem "sqlite3", "~> 1.4.0"

gemspec path: "../"
13 changes: 3 additions & 10 deletions gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,15 @@

source "https://rubygems.org"

gem "appraisal"
gem "minitest-capybara"
gem "cells-erb"
gem "cells-rails"
gem "reform-rails"
gem "trailblazer"
gem "trailblazer-cells"
gem "sqlite3", "~> 1.4.0"
gem "minitest-capybara"
gem "appraisal"
gem "actionpack", "~> 7.0.0"
gem "activerecord", "~> 7.0.0"

# gem "trailblazer-macro", path: "../../trailblazer-macro"
# gem "trailblazer-macro-contract", path: "../../trailblazer-macro-contract"
# gem "trailblazer-activity", path: "../../trailblazer-activity"
# gem "trailblazer-operation", path: "../../trailblazer-operation"
# gem "trailblazer-developer", path: "../../trailblazer-developer"
# gem "trailblazer-activity-dsl-linear", path: "../../trailblazer-activity-dsl-linear"
gem "sqlite3", "~> 1.4.0"

gemspec path: "../"
11 changes: 5 additions & 6 deletions gemfiles/rails_5.2.gemfile → gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

source "https://rubygems.org"

gem "appraisal"
gem "minitest-capybara"
gem "cells-erb"
gem "cells-rails"
gem "reform-rails"
gem "trailblazer"
gem "trailblazer-cells"
gem "trailblazer-loader"
gem "sqlite3", "~> 1.3.8"
gem "minitest-capybara"
gem "appraisal"
gem "actionpack", "~> 5.2.0"
gem "activerecord", "~> 5.2.0"
gem "actionpack", "~> 7.1.0"
gem "activerecord", "~> 7.q.0"
gem "sqlite3", "~> 1.4.0"

gemspec path: "../"
12 changes: 12 additions & 0 deletions gems.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

source 'https://rubygems.org'
gemspec

gem 'appraisal'
gem 'minitest-capybara'
gem "cells-erb"
gem "cells-rails"
gem "reform-rails"
gem "trailblazer"
gem "trailblazer-cells"
7 changes: 7 additions & 0 deletions test/dummy/app/models/song.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
class Song < ApplicationRecord

def inspect
# this makes the output consistent across Ruby versions
title = self.title.present? ? "\"#{self.title}\"" : "nil"
id = self.id.present? ? self.id : "nil"
%{#<Song id: #{id}, title: #{title}>}
end
end
1 change: 0 additions & 1 deletion test/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
module TrailblazerTestApp
class Application < Rails::Application
config.load_defaults Rails.gem_version.to_s.split(".")[0..1].join(".")
config.active_record.legacy_connection_handling = false if Rails.gem_version >= Gem::Version.new("6.1")
config.cache_classes = true
config.eager_load = false
config.serve_static_files = false
Expand Down
8 changes: 1 addition & 7 deletions test/dummy/config/database.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
default: &default
test:
adapter: sqlite3
pool: 5
timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
1 change: 1 addition & 0 deletions test/integration/artists_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "test_helper"
require 'minitest/capybara'

class ArtistsControllerTest < Minitest::Capybara::Spec
it "cell: Artist::Cell::Dashboard" do
Expand Down
1 change: 1 addition & 0 deletions test/integration/cells_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "test_helper"
require 'minitest/capybara'

class CellsControllerTest < Minitest::Capybara::Spec
it "" do
Expand Down
1 change: 1 addition & 0 deletions test/integration/songs_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "test_helper"
require 'minitest/capybara'

class SongsControllerTest < Minitest::Capybara::Spec
it "new" do
Expand Down
7 changes: 3 additions & 4 deletions trailblazer-rails.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "trailblazer/rails/version"
require_relative "lib/trailblazer/rails/version"

Gem::Specification.new do |spec|
spec.name = "trailblazer-rails"
Expand All @@ -15,10 +13,11 @@ Gem::Specification.new do |spec|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
spec.require_paths = ["lib"]

spec.add_dependency "railties", ">= 5.2.0"
spec.add_dependency "railties", ">= 6.0.0"
spec.add_dependency "trailblazer", ">= 2.1.0", "< 2.2.0"

spec.add_development_dependency "bundler"
spec.add_development_dependency "minitest"
spec.add_development_dependency "rake"
spec.add_development_dependency "capybara"
end