From 9b6c098acb82b1e6bfc452b49bf640f345fd8c33 Mon Sep 17 00:00:00 2001 From: Caleb Hearth Date: Tue, 5 Mar 2024 08:59:47 -0700 Subject: [PATCH 1/2] Bump build matrix - Fix some dependency conflicts / unneeded version locks - Fix some Rails 7.1 issues --- .github/workflows/ci.yml | 4 ++-- Gemfile | 9 ++++----- scenic.gemspec | 6 +++--- spec/scenic/schema_dumper_spec.rb | 6 +++--- spec/spec_helper.rb | 2 -- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34131270..ce7796ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,8 +30,8 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.7", "3.0", "3.1", "3.2"] - rails: ["6.1", "7.0"] + ruby: ["3.0", "3.1", "3.2", "3.3"] + rails: ["6.1", "7.0", "7.1", "main"] continue-on-error: [false] exclude: - ruby: "3.2" diff --git a/Gemfile b/Gemfile index 5c270e1f..0f391c00 100644 --- a/Gemfile +++ b/Gemfile @@ -3,14 +3,13 @@ source "https://rubygems.org" # Specify your gem's dependencies in scenic.gemspec gemspec -rails_version = ENV.fetch("RAILS_VERSION", "6.1") +rails_version = ENV.fetch("RAILS_VERSION", "7.1") -rails_constraint = if rails_version == "master" +rails_constraint = if rails_version == "main" {github: "rails/rails"} else "~> #{rails_version}.0" end -gem "rails", rails_constraint -gem "sprockets", "< 4.0.0" -gem "pg", "~> 1.1" +gem "activerecord", rails_constraint +gem "railties", rails_constraint diff --git a/scenic.gemspec b/scenic.gemspec index edafe043..4f9ca1f2 100644 --- a/scenic.gemspec +++ b/scenic.gemspec @@ -22,15 +22,15 @@ Gem::Specification.new do |spec| spec.add_development_dependency "database_cleaner" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", ">= 3.3" - spec.add_development_dependency "pg", "~> 0.19" - spec.add_development_dependency "pry" + spec.add_development_dependency "pg", "~> 1.1" spec.add_development_dependency "ammeter", ">= 1.1.3" spec.add_development_dependency "yard" spec.add_development_dependency "redcarpet" spec.add_development_dependency "standard" + spec.add_development_dependency "sprockets", "< 4.0.0" spec.add_dependency "activerecord", ">= 4.0.0" spec.add_dependency "railties", ">= 4.0.0" - spec.required_ruby_version = ">= 2.3.0" + spec.required_ruby_version = ">= 3.0" end diff --git a/spec/scenic/schema_dumper_spec.rb b/spec/scenic/schema_dumper_spec.rb index 02378110..cef74d49 100644 --- a/spec/scenic/schema_dumper_spec.rb +++ b/spec/scenic/schema_dumper_spec.rb @@ -58,7 +58,7 @@ class SearchInAHaystack < ActiveRecord::Base context "with views in non public schemas" do it "dumps a create_view including namespace for a view in the database" do view_definition = "SELECT 'needle'::text AS haystack" - Search.connection.execute "CREATE SCHEMA scenic; SET search_path TO scenic, public" + Search.connection.execute "CREATE SCHEMA IF NOT EXISTS scenic; SET search_path TO scenic, public" Search.connection.create_view :"scenic.searches", sql_definition: view_definition stream = StringIO.new @@ -139,7 +139,7 @@ class SearchInAHaystack < ActiveRecord::Base it "dumps a create_view for a view in the database" do view_definition = "SELECT 'needle'::text AS haystack" Search.connection.execute( - "CREATE SCHEMA scenic; SET search_path TO scenic, public" + "CREATE SCHEMA IF NOT EXISTS scenic; SET search_path TO scenic, public" ) Search.connection.create_view 'scenic."search in a haystack"', sql_definition: view_definition @@ -151,7 +151,7 @@ class SearchInAHaystack < ActiveRecord::Base expect(output).to include 'create_view "scenic.\"search in a haystack\"",' expect(output).to include view_definition - Search.connection.drop_view :'scenic."search in a haystack"' + Search.connection.execute "DROP SCHEMA IF EXISTS scenic CASCADE;" silence_stream($stdout) { eval(output) } # standard:disable Security/Eval diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b3dfc3a9..7b3fc3dd 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,8 +13,6 @@ DatabaseCleaner.strategy = :transaction config.around(:each, db: true) do |example| - ActiveRecord::SchemaMigration.create_table - DatabaseCleaner.start example.run DatabaseCleaner.clean From 13c3edd3577283932368e122f78924799d1240c2 Mon Sep 17 00:00:00 2001 From: Caleb Hearth Date: Tue, 5 Mar 2024 10:11:56 -0700 Subject: [PATCH 2/2] Drop 3.0 --- .github/workflows/ci.yml | 2 +- scenic.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce7796ed..61eb1ccd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["3.0", "3.1", "3.2", "3.3"] + ruby: ["3.1", "3.2", "3.3"] rails: ["6.1", "7.0", "7.1", "main"] continue-on-error: [false] exclude: diff --git a/scenic.gemspec b/scenic.gemspec index 4f9ca1f2..b440a214 100644 --- a/scenic.gemspec +++ b/scenic.gemspec @@ -32,5 +32,5 @@ Gem::Specification.new do |spec| spec.add_dependency "activerecord", ">= 4.0.0" spec.add_dependency "railties", ">= 4.0.0" - spec.required_ruby_version = ">= 3.0" + spec.required_ruby_version = ">= 3.1" end