From 3b8ec5f00c76db57274457c6398453e6aba18aef Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 14 Jan 2024 10:44:36 +0900 Subject: [PATCH 01/11] Bump GitHub Actions --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfe20c3..b5f1a50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile}} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} From 7f799c3145bc5a3fa137f683157967b9e1bd32a8 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 14 Jan 2024 10:47:21 +0900 Subject: [PATCH 02/11] Avoid to use latest Bundler The latest Bundler doesn't support old Rubies. --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5f1a50..3bad0ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,6 @@ jobs: ruby-version: ${{ matrix.ruby }} - name: Install dependencies run: | - gem install bundler --no-document bundle install - name: Run test run: bundle exec rake From 1d0ce43168d280c9ac0a41106ce903b2070453d4 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 14 Jan 2024 10:48:24 +0900 Subject: [PATCH 03/11] Remove unsued file --- gemfiles/active_job_master.gemfile | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 gemfiles/active_job_master.gemfile diff --git a/gemfiles/active_job_master.gemfile b/gemfiles/active_job_master.gemfile deleted file mode 100644 index 98330de..0000000 --- a/gemfiles/active_job_master.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source 'https://rubygems.org' - -gem 'coveralls', require: false -gem 'rake' -gem 'sidekiq' -gem 'delayed_job' -gem 'delayed_job_active_record' -gem 'resque' -gem 'resque-scheduler' -gem 'sqlite3' -gem 'arel', github: 'rails/arel' -gem 'activesupport', github: 'rails/rails' -gem 'activejob', github: 'rails/rails' -gem 'activerecord', github: 'rails/rails' From 8c714a720ce80284bcfdb8f74dbc1cfee0bb8ff8 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 14 Jan 2024 10:49:48 +0900 Subject: [PATCH 04/11] Add gemfiles for new version of Rails --- gemfiles/active_job_61.gemfile | 13 +++++++++++++ gemfiles/active_job_70.gemfile | 13 +++++++++++++ gemfiles/active_job_71.gemfile | 13 +++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 gemfiles/active_job_61.gemfile create mode 100644 gemfiles/active_job_70.gemfile create mode 100644 gemfiles/active_job_71.gemfile diff --git a/gemfiles/active_job_61.gemfile b/gemfiles/active_job_61.gemfile new file mode 100644 index 0000000..5bd2c6a --- /dev/null +++ b/gemfiles/active_job_61.gemfile @@ -0,0 +1,13 @@ +source 'https://rubygems.org' + +gem 'coveralls', require: false +gem 'rake' +gem 'sidekiq' +gem 'delayed_job' +gem 'delayed_job_active_record', '>= 4.1.2' +gem 'resque' +gem 'resque-scheduler' +gem 'sqlite3' +gem 'activesupport', '~> 6.1.0' +gem 'activejob', '~> 6.1.0' +gem 'activerecord', '~> 6.1.0' diff --git a/gemfiles/active_job_70.gemfile b/gemfiles/active_job_70.gemfile new file mode 100644 index 0000000..b417564 --- /dev/null +++ b/gemfiles/active_job_70.gemfile @@ -0,0 +1,13 @@ +source 'https://rubygems.org' + +gem 'coveralls', require: false +gem 'rake' +gem 'sidekiq' +gem 'delayed_job' +gem 'delayed_job_active_record', '>= 4.1.2' +gem 'resque' +gem 'resque-scheduler' +gem 'sqlite3' +gem 'activesupport', '~> 7.0.0' +gem 'activejob', '~> 7.0.0' +gem 'activerecord', '~> 7.0.0' diff --git a/gemfiles/active_job_71.gemfile b/gemfiles/active_job_71.gemfile new file mode 100644 index 0000000..5054fc0 --- /dev/null +++ b/gemfiles/active_job_71.gemfile @@ -0,0 +1,13 @@ +source 'https://rubygems.org' + +gem 'coveralls', require: false +gem 'rake' +gem 'sidekiq' +gem 'delayed_job' +gem 'delayed_job_active_record', '>= 4.1.2' +gem 'resque' +gem 'resque-scheduler' +gem 'sqlite3' +gem 'activesupport', '~> 7.1.0' +gem 'activejob', '~> 7.1.0' +gem 'activerecord', '~> 7.1.0' From 8487679421c6306dab09cd09c9ff7e9d8ddffd13 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 14 Jan 2024 10:54:48 +0900 Subject: [PATCH 05/11] Correctly set logger for Sidekiq --- test/support/sidekiq/test_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/support/sidekiq/test_helper.rb b/test/support/sidekiq/test_helper.rb index 0a34d4f..00460c1 100644 --- a/test/support/sidekiq/test_helper.rb +++ b/test/support/sidekiq/test_helper.rb @@ -2,7 +2,9 @@ require 'sidekiq/cli' require_relative 'workers/not_an_active_job_worker' -Sidekiq.logger = Logger.new(nil) +Sidekiq.configure_server do |config| + config.logger = Logger.new(nil) +end def execute_with_launcher sidekiq = Sidekiq::Launcher.new({queues: [FailJob.queue_name.call], From d34b063cf75a5b7ef09ae2dc406e087c22722d84 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 14 Jan 2024 11:31:44 +0900 Subject: [PATCH 06/11] Support Sidekiq 7.0+ --- test/support/sidekiq/test_helper.rb | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/test/support/sidekiq/test_helper.rb b/test/support/sidekiq/test_helper.rb index 00460c1..7a13012 100644 --- a/test/support/sidekiq/test_helper.rb +++ b/test/support/sidekiq/test_helper.rb @@ -7,13 +7,28 @@ end def execute_with_launcher - sidekiq = Sidekiq::Launcher.new({queues: [FailJob.queue_name.call], - environment: "test", - concurrency: 1, - timeout: 1, - }) - Sidekiq.average_scheduled_poll_interval = 3 - Sidekiq.options[:poll_interval_average] = 1 + if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new("7") + config = Sidekiq.default_configuration + config.queues = [FailJob.queue_name.call] + config.concurrency = 1 + config.average_scheduled_poll_interval = 0.5 + config.merge!( + environment: "test", + timeout: 1, + poll_interval_average: 3 + ) + else + config = { + queues: [FailJob.queue_name.call], + environment: "test", + concurrency: 1, + timeout: 1, + average_scheduled_poll_interval: 0.5, + poll_interval_average: 3 + } + end + + sidekiq = Sidekiq::Launcher.new(config) sidekiq.run yield sidekiq.stop From 4ae8db863f524f30f35fe67b74e204a41c6b503e Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 14 Jan 2024 12:10:04 +0900 Subject: [PATCH 07/11] Set timeout --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bad0ba..a335491 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ jobs: build: name: Ruby ${{ matrix.ruby }}, Rails ${{ matrix.gemfile }} runs-on: ubuntu-latest + timeout-minutes: 5 strategy: matrix: ruby: [ "2.7", "2.3" ] From 64dd56ea5739ba397b82e23dd444e112858fce24 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Mon, 15 Jan 2024 07:11:48 +0900 Subject: [PATCH 08/11] Drop support of old Rubies and Rails --- .github/workflows/ci.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a335491..b0047fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,15 +9,8 @@ jobs: timeout-minutes: 5 strategy: matrix: - ruby: [ "2.7", "2.3" ] - gemfile: [ "active_job_60.gemfile", "active_job_52.gemfile", "active_job_51.gemfile", "active_job_50.gemfile", "active_job_42.gemfile" ] - exclude: - - ruby: "2.3" - gemfile: "active_job_60.gemfile" - - ruby: "2.7" - gemfile: "active_job_42.gemfile" - - ruby: "2.6" - gemfile: "active_job_42.gemfile" + ruby: [ "3.2", "3.1", "3.0" ] + gemfile: [ "active_job_71.gemfile", "active_job_70.gemfile", "active_job_61.gemfile", "active_job_60.gemfile" ] services: redis: From da5d6661594470f0f8b25cd7f80235df98852706 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Mon, 15 Jan 2024 07:36:30 +0900 Subject: [PATCH 09/11] Move development dependencies to the `Gemfile` --- Gemfile | 12 ++++++++++++ activejob-cancel.gemspec | 11 ----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index 78bd8e5..8ac561a 100644 --- a/Gemfile +++ b/Gemfile @@ -3,3 +3,15 @@ source 'https://rubygems.org' gem 'coveralls', require: false # Specify your gem's dependencies in activejob-cancel.gemspec gemspec + +gem "bundler" +gem "rake" +gem "minitest" +gem "sidekiq" +gem "activerecord", '>= 4.2.0' +gem "delayed_job" +gem "delayed_job_active_record" +gem "resque" +gem "resque-scheduler" +gem "sqlite3" +gem "byebug" diff --git a/activejob-cancel.gemspec b/activejob-cancel.gemspec index 8230ce6..7bd6923 100644 --- a/activejob-cancel.gemspec +++ b/activejob-cancel.gemspec @@ -19,15 +19,4 @@ Gem::Specification.new do |spec| spec.add_dependency 'activejob', '>= 4.2.0' spec.add_dependency 'activesupport', '>= 4.2.0' - spec.add_development_dependency "bundler" - spec.add_development_dependency "rake" - spec.add_development_dependency "minitest" - spec.add_development_dependency "sidekiq" - spec.add_development_dependency "activerecord", '>= 4.2.0' - spec.add_development_dependency "delayed_job" - spec.add_development_dependency "delayed_job_active_record" - spec.add_development_dependency "resque" - spec.add_development_dependency "resque-scheduler" - spec.add_development_dependency "sqlite3" - spec.add_development_dependency "byebug" end From e607fbf54b2b6c88e5691ca533689d4ff27db966 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Wed, 17 Jan 2024 07:56:29 +0900 Subject: [PATCH 10/11] Add `debug` gem --- gemfiles/active_job_60.gemfile | 1 + gemfiles/active_job_61.gemfile | 1 + gemfiles/active_job_70.gemfile | 1 + gemfiles/active_job_71.gemfile | 1 + 4 files changed, 4 insertions(+) diff --git a/gemfiles/active_job_60.gemfile b/gemfiles/active_job_60.gemfile index 4405dd9..1fdbf02 100644 --- a/gemfiles/active_job_60.gemfile +++ b/gemfiles/active_job_60.gemfile @@ -11,3 +11,4 @@ gem 'sqlite3' gem 'activesupport', '~> 6.0.0' gem 'activejob', '~> 6.0.0' gem 'activerecord', '~> 6.0.0' +gem 'debug' diff --git a/gemfiles/active_job_61.gemfile b/gemfiles/active_job_61.gemfile index 5bd2c6a..058c8e6 100644 --- a/gemfiles/active_job_61.gemfile +++ b/gemfiles/active_job_61.gemfile @@ -11,3 +11,4 @@ gem 'sqlite3' gem 'activesupport', '~> 6.1.0' gem 'activejob', '~> 6.1.0' gem 'activerecord', '~> 6.1.0' +gem 'debug' diff --git a/gemfiles/active_job_70.gemfile b/gemfiles/active_job_70.gemfile index b417564..b108bdd 100644 --- a/gemfiles/active_job_70.gemfile +++ b/gemfiles/active_job_70.gemfile @@ -11,3 +11,4 @@ gem 'sqlite3' gem 'activesupport', '~> 7.0.0' gem 'activejob', '~> 7.0.0' gem 'activerecord', '~> 7.0.0' +gem 'debug' diff --git a/gemfiles/active_job_71.gemfile b/gemfiles/active_job_71.gemfile index 5054fc0..e38b369 100644 --- a/gemfiles/active_job_71.gemfile +++ b/gemfiles/active_job_71.gemfile @@ -11,3 +11,4 @@ gem 'sqlite3' gem 'activesupport', '~> 7.1.0' gem 'activejob', '~> 7.1.0' gem 'activerecord', '~> 7.1.0' +gem 'debug' From 8fb6f50297a94335af393d1046ff88eeb2501cf7 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 21 Jan 2024 08:45:31 +0900 Subject: [PATCH 11/11] Wait to start Sidekiq --- test/support/sidekiq/test_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/support/sidekiq/test_helper.rb b/test/support/sidekiq/test_helper.rb index 7a13012..c5212e1 100644 --- a/test/support/sidekiq/test_helper.rb +++ b/test/support/sidekiq/test_helper.rb @@ -30,6 +30,7 @@ def execute_with_launcher sidekiq = Sidekiq::Launcher.new(config) sidekiq.run + sleep 0.2 yield sidekiq.stop end