From 57f94943a51e68c7701216f83e11d556d530a5b4 Mon Sep 17 00:00:00 2001 From: Drew Caddell Date: Wed, 12 Feb 2025 09:01:56 -0800 Subject: [PATCH 1/5] TECH-17382: Use shared pipeline workflow to pull in Ruby 3.4 tests --- .github/workflows/pipeline.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/workflows/pipeline.yml diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml new file mode 100644 index 00000000..4ad75a09 --- /dev/null +++ b/.github/workflows/pipeline.yml @@ -0,0 +1,8 @@ +name: Pipeline +on: + push: + schedule: + - cron: '0 1 * * 1' # Every Monday at 1AM UTC +jobs: + tests: + uses: Invoca/ruby-test-matrix-workflow/.github/workflows/ruby-test-matrix.yml@main From 17ab855d1cf5e63d2b2fb19cd1ea22ac9d884a80 Mon Sep 17 00:00:00 2001 From: Drew Caddell Date: Tue, 18 Feb 2025 11:15:26 -0800 Subject: [PATCH 2/5] TECH-17382: Bring existing test workflow in-line with shared workflow expectations --- .github/workflows/declare_schema_build.yml | 18 +++++++++--------- .github/workflows/pipeline.yml | 8 -------- 2 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 .github/workflows/pipeline.yml diff --git a/.github/workflows/declare_schema_build.yml b/.github/workflows/declare_schema_build.yml index 063a576c..78e751bb 100644 --- a/.github/workflows/declare_schema_build.yml +++ b/.github/workflows/declare_schema_build.yml @@ -4,19 +4,20 @@ on: [push] name: DeclareSchema Build jobs: - build: + tests: name: DeclareSchema Build runs-on: ubuntu-latest strategy: fail-fast: false matrix: adapter: [mysql, postgresql, sqlite3] - ruby: ['3.0', 3.1, 3.2, 3.3] + ruby: [3.1, 3.2, 3.3, 3.4] gemfile: - gemfiles/rails_6_1.gemfile - gemfiles/rails_7_0.gemfile - gemfiles/rails_7_1.gemfile - gemfiles/rails_7_2.gemfile + - gemfiles/rails_8_0.gemfile exclude: - adapter: mysql ruby: 3.3 @@ -28,15 +29,14 @@ jobs: ruby: 3.3 gemfile: gemfiles/rails_6_1.gemfile - adapter: mysql - ruby: '3.0' - gemfile: gemfiles/rails_7_2.gemfile + ruby: 3.4 + gemfile: gemfiles/rails_6_1.gemfile - adapter: postgresql - ruby: '3.0' - gemfile: gemfiles/rails_7_2.gemfile + ruby: 3.4 + gemfile: gemfiles/rails_6_1.gemfile - adapter: sqlite3 - ruby: '3.0' - gemfile: gemfiles/rails_7_2.gemfile - + ruby: 3.4 + gemfile: gemfiles/rails_6_1.gemfile env: BUNDLE_GEMFILE: "${{ matrix.gemfile }}" MYSQL_HOST: 127.0.0.1 diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml deleted file mode 100644 index 4ad75a09..00000000 --- a/.github/workflows/pipeline.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: Pipeline -on: - push: - schedule: - - cron: '0 1 * * 1' # Every Monday at 1AM UTC -jobs: - tests: - uses: Invoca/ruby-test-matrix-workflow/.github/workflows/ruby-test-matrix.yml@main From b565e27a0a881d965d57bce49b054dc0a5c81861 Mon Sep 17 00:00:00 2001 From: Drew Caddell Date: Tue, 18 Feb 2025 11:25:50 -0800 Subject: [PATCH 3/5] TECH-17382: Remove unnecessary load of ActiveSupport::ProxyObject; We already switched to using BasicObject --- .github/workflows/declare_schema_build.yml | 2 ++ lib/declare_schema/dsl.rb | 2 -- lib/declare_schema/field_declaration_dsl.rb | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/declare_schema_build.yml b/.github/workflows/declare_schema_build.yml index 78e751bb..ce9938d6 100644 --- a/.github/workflows/declare_schema_build.yml +++ b/.github/workflows/declare_schema_build.yml @@ -19,6 +19,8 @@ jobs: - gemfiles/rails_7_2.gemfile - gemfiles/rails_8_0.gemfile exclude: + - ruby: 3.1 + gemfile: gemfiles/rails_8_0.gemfile - adapter: mysql ruby: 3.3 gemfile: gemfiles/rails_6_1.gemfile diff --git a/lib/declare_schema/dsl.rb b/lib/declare_schema/dsl.rb index 12cf38a9..2589595c 100644 --- a/lib/declare_schema/dsl.rb +++ b/lib/declare_schema/dsl.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'active_support/proxy_object' - module DeclareSchema class Dsl < BasicObject # avoid Object because that gets extended by lots of gems include ::Kernel # but we need the basic class methods diff --git a/lib/declare_schema/field_declaration_dsl.rb b/lib/declare_schema/field_declaration_dsl.rb index 4484d7f4..cd97b5ec 100644 --- a/lib/declare_schema/field_declaration_dsl.rb +++ b/lib/declare_schema/field_declaration_dsl.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'active_support/proxy_object' - module DeclareSchema class FieldDeclarationDsl < BasicObject # avoid Object because that gets extended by lots of gems include ::Kernel # but we need the basic class methods From 2f7e1b9531b1d466a520de093e87cb38925fba8f Mon Sep 17 00:00:00 2001 From: Drew Caddell Date: Tue, 18 Feb 2025 11:34:39 -0800 Subject: [PATCH 4/5] TECH-17382: Update specs to expect Ruby 3.4 hash syntax default --- spec/lib/declare_schema/migration_generator_spec.rb | 7 ++++++- .../model/table_options_definition_spec.rb | 12 ++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/spec/lib/declare_schema/migration_generator_spec.rb b/spec/lib/declare_schema/migration_generator_spec.rb index 7a47f7de..b75d249f 100644 --- a/spec/lib/declare_schema/migration_generator_spec.rb +++ b/spec/lib/declare_schema/migration_generator_spec.rb @@ -899,7 +899,12 @@ class Ad < ActiveRecord::Base # rubocop:disable Lint/ConstantDefinitionInBlock end up, _down = Generators::DeclareSchema::Migration::Migrator.run ActiveRecord::Migration.class_eval(up) - expect(Ad.field_specs['company'].options[:validates].inspect).to eq("{:presence=>true, :uniqueness=>{:case_sensitive=>false}}") + + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.4") + expect(Ad.field_specs['company'].options[:validates].inspect).to eq("{:presence=>true, :uniqueness=>{:case_sensitive=>false}}") + else + expect(Ad.field_specs['company'].options[:validates].inspect).to eq("{presence: true, uniqueness: {case_sensitive: false}}") + end # DeclareSchema supports has_and_belongs_to_many relationships and generates the intersection ("join") table # with appropriate primary key, indexes, and foreign keys. diff --git a/spec/lib/declare_schema/model/table_options_definition_spec.rb b/spec/lib/declare_schema/model/table_options_definition_spec.rb index 4b90d902..4a2fcda9 100644 --- a/spec/lib/declare_schema/model/table_options_definition_spec.rb +++ b/spec/lib/declare_schema/model/table_options_definition_spec.rb @@ -24,7 +24,11 @@ class TableOptionsDefinitionTestModel < ActiveRecord::Base # rubocop:disable Lin describe '#to_key' do subject { model.to_key } - it { is_expected.to eq(['table_options_definition_test_models', "{:charset=>#{charset.inspect}, :collation=>#{collation.inspect}}"]) } + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.4") + it { is_expected.to eq(['table_options_definition_test_models', "{:charset=>#{charset.inspect}, :collation=>#{collation.inspect}}"]) } + else + it { is_expected.to eq(['table_options_definition_test_models', "{charset: #{charset.inspect}, collation: #{collation.inspect}}"]) } + end end describe '#settings' do @@ -56,7 +60,11 @@ class TableOptionsDefinitionTestModel < ActiveRecord::Base # rubocop:disable Lin describe '#hash' do subject { model.hash } - it { is_expected.to eq(['table_options_definition_test_models', "{:charset=>#{charset.inspect}, :collation=>#{collation.inspect}}"].hash) } + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.4") + it { is_expected.to eq(['table_options_definition_test_models', "{:charset=>#{charset.inspect}, :collation=>#{collation.inspect}}"].hash) } + else + it { is_expected.to eq(['table_options_definition_test_models', "{charset: #{charset.inspect}, collation: #{collation.inspect}}"].hash) } + end end describe '#to_s' do From f295a48bb0c6d2bff875e11e2abfca6422beccda Mon Sep 17 00:00:00 2001 From: Drew Caddell Date: Tue, 18 Feb 2025 11:57:25 -0800 Subject: [PATCH 5/5] TECH-17382: Exclude sqlite3/rails8 tests for now --- .github/workflows/declare_schema_build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/declare_schema_build.yml b/.github/workflows/declare_schema_build.yml index ce9938d6..caa82e17 100644 --- a/.github/workflows/declare_schema_build.yml +++ b/.github/workflows/declare_schema_build.yml @@ -39,6 +39,9 @@ jobs: - adapter: sqlite3 ruby: 3.4 gemfile: gemfiles/rails_6_1.gemfile + # TODO: Support SQLite3 with Rails 8.0 + - adapter: sqlite3 + gemfile: gemfiles/rails_8_0.gemfile env: BUNDLE_GEMFILE: "${{ matrix.gemfile }}" MYSQL_HOST: 127.0.0.1