Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into relatel-4-1-12
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/ci.yml
  • Loading branch information
c960657 committed Oct 31, 2024
2 parents feee593 + fc3dfda commit 6cca077
Show file tree
Hide file tree
Showing 15 changed files with 201 additions and 34 deletions.
89 changes: 81 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,109 @@ on:

jobs:
test:
runs-on: ubuntu-latest
name: Test (Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails_version }})
runs-on: ubuntu-${{ matrix.ubuntu }}
strategy:
fail-fast: false
matrix:
ruby: [2.5, 2.6, 2.7, 3.0, jruby, jruby-head, ruby-head]
ruby: ['3.1', '3.2', '3.3', jruby-9.4, jruby-head, ruby-head]
rails_version:
- '5.2.5'
- '6.0.0'
- '6.1.0'
- '7.0.0'
- '7.1.0'
- '7.2.0'
- 'edge'
ubuntu: [latest]
include:
# Ruby 2.6
- ruby: 2.6
rails_version: '6.0.0'
ubuntu: '20.04'
- ruby: 2.6
rails_version: '6.1.0'
ubuntu: '20.04'

# jruby-9.2
- ruby: jruby-9.2
rails_version: '6.0.0'
ubuntu: '20.04'
- ruby: jruby-9.2
rails_version: '6.1.0'
ubuntu: '20.04'

#
# The past
#
# EOL Active Record
- ruby: 2.2
rails_version: '3.2.0'
ubuntu: '20.04'
- ruby: 2.1
rails_version: '4.1.0'
ubuntu: '20.04'
- ruby: 2.4
rails_version: '4.2.0'
ubuntu: '20.04'
- ruby: 2.4
rails_version: '5.0.0'
ubuntu: '20.04'
- ruby: 2.5
rails_version: '5.1.0'
ubuntu: '20.04'
- ruby: 2.6
rails_version: '5.2.0'
ubuntu: '20.04'
- ruby: 2.7
rails_version: '5.2.0'
ubuntu: '22.04'
- ruby: jruby-9.2
rails_version: '5.2.0'
ubuntu: '22.04'
- ruby: 2.7
rails_version: '6.0.0'
ubuntu: '22.04'
- ruby: 3.0
rails_version: '6.0.0'
ubuntu: '22.04'
- ruby: 3.2
rails_version: '6.0.0'
ubuntu: '22.04'
- ruby: jruby-9.4
rails_version: '6.0.0'
ubuntu: '22.04'
- ruby: 2.7
rails_version: '6.1.0'
ubuntu: '22.04'
- ruby: 3.0
rails_version: '6.1.0'
ubuntu: '22.04'
- ruby: 3.2
rails_version: '6.1.0'
ubuntu: '22.04'
- ruby: jruby-9.4
rails_version: '6.0.0'
ubuntu: '22.04'
- ruby: 2.7
rails_version: '7.0.0'
ubuntu: '22.04'
- ruby: 3.0
rails_version: '7.0.0'
ubuntu: '22.04'
- ruby: jruby-9.4
rails_version: '6.0.0'
ubuntu: '22.04'

# EOL Ruby
- ruby: 2.7
rails_version: '7.1.0'
ubuntu: '22.04'
- ruby: 3.0
rails_version: '7.1.0'
ubuntu: '22.04'

continue-on-error: ${{ matrix.rails_version == 'edge' || endsWith(matrix.ruby, 'head') }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
env:
RAILS_VERSION: ${{ matrix.rails_version }}
Expand All @@ -49,7 +122,7 @@ jobs:
RAILS_VERSION: ${{ matrix.rails_version }}
run: bundle exec rspec
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.github_token }}
flag-name: run-${{ matrix.ruby }}-${{ matrix.rails_version }}
Expand All @@ -60,7 +133,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
28 changes: 28 additions & 0 deletions .github/workflows/publish_gem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish Gem

on:
push:
tags:
- v*

jobs:
push:
if: github.repository == 'collectiveidea/delayed_job'
runs-on: ubuntu-latest
environment: publishing

permissions:
contents: write
id-token: write

steps:
# Set up
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ruby

# Release
- uses: rubygems/release-gem@v1
4 changes: 2 additions & 2 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Generate lockfile for cache key
run: bundle lock
- name: Cache gems
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
4.1.12 - 2024-08-14
=======================
* Add missing require for extract_options
* Fix rails 7.2 ActiveSupport::ProxyObject deprecation
* Multiple contributors on current and legacy test suite improvements

4.1.12.rc1 - 2024-08-13
=======================
* Validating trusted publishing release
* Add missing require for extract_options
* Fix rails 7.2 ActiveSupport::ProxyObject deprecation
* Multiple contributors on current and legacy test suite improvements

4.1.11 - 2022-09-28
===================
* Fix missing require for Rails 7.0.3+

4.1.10 - 2022-01-17
===================
* Support for Rails 7.0. NOTE: If you are using Delayed Job independent of Rails, Active Support 7 has dropped classic dependency autoloading. You will need to add and setup zeitwerk for autoloading to continue working in ActiveSupport 7.

4.1.9 - 2020-12-09
==================
* Support for Rails 6.1
Expand Down
32 changes: 29 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ platforms :ruby do
# Rails 6 now requires sqlite 1.4
if ENV['RAILS_VERSION'] && ENV['RAILS_VERSION'] < '5.1'
gem 'sqlite3', '< 1.4'
elsif ENV['RAILS_VERSION'] && ENV['RAILS_VERSION'] < '7.2'
gem 'sqlite3', '~> 1.4'
else
gem 'sqlite3'
end
Expand All @@ -15,13 +17,22 @@ end
platforms :jruby do
if ENV['RAILS_VERSION'] == '4.2.0'
gem 'activerecord-jdbcsqlite3-adapter', '< 50.0'
elsif ENV['RAILS_VERSION'] == 'edge' || ENV['RAILS_VERSION'] == '6.1.0.rc2'
gem 'activerecord-jdbcsqlite3-adapter', :github => 'jruby/activerecord-jdbc-adapter'
elsif ENV['RAILS_VERSION'] == '5.0.0'
gem 'activerecord-jdbcsqlite3-adapter', '~> 50.0'
elsif ENV['RAILS_VERSION'] == '5.1.0'
gem 'activerecord-jdbcsqlite3-adapter', '~> 51.0'
elsif ENV['RAILS_VERSION'] == '5.2.0'
gem 'activerecord-jdbcsqlite3-adapter', '~> 52.0'
elsif ENV['RAILS_VERSION'] == '6.0.0'
gem 'activerecord-jdbcsqlite3-adapter', '~> 60.0'
elsif ENV['RAILS_VERSION'] == '6.1.0'
gem 'activerecord-jdbcsqlite3-adapter', '~> 61.0'
else
gem 'activerecord-jdbcsqlite3-adapter'
end
gem 'jruby-openssl'
gem 'mime-types', ['~> 2.6', '< 2.99']

if ENV['RAILS_VERSION'] == 'edge'
gem 'railties', :github => 'rails/rails'
elsif ENV['RAILS_VERSION']
Expand All @@ -42,11 +53,16 @@ group :test do
elsif ENV['RAILS_VERSION']
gem 'actionmailer', "~> #{ENV['RAILS_VERSION']}"
gem 'activerecord', "~> #{ENV['RAILS_VERSION']}"
if ENV['RAILS_VERSION'] < '5.1'
gem 'loofah', '2.3.1'
gem 'nokogiri', '< 1.11.0'
gem 'rails-html-sanitizer', '< 1.4.0'
end
else
gem 'actionmailer', ['>= 3.0', '< 8.0']
gem 'activerecord', ['>= 3.0', '< 8.0']
end

gem 'net-smtp' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')
gem 'rspec', '>= 3'
gem 'simplecov', :require => false
if /\A2.[12]/ =~ RUBY_VERSION
Expand All @@ -55,6 +71,16 @@ group :test do
else
gem 'simplecov-lcov', :require => false
end
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3.0')
# New dependencies with a deprecation notice in Ruby 3.3 and required in Ruby 3.4
# Probably won't get released in rails 7.0
gem 'base64'
gem 'bigdecimal'
gem 'mutex_m'
end
if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] >= '6.0.0'
gem 'zeitwerk', :require => false
end
end

group :rubocop do
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
**If you're viewing this at https://github.com/collectiveidea/delayed_job,
you're reading the documentation for the master branch.
[View documentation for the latest release
(4.1.9).](https://github.com/collectiveidea/delayed_job/tree/v4.1.9)**
(4.1.12).](https://github.com/collectiveidea/delayed_job/tree/v4.1.12)**

Delayed::Job
============
Expand Down
2 changes: 1 addition & 1 deletion delayed_job.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']
spec.summary = 'Database-backed asynchronous priority queue system -- Extracted from Shopify'
spec.test_files = Dir.glob('spec/**/*')
spec.version = '4.1.9'
spec.version = '4.1.12'
spec.metadata = {
'changelog_uri' => 'https://github.com/collectiveidea/delayed_job/blob/master/CHANGELOG.md',
'bug_tracker_uri' => 'https://github.com/collectiveidea/delayed_job/issues',
Expand Down
2 changes: 2 additions & 0 deletions lib/delayed/backend/job_preparer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'active_support/core_ext/array/extract_options'

module Delayed
module Backend
class JobPreparer
Expand Down
9 changes: 7 additions & 2 deletions lib/delayed/backend/shared_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def create_job(opts = {})
end

it 'reserves jobs scheduled for the past when time zones are involved' do
Time.zone = 'US/Eastern'
Time.zone = 'America/New_York'
job = create_job :run_at => described_class.db_time_now - 1.minute
expect(described_class.reserve(worker)).to eq(job)
end
Expand Down Expand Up @@ -595,7 +595,12 @@ def create_job(opts = {})
worker.work_off
@job.reload
expect(@job.last_error).to match(/did not work/)
expect(@job.last_error).to match(/sample_jobs.rb:\d+:in `perform'/)
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.4.0')
# Ruby 3.4 produces a more verbose message
expect(@job.last_error).to match(/sample_jobs.rb:\d+:in 'ErrorJob#perform'/)
else
expect(@job.last_error).to match(/sample_jobs.rb:\d+:in `perform'/)
end
expect(@job.attempts).to eq(1)
expect(@job.run_at).to be > Delayed::Job.db_time_now - 10.minutes
expect(@job.run_at).to be < Delayed::Job.db_time_now + 10.minutes
Expand Down
12 changes: 0 additions & 12 deletions lib/delayed/compatibility.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,13 @@
module Delayed
module Compatibility
if ActiveSupport::VERSION::MAJOR >= 4
require 'active_support/proxy_object'

def self.executable_prefix
'bin'
end

def self.proxy_object_class
ActiveSupport::ProxyObject
end
else
require 'active_support/basic_object'

def self.executable_prefix
'script'
end

def self.proxy_object_class
ActiveSupport::BasicObject
end
end
end
end
12 changes: 11 additions & 1 deletion lib/delayed/message_sending.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
module Delayed
class DelayProxy < Delayed::Compatibility.proxy_object_class
class DelayProxy < BasicObject
# What additional methods exist on BasicObject has changed over time
(::BasicObject.instance_methods - [:__id__, :__send__, :instance_eval, :instance_exec]).each do |method|
undef_method method
end

# Let DelayProxy raise exceptions.
def raise(*args)
::Object.send(:raise, *args)
end

def initialize(payload_class, target, options)
@payload_class = payload_class
@target = target
Expand Down
1 change: 1 addition & 0 deletions lib/delayed/worker.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'timeout'
require 'active_support/dependencies'
require 'active_support/core_ext/kernel/reporting'
require 'active_support/core_ext/numeric/time'
require 'active_support/core_ext/class/attribute_accessors'
require 'active_support/hash_with_indifferent_access'
Expand Down
17 changes: 15 additions & 2 deletions spec/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,21 @@ def self.root

Delayed::Worker.backend = :test

# Add this directory so the ActiveSupport autoloading works
ActiveSupport::Dependencies.autoload_paths << File.dirname(__FILE__)
if ActiveSupport::VERSION::MAJOR < 7
require 'active_support/dependencies'

# Add this directory so the ActiveSupport autoloading works
ActiveSupport::Dependencies.autoload_paths << File.dirname(__FILE__)
else
# Rails 7 dropped classic dependency auto-loading. This does a basic
# zeitwerk setup to test against zeitwerk directly as the Rails zeitwerk
# setup is intertwined in the application boot process.
require 'zeitwerk'

loader = Zeitwerk::Loader.new
loader.push_dir File.dirname(__FILE__)
loader.setup
end

# Used to test interactions between DJ and an ORM
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
Expand Down
Loading

0 comments on commit 6cca077

Please sign in to comment.