From 398e2aa24958b1496f19d0d4440b8a9d2cfc17f1 Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Thu, 5 Oct 2023 10:59:11 +0200 Subject: [PATCH 1/8] Update `solidusio/extensions` to v0.9.0 to fix CI exceptions --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5096680..18277fe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ orbs: # run specs against Solidus supported versions only without the need # to change this configuration every time a Solidus version is released # or goes EOL. - solidusio_extensions: solidusio/extensions@0.2.27 + solidusio_extensions: solidusio/extensions@0.9.0 jobs: run-specs-with-postgres: From ed571452b8c37e1e910f7b8e7c2dd86c76fce167 Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Thu, 5 Oct 2023 11:06:10 +0200 Subject: [PATCH 2/8] Drop support for EOL Ruby versions and require >= 3.0 --- solidus_bolt.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solidus_bolt.gemspec b/solidus_bolt.gemspec index 6149860..02e09bb 100644 --- a/solidus_bolt.gemspec +++ b/solidus_bolt.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |spec| spec.metadata['source_code_uri'] = 'https://github.com/solidusio/solidus_bolt' spec.metadata['changelog_uri'] = 'https://github.com/solidusio/solidus_bolt/blob/main/CHANGELOG.md' - spec.required_ruby_version = Gem::Requirement.new('>= 2.5') + spec.required_ruby_version = Gem::Requirement.new('>= 3.0') # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. From 0437988a85ad2a816dc67f94af40f5d0e0433fed Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Thu, 5 Oct 2023 11:11:30 +0200 Subject: [PATCH 3/8] Use volatile tag for `solidusio/extensions` orb in CI config --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 18277fe..5d02a04 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ orbs: # run specs against Solidus supported versions only without the need # to change this configuration every time a Solidus version is released # or goes EOL. - solidusio_extensions: solidusio/extensions@0.9.0 + solidusio_extensions: solidusio/extensions@volatile jobs: run-specs-with-postgres: From 7591c1a77d08aace2a3578733a9be2bdf1624c6f Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Thu, 5 Oct 2023 11:22:14 +0200 Subject: [PATCH 4/8] Update CI configuration for specific ruby versions This commit refines the CI/CD pipeline to test against targeted Ruby versions and Solidus extensions. - Configured `run-specs-with-mysql` job to utilize Ruby 3.1. - Altered `lint-code` job to run on Ruby 3.0. --- .circleci/config.yml | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5d02a04..45b746d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,15 +9,33 @@ orbs: jobs: run-specs-with-postgres: - executor: solidusio_extensions/postgres + parameters: + ruby_version: + type: string + default: "3.2" + executor: + name: solidusio_extensions/postgres + ruby_version: << parameters.ruby_version >> steps: - solidusio_extensions/run-tests run-specs-with-mysql: - executor: solidusio_extensions/mysql + parameters: + ruby_version: + type: string + default: "3.2" + executor: + name: solidusio_extensions/mysql + ruby_version: << parameters.ruby_version >> steps: - solidusio_extensions/run-tests lint-code: - executor: solidusio_extensions/sqlite-memory + parameters: + ruby_version: + type: string + default: "3.2" + executor: + name: solidusio_extensions/sqlite-memory + ruby_version: << parameters.ruby_version >> steps: - solidusio_extensions/lint-code @@ -25,9 +43,12 @@ workflows: "Run specs on supported Solidus versions": jobs: - run-specs-with-postgres - - run-specs-with-mysql - - lint-code - + - run-specs-with-mysql: + name: "Run specs with MySQL and Ruby 3.1" + ruby_version: "3.1" + - lint-code: + name: "Lint code with Ruby 3.0" + ruby_version: "3.0" "Weekly run specs against main": triggers: - schedule: @@ -38,4 +59,6 @@ workflows: - main jobs: - run-specs-with-postgres - - run-specs-with-mysql + - run-specs-with-mysql: + name: "Run specs with MySQL and Ruby 3.1 on main" + ruby_version: "3.1" From f8c6ebfeac01d35120b7d402d0635c91f8503f4d Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Thu, 5 Oct 2023 11:34:33 +0200 Subject: [PATCH 5/8] Update solidus_social to specific commit Refer to the commit eb542f3052430c208089366fc9ae458a9fe2d9a1 from solidus_social to resolve dependency version conflicts. --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index 81abf77..9c2681f 100644 --- a/Gemfile +++ b/Gemfile @@ -29,6 +29,8 @@ else gem 'sqlite3' end +gem 'solidus_social', github: 'solidusio-contrib/solidus_social', ref: 'eb542f3052430c208089366fc9ae458a9fe2d9a1' + gemspec # Use a local Gemfile to include development dependencies that might not be From 4b2999f777dcb0fe121d0ca9eb8e74d7315aaf06 Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Thu, 5 Oct 2023 11:40:19 +0200 Subject: [PATCH 6/8] Upgrade solidus_dev_support to `~> 2.7` and align ruby version Update solidus_dev_support to version ~> 2.7 to target Ruby 3.0. --- solidus_bolt.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solidus_bolt.gemspec b/solidus_bolt.gemspec index 02e09bb..1eaa763 100644 --- a/solidus_bolt.gemspec +++ b/solidus_bolt.gemspec @@ -41,7 +41,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'net-smtp' spec.add_development_dependency 'pry' - spec.add_development_dependency 'solidus_dev_support', '~> 2.5' + spec.add_development_dependency 'solidus_dev_support', '~> 2.7' spec.add_development_dependency 'vcr' spec.add_development_dependency 'webmock' end From e377462c88faeb85f1121d423bf247779fbf1c68 Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Thu, 5 Oct 2023 11:49:00 +0200 Subject: [PATCH 7/8] Resolve RuboCop offenses --- .rubocop.yml | 3 +++ app/controllers/solidus_bolt/base_controller.rb | 2 +- spec/requests/spree/admin/bolt_spec.rb | 2 +- .../solidus_bolt/users/sync_payment_sources_service_spec.rb | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index f166200..93d509a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,9 @@ require: - solidus_dev_support/rubocop +Gemspec/RequiredRubyVersion: + Enabled: false + AllCops: NewCops: disable diff --git a/app/controllers/solidus_bolt/base_controller.rb b/app/controllers/solidus_bolt/base_controller.rb index 20a3be8..3249073 100644 --- a/app/controllers/solidus_bolt/base_controller.rb +++ b/app/controllers/solidus_bolt/base_controller.rb @@ -15,7 +15,7 @@ def verify_bolt_request signing_secret = SolidusBolt::BoltConfiguration.fetch&.signing_secret || '' computed_hmac = Base64.encode64(OpenSSL::HMAC.digest("SHA256", signing_secret, permitted_params.to_json)).strip - return render json: { error: 'Unauthorized request' }, status: :unauthorized unless hmac_header == computed_hmac + render json: { error: 'Unauthorized request' }, status: :unauthorized unless hmac_header == computed_hmac end end end diff --git a/spec/requests/spree/admin/bolt_spec.rb b/spec/requests/spree/admin/bolt_spec.rb index dc5cf9f..4175425 100644 --- a/spec/requests/spree/admin/bolt_spec.rb +++ b/spec/requests/spree/admin/bolt_spec.rb @@ -19,7 +19,7 @@ end it 'creates a new SolidusBolt::BoltConfiguration record if no records are present' do - expect { get '/admin/bolt' }.to change { SolidusBolt::BoltConfiguration.count }.by(1) + expect { get '/admin/bolt' }.to change(SolidusBolt::BoltConfiguration, :count).by(1) end end diff --git a/spec/services/solidus_bolt/users/sync_payment_sources_service_spec.rb b/spec/services/solidus_bolt/users/sync_payment_sources_service_spec.rb index d9c5077..5a01ad3 100644 --- a/spec/services/solidus_bolt/users/sync_payment_sources_service_spec.rb +++ b/spec/services/solidus_bolt/users/sync_payment_sources_service_spec.rb @@ -14,7 +14,7 @@ before { bolt_payment_method } it 'creates a new payment source with card ID' do - expect { sync_payment_sources }.to change { SolidusBolt::PaymentSource.count }.by(1) + expect { sync_payment_sources }.to change(SolidusBolt::PaymentSource, :count).by(1) bolt_payment_source = SolidusBolt::PaymentSource.last expect(bolt_payment_source.card_id).to be_present expect(bolt_payment_source.card_expiration).to be_present From 900eb16af12f681f72251ae6c87e9e651dd56d45 Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Thu, 5 Oct 2023 12:09:33 +0200 Subject: [PATCH 8/8] Automate sandbox setup with migrations auto-run --- bin/sandbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sandbox b/bin/sandbox index 8cf30e7..4acc481 100755 --- a/bin/sandbox +++ b/bin/sandbox @@ -83,7 +83,7 @@ unbundled bundle exec rails generate solidus:install \ $@ unbundled bundle exec rails generate solidus:auth:install -unbundled bundle exec rails generate ${extension_name}:install +unbundled bundle exec rails generate ${extension_name}:install --auto_run_migrations=true echo echo "🚀 Sandbox app successfully created for $extension_name!"