From d2d44e8cc9e93b9c800ea2d723d6fd5e724c51fb Mon Sep 17 00:00:00 2001 From: Jason Hill <561+jhill@users.noreply.github.com> Date: Sat, 17 May 2025 11:20:01 -0400 Subject: [PATCH 1/6] Document test script --- README.md | 8 ++++ script/test | 4 ++ vendor/bundle/ruby/3.2.0/bin/bundle | 38 +++++++++++++++++++ .../3.2.0/gems/bundler-2.4.19/libexec/bundle | 38 +++++++++++++++++++ .../3.2.0/gems/bundler-2.4.19/libexec/bundler | 4 ++ 5 files changed, 92 insertions(+) create mode 100644 script/test create mode 100644 vendor/bundle/ruby/3.2.0/bin/bundle create mode 100644 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.19/libexec/bundle create mode 100644 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.19/libexec/bundler diff --git a/README.md b/README.md index a756bc4616..6d9c52da66 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,14 @@ If you have any problems, reach out on our [public Slack](https://www.workarea.c **Watch the Quickstart Video:** +Testing +-------------------------------------------------------------------------------- +Tests can be executed using the included `script/test` helper. This script adds the bundled version of Bundler to the `PATH` and runs `rake test` for all engines. + +```bash +./script/test +``` + Plugins -------------------------------------------------------------------------------- diff --git a/script/test b/script/test new file mode 100644 index 0000000000..3f2a6dcb5f --- /dev/null +++ b/script/test @@ -0,0 +1,4 @@ +#!/bin/bash +# Run tests using vendored bundler +export PATH="$(pwd)/vendor/bundle/ruby/3.2.0/bin:$PATH" +BUNDLE_GEMFILE="$(pwd)/Gemfile" bundle exec rake test diff --git a/vendor/bundle/ruby/3.2.0/bin/bundle b/vendor/bundle/ruby/3.2.0/bin/bundle new file mode 100644 index 0000000000..90c62627f8 --- /dev/null +++ b/vendor/bundle/ruby/3.2.0/bin/bundle @@ -0,0 +1,38 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# Exit cleanly from an early interrupt +Signal.trap("INT") do + Bundler.ui.debug("\n#{caller.join("\n")}") if defined?(Bundler) + exit 1 +end + +base_path = File.expand_path("../lib", __dir__) + +if File.exist?(base_path) + $LOAD_PATH.unshift(base_path) +end + +require "bundler" + +if Gem.rubygems_version < Gem::Version.new("3.2.3") && Gem.ruby_version < Gem::Version.new("2.7.a") && !ENV["BUNDLER_NO_OLD_RUBYGEMS_WARNING"] + Bundler.ui.warn \ + "Your RubyGems version (#{Gem::VERSION}) has a bug that prevents " \ + "`required_ruby_version` from working for Bundler. Any scripts that use " \ + "`gem install bundler` will break as soon as Bundler drops support for " \ + "your Ruby version. Please upgrade RubyGems to avoid future breakage " \ + "and silence this warning by running `gem update --system 3.2.3`" +end + +require "bundler/friendly_errors" + +Bundler.with_friendly_errors do + require "bundler/cli" + + # Allow any command to use --help flag to show help for that command + help_flags = %w[--help -h] + help_flag_used = ARGV.any? {|a| help_flags.include? a } + args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV + + Bundler::CLI.start(args, :debug => true) +end diff --git a/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.19/libexec/bundle b/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.19/libexec/bundle new file mode 100644 index 0000000000..90c62627f8 --- /dev/null +++ b/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.19/libexec/bundle @@ -0,0 +1,38 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# Exit cleanly from an early interrupt +Signal.trap("INT") do + Bundler.ui.debug("\n#{caller.join("\n")}") if defined?(Bundler) + exit 1 +end + +base_path = File.expand_path("../lib", __dir__) + +if File.exist?(base_path) + $LOAD_PATH.unshift(base_path) +end + +require "bundler" + +if Gem.rubygems_version < Gem::Version.new("3.2.3") && Gem.ruby_version < Gem::Version.new("2.7.a") && !ENV["BUNDLER_NO_OLD_RUBYGEMS_WARNING"] + Bundler.ui.warn \ + "Your RubyGems version (#{Gem::VERSION}) has a bug that prevents " \ + "`required_ruby_version` from working for Bundler. Any scripts that use " \ + "`gem install bundler` will break as soon as Bundler drops support for " \ + "your Ruby version. Please upgrade RubyGems to avoid future breakage " \ + "and silence this warning by running `gem update --system 3.2.3`" +end + +require "bundler/friendly_errors" + +Bundler.with_friendly_errors do + require "bundler/cli" + + # Allow any command to use --help flag to show help for that command + help_flags = %w[--help -h] + help_flag_used = ARGV.any? {|a| help_flags.include? a } + args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV + + Bundler::CLI.start(args, :debug => true) +end diff --git a/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.19/libexec/bundler b/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.19/libexec/bundler new file mode 100644 index 0000000000..a6826a8c89 --- /dev/null +++ b/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.19/libexec/bundler @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +load File.expand_path("bundle", __dir__) From 5b168d5742685b0eac0cc0f86f91f7eb41277f31 Mon Sep 17 00:00:00 2001 From: Jason Hill <561+jhill@users.noreply.github.com> Date: Sat, 17 May 2025 15:28:39 +0000 Subject: [PATCH 2/6] Updated upload-artifact action --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a442211142..341528e021 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: - uses: workarea-commerce/ci/test@v1 with: command: cd admin && bin/rails test test/system/**/*_test.rb -b - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v4 if: failure() with: name: Admin Screenshots @@ -114,7 +114,7 @@ jobs: - uses: workarea-commerce/ci/test@v1 with: command: cd storefront && bin/rails test test/system/**/*_test.rb -b - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@4 if: failure() with: name: Storefront Screenshots From c32125582537c17c12f4cd1b7e39f11af4a33a09 Mon Sep 17 00:00:00 2001 From: Jason Hill <561+jhill@users.noreply.github.com> Date: Sat, 17 May 2025 15:33:03 +0000 Subject: [PATCH 3/6] Updated to use ruby/setup-ruby@v1 --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 341528e021..6c26c947e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - uses: actions/setup-ruby@v1 + - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6.x - uses: workarea-commerce/ci/test@v1 @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - uses: actions/setup-ruby@v1 + - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6.x - uses: workarea-commerce/ci/test@v1 @@ -48,7 +48,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - uses: actions/setup-ruby@v1 + - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6.x - uses: workarea-commerce/ci/test@v1 @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - uses: actions/setup-ruby@v1 + - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6.x - uses: workarea-commerce/ci/test@v1 @@ -75,7 +75,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - uses: actions/setup-ruby@v1 + - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6.x - uses: workarea-commerce/ci/test@v1 @@ -86,7 +86,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - uses: actions/setup-ruby@v1 + - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6.x - uses: workarea-commerce/ci/test@v1 @@ -97,7 +97,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - uses: actions/setup-ruby@v1 + - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6.x - uses: workarea-commerce/ci/test@v1 @@ -108,7 +108,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - uses: actions/setup-ruby@v1 + - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6.x - uses: workarea-commerce/ci/test@v1 From f59c690a6c88a6c3b1fe36c1b73d89b5406c33d4 Mon Sep 17 00:00:00 2001 From: Jason Hill <561+jhill@users.noreply.github.com> Date: Sat, 17 May 2025 15:35:21 +0000 Subject: [PATCH 4/6] More explictly set Ruby version --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c26c947e3..32afa3792d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: - uses: actions/checkout@v1 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6.x + ruby-version: 2.6.10 - uses: workarea-commerce/ci/test@v1 with: command: cd admin && bin/rails test -b @@ -39,7 +39,7 @@ jobs: - uses: actions/checkout@v1 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6.x + ruby-version: 2.6.10 - uses: workarea-commerce/ci/test@v1 with: command: cd admin && bin/rails teaspoon @@ -50,7 +50,7 @@ jobs: - uses: actions/checkout@v1 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6.x + ruby-version: 2.6.10 - uses: workarea-commerce/ci/test@v1 with: command: cd admin && bin/rails test test/system/**/*_test.rb -b @@ -66,7 +66,7 @@ jobs: - uses: actions/checkout@v1 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6.x + ruby-version: 2.6.10 - uses: workarea-commerce/ci/test@v1 with: command: cd core && bin/rails teaspoon @@ -77,7 +77,7 @@ jobs: - uses: actions/checkout@v1 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6.x + ruby-version: 2.6.10 - uses: workarea-commerce/ci/test@v1 with: command: cd core && bin/rails test test/**/*_test.rb -b @@ -88,7 +88,7 @@ jobs: - uses: actions/checkout@v1 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6.x + ruby-version: 2.6.10 - uses: workarea-commerce/ci/test@v1 with: command: cd storefront && bin/rails test -b @@ -99,7 +99,7 @@ jobs: - uses: actions/checkout@v1 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6.x + ruby-version: 2.6.10 - uses: workarea-commerce/ci/test@v1 with: command: cd storefront && bin/rails teaspoon @@ -110,7 +110,7 @@ jobs: - uses: actions/checkout@v1 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6.x + ruby-version: 2.6.10 - uses: workarea-commerce/ci/test@v1 with: command: cd storefront && bin/rails test test/system/**/*_test.rb -b From 950241ebb675c7cf6b4a594cb89754e2c3b31ba8 Mon Sep 17 00:00:00 2001 From: Jason Hill <561+jhill@users.noreply.github.com> Date: Sat, 17 May 2025 15:40:02 +0000 Subject: [PATCH 5/6] Updated bundler --- core/workarea-core.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/workarea-core.gemspec b/core/workarea-core.gemspec index 7e3d40561f..9248de5cc4 100644 --- a/core/workarea-core.gemspec +++ b/core/workarea-core.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |s| s.files = `git ls-files -- . ':!:data/product_images/*.jpg'`.split("\n") s.required_ruby_version = ['>= 2.5.0', '< 2.7.0'] - s.add_dependency 'bundler', '>= 1.8.0' # 1.8.0 added env variable for secrets + s.add_dependency 'bundler', '>= 2.4' s.add_dependency 'rails', '~> 6.0.0' s.add_dependency 'mongoid', '~> 7.2.0' s.add_dependency 'bcrypt', '~> 3.1.10' From 3d23d6411f35ccf840bc16eb788af808fc88ae29 Mon Sep 17 00:00:00 2001 From: Jason Hill <561+jhill@users.noreply.github.com> Date: Sat, 17 May 2025 15:41:41 +0000 Subject: [PATCH 6/6] Bundler to 2.4.22 --- core/workarea-core.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/workarea-core.gemspec b/core/workarea-core.gemspec index 9248de5cc4..f9fd267f01 100644 --- a/core/workarea-core.gemspec +++ b/core/workarea-core.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |s| s.files = `git ls-files -- . ':!:data/product_images/*.jpg'`.split("\n") s.required_ruby_version = ['>= 2.5.0', '< 2.7.0'] - s.add_dependency 'bundler', '>= 2.4' + s.add_dependency 'bundler', '>= 2.4.22' s.add_dependency 'rails', '~> 6.0.0' s.add_dependency 'mongoid', '~> 7.2.0' s.add_dependency 'bcrypt', '~> 3.1.10'