Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for 4.1.0 #342

Merged
merged 22 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:
schedule:
- cron: '30 21 * * 0'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
Expand All @@ -42,31 +46,31 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
27 changes: 22 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Test
name: Lint & Test
on: push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# test_rails:
# runs-on: ubuntu-latest
Expand Down Expand Up @@ -31,12 +34,25 @@ jobs:
# run: |
# cd test/rails-tests/
# sh rails523.sh
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Run rubocop
run: bundle exec rubocop
env:
RUBY_YJIT_ENABLE: true
test:
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
ruby_version: ['2.6', '2.7', '3.0', '3.1']
ruby_version: ['3.0', '3.1', '3.2', '3.3']
services:
postgres:
image: postgres
Expand All @@ -50,15 +66,15 @@ jobs:
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install postgresql-client
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
bundler-cache: true
- name: Run tests
run: bundle exec rake
env:
Expand All @@ -68,4 +84,5 @@ jobs:
DATABASE_URL: postgres://postgres:postgres@localhost/postgres
QC_BENCHMARK: true
QC_BENCHMARK_MAX_TIME_DEQUEUE: 60
QC_BENCHMARK_MAX_TIME_ENQUEUE: 10
QC_BENCHMARK_MAX_TIME_ENQUEUE: 10
RUBY_YJIT_ENABLE: true
19 changes: 19 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
AllCops:
NewCops: enable
TargetRubyVersion: 3.0
Exclude:
- 'vendor/**/*'
Layout/LineLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/BlockLength:
Enabled: false
Naming/MethodParameterName:
Enabled: false
Metrics/AbcSize:
Enabled: false
Naming/VariableNumber:
Enabled: false
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.3.0
10 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# frozen_string_literal: true

# this, is dumb, but stops errors
source 'https://rubygems.org'

source 'https://rubygems.org' do
gem 'rake'

gemspec

group :development do
gem 'rubocop'
end

group :development, :test do
gem 'activerecord', '>= 5.0.0', '< 6.1'
end

group :test do
gem 'minitest', '~> 5.8'
gem 'minitest-reporters'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ A major benefit is the ability to enqueue inside transactions, ensuring things a

### Requirements
For this version, the requirements are as follows:
* Ruby 2.6, 2.7, 3.0, 3.1 - i.e. currently supported Ruby versions
* Ruby 3.0, 3.1, 3.2, 3.3 - i.e. currently supported non-EOL Ruby versions
* Postgres ~> 9.6
* Rubygem: pg ~> 1.1

Expand Down Expand Up @@ -212,7 +212,7 @@ bundle exec rake db:migrate
```

#### Database connection
Starting with with queue_classic 3.1, Rails is automatically detected and its connection is used. If you don't want to use the automatic database connection, set this environment variable to false: `export QC_RAILS_DATABASE=false`.
Starting with with queue_classic 3.1, Rails is automatically detected and its connection is used. If you don't want to use the automatic database connection, set this environment variable to false: `export QC_RAILS_DATABASE=false`.

> **Note:** If you do not share the connection, you cannot enqueue in the same transaction as whatever you're doing in Rails.
Expand Down
12 changes: 6 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# frozen_string_literal: true

$:.unshift("lib")
$LOAD_PATH.unshift('lib')

require "bundler/gem_tasks"
require "rake/testtask"
require "./lib/queue_classic"
require "./lib/queue_classic/tasks"
require 'bundler/gem_tasks'
require 'rake/testtask'
require './lib/queue_classic'
require './lib/queue_classic/tasks'

task :default => ['test']
task default: ['test']
Rake::TestTask.new do |t|
t.libs << 'test'
t.test_files = FileList['test/**/*_test.rb']
Expand Down
29 changes: 8 additions & 21 deletions lib/generators/queue_classic/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
require 'active_record'

module QC
# Install generator to create migration files for rails
class InstallGenerator < Rails::Generators::Base
include Rails::Generators::Migration

namespace "queue_classic:install"
self.source_paths << File.join(File.dirname(__FILE__), 'templates')
namespace 'queue_classic:install'
source_paths << File.join(File.dirname(__FILE__), 'templates')
desc 'Generates (but does not run) a migration to add a queue_classic table.'

def self.next_migration_number(dirname)
Expand All @@ -18,25 +19,11 @@ def self.next_migration_number(dirname)
end

def create_migration_file
if self.class.migration_exists?('db/migrate', 'add_queue_classic').nil?
migration_template 'add_queue_classic.rb', 'db/migrate/add_queue_classic.rb'
end

if self.class.migration_exists?('db/migrate', 'update_queue_classic_3_0_0').nil?
migration_template 'update_queue_classic_3_0_0.rb', 'db/migrate/update_queue_classic_3_0_0.rb'
end

if self.class.migration_exists?('db/migrate', 'update_queue_classic_3_0_2').nil?
migration_template 'update_queue_classic_3_0_2.rb', 'db/migrate/update_queue_classic_3_0_2.rb'
end

if self.class.migration_exists?('db/migrate', 'update_queue_classic_3_1_0').nil?
migration_template 'update_queue_classic_3_1_0.rb', 'db/migrate/update_queue_classic_3_1_0.rb'
end

if self.class.migration_exists?('db/migrate', 'update_queue_classic_4_0_0').nil?
migration_template 'update_queue_classic_4_0_0.rb', 'db/migrate/update_queue_classic_4_0_0.rb'
end
migration_template 'add_queue_classic.rb', 'db/migrate/add_queue_classic.rb' if self.class.migration_exists?('db/migrate', 'add_queue_classic').nil?
migration_template 'update_queue_classic_3_0_0.rb', 'db/migrate/update_queue_classic_3_0_0.rb' if self.class.migration_exists?('db/migrate', 'update_queue_classic_3_0_0').nil?
migration_template 'update_queue_classic_3_0_2.rb', 'db/migrate/update_queue_classic_3_0_2.rb' if self.class.migration_exists?('db/migrate', 'update_queue_classic_3_0_2').nil?
migration_template 'update_queue_classic_3_1_0.rb', 'db/migrate/update_queue_classic_3_1_0.rb' if self.class.migration_exists?('db/migrate', 'update_queue_classic_3_1_0').nil?
migration_template 'update_queue_classic_4_0_0.rb', 'db/migrate/update_queue_classic_4_0_0.rb' if self.class.migration_exists?('db/migrate', 'update_queue_classic_4_0_0').nil?
end
end
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

# add QC
class AddQueueClassic < ActiveRecord::Migration[4.2]
def self.up
QC::Setup.create
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

# update QC
class UpdateQueueClassic300 < ActiveRecord::Migration[4.2]
def self.up
QC::Setup.update_to_3_0_0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

# update QC
class UpdateQueueClassic302 < ActiveRecord::Migration[4.2]
def self.up
QC::Setup.update_to_3_0_0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

# update QC
class UpdateQueueClassic310 < ActiveRecord::Migration[4.2]
def self.up
QC::Setup.update_to_3_1_0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

# update QC
class UpdateQueueClassic400 < ActiveRecord::Migration[4.2]
def self.up
QC::Setup.update_to_4_0_0
Expand Down
Loading
Loading