Skip to content

Commit

Permalink
Bringing changes from sidekiq-alive-next (#72)
Browse files Browse the repository at this point in the history
* Create dependabot.yml

* Remove deprecated options call on config

* Clean up logging and add ability to set custom logger

* Clean up code and add shutdown callback

* Regenerate gemfile

* Correctly set sidekiq queues

* Update workflow

* Add github-actions to dep updates

* Add lockfile platforms

* Update version to 2.2.0

* Bump actions/checkout from 2 to 3 (#7)

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Rename gem to sidekiq-alive (#8)

* Add release and changelog workflow (#10)

* Add release and changelog workflow

* Set custom label for actions deps

* Fix setting custom sidekiq queue (#9)

* Move all configuration in to startup block

* Check respond to on config object

* Update specs

* Run specs in random order

* Set git identity for release workflow

* Rename gem to sidekiq-alive-next

* Update README.md

* Create github release in the same job

* Update gemspec metadata (#11)

* Update gemspec metadata

* Require ruby 2.7

* Add static rubocop checks (#12)

* Add static rubocop checks

* Allign arguments

* Automate release (#13)

* Add rake task to update version

* Add version update steps

* Unset deployment mode for release

* Add release ssh key for release workflow

* Checkout tag in release

* Add additional details to startup info (#14)

* Use scan for finding and purging jobs (#15)

* Add changelog workflow (#16)

* Bump rspec from 3.11.0 to 3.12.0 (#17)

Bumps [rspec](https://github.com/rspec/rspec-metagem) from 3.11.0 to 3.12.0.
- [Release notes](https://github.com/rspec/rspec-metagem/releases)
- [Commits](rspec/rspec-metagem@v3.11.0...v3.12.0)

---
updated-dependencies:
- dependency-name: rspec
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Sidekiq 7 support (#19)

* Update sidekiq requirement from >= 5, < 7 to >= 5, < 8

Updates the requirements on [sidekiq](https://github.com/mperham/sidekiq) to permit the latest version.
- [Release notes](https://github.com/mperham/sidekiq/releases)
- [Changelog](https://github.com/mperham/sidekiq/blob/main/Changes.md)
- [Commits](sidekiq/sidekiq@v6.5.7...v7.0.0)

---
updated-dependencies:
- dependency-name: sidekiq
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update for sidekiq 7 compatibility

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update README.md

* Update changelog.yml

* Use ruby 3.1.2 for development

* Replace pry with debug gem

* Update rack requirement from >= 2.2.4, < 3 to >= 3, < 4 (#20)

* Update rack requirement from >= 2.2.4, < 3 to >= 2.2.4, < 4

Updates the requirements on [rack](https://github.com/rack/rack) to permit the latest version.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](rack/rack@2.2.4...3.0.0)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Add rackup gem and improve tests

* Narrow down rack requirement

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrejs Cunskis <[email protected]>

* Update nokogiri and workflow ruby setup

* Bump sidekiq from 7.0.0 to 7.0.1 (#21)

Bumps [sidekiq](https://github.com/mperham/sidekiq) from 7.0.0 to 7.0.1.
- [Release notes](https://github.com/mperham/sidekiq/releases)
- [Changelog](https://github.com/mperham/sidekiq/blob/main/Changes.md)
- [Commits](sidekiq/sidekiq@v7.0.0...v7.0.1)

---
updated-dependencies:
- dependency-name: sidekiq
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump rackup from 0.2.2 to 0.2.3 (#22)

Bumps [rackup](https://github.com/rack/rackup) from 0.2.2 to 0.2.3.
- [Release notes](https://github.com/rack/rackup/releases)
- [Commits](rack/rackup@v0.2.2...v0.2.3)

---
updated-dependencies:
- dependency-name: rackup
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump rack from 3.0.0 to 3.0.1 (#23)

Bumps [rack](https://github.com/rack/rack) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](rack/rack@3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump sidekiq from 7.0.1 to 7.0.2 (#24)

Bumps [sidekiq](https://github.com/mperham/sidekiq) from 7.0.1 to 7.0.2.
- [Release notes](https://github.com/mperham/sidekiq/releases)
- [Changelog](https://github.com/mperham/sidekiq/blob/main/Changes.md)
- [Commits](sidekiq/sidekiq@v7.0.1...v7.0.2)

---
updated-dependencies:
- dependency-name: sidekiq
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Loosen rackup requirement (#25)

* Bump rack from 3.0.1 to 3.0.2 (#27)

Bumps [rack](https://github.com/rack/rack) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](rack/rack@v3.0.1...v3.0.2)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump debug from 1.6.3 to 1.7.0 (#26)

Bumps [debug](https://github.com/ruby/debug) from 1.6.3 to 1.7.0.
- [Release notes](https://github.com/ruby/debug/releases)
- [Commits](ruby/debug@v1.6.3...v1.7.0)

---
updated-dependencies:
- dependency-name: debug
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* renaming back and apply changes

* rubocop fix

* rubocop fix (for real)

* add comment to why different ways to access to queues

* use badges from this repo

* Remove breaking version restrictions

Add testing with multiple sidekiq versions

Remove rack version requirement

* Enable new cops by default

* Ignore load error for sidekiq/capsule

* Move dynamic sidekiq version definition to Gemfile

* Improve sidekiq version detection

* Add redis client wrappers

* Remove redundant module function

* Fix sq_config mocking

* fix sidekiq 5

* Update release actions

* improve Helpers version

* Update release.yml for default project labels

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Andrejs <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 22, 2022
1 parent 04202a6 commit e686c88
Show file tree
Hide file tree
Showing 27 changed files with 689 additions and 445 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: "daily"
reviewers:
- "andrcuns"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "daily"
reviewers:
- andrcuns
labels:
- "ci"
11 changes: 11 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
changelog:
categories:
- title: '🚀 New feature or request'
labels:
- 'enhancement'
- title: '🐞 Bug Fixes'
labels:
- 'bug'
- title: '📦 Dependency updates'
labels:
- 'dependencies'
20 changes: 20 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Changelog

on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+

jobs:
release:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: Release version
required: true
type: string

jobs:
release:
name: Ruby gem
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ssh-key: ${{ secrets.RELEASE_SSH_KEY }}
-
name: Set up Ruby 3.1
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
-
name: Update version
run: |
git config user.name github-actions
git config user.email [email protected]
bundle config unset deployment
bundle exec rake "version[${{ inputs.version }}]" && git push
-
name: Create tag and push to rubygems
run: bundle exec rake release
env:
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
48 changes: 36 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
name: Ruby CI
name: Test

on:
push:
branches: [main, master]
branches:
- master
pull_request:
branches: [main, master]
branches:
- master

jobs:
test:
rubocop:
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
-
name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
cache-version: 1
-
name: Run lint
run: bundle exec rubocop --color

test:
runs-on: ubuntu-latest
needs: rubocop
strategy:
fail-fast: false
matrix:
ruby-version: ["3.1", "3.0", "2.7", "2.6", "2.5"]
# Service containers to run with `runner-job`
ruby-version: ["3.1", "3.0", "2.7"]
sidekiq-version: ["~> 5.2", "~> 6.5", "~> 7"]
# Service containers to run with `runner-job`
services:
# Label used to access the service container
redis:
Expand All @@ -30,12 +49,17 @@ jobs:
- 6379:6379

steps:
- uses: actions/checkout@v2
- name: Set up Ruby ${{ matrix.ruby-version }}
-
uses: actions/checkout@v3
-
name: Set up Ruby ${{ matrix.ruby-version }} with Sidekiq ${{ matrix.sidekiq-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Install dependencies
run: bundle install
- name: Run tests
run: bundle exec rspec
bundler-cache: true
cache-version: 1
env:
SIDEKIQ_VERSION_RANGE: ${{ matrix.sidekiq-version }}
-
name: Run tests
run: bundle exec rspec --force-color
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/pkg/
/spec/reports/
/tmp/
Gemfile.lock

# rspec failure tracking
.rspec_status
Expand Down
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--format documentation
--color
--require spec_helper
--order random
11 changes: 11 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
inherit_gem:
rubocop-shopify: rubocop.yml

AllCops:
TargetRubyVersion: 2.7
SuggestExtensions: false
NewCops: enable

Layout/ArgumentAlignment:
Enabled: true
EnforcedStyle: with_first_argument
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.2
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
source 'https://rubygems.org'
# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in sidekiq_alive.gemspec
gemspec

gem 'pry'
gem "sidekiq", ENV["SIDEKIQ_VERSION_RANGE"] || "< 8"
60 changes: 0 additions & 60 deletions Gemfile.lock

This file was deleted.

10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,19 @@ SidekiqAlive.setup do |config|
# require 'net/http'
# config.callback = proc { Net::HTTP.get("https://status.com/ping") }

# ==> Shutdown callback
# When sidekiq process is shutting down, you can perform some action, like cleaning up created queue
# default: proc {}
#
# config.shutdown_callback = proc do
# Sidekiq::Queue.all.find { |q| q.name == "#{queue_prefix}-#{SidekiqAlive.hostname}" }&.clear
# end

# ==> Queue Prefix
# SidekiqAlive will run in a independent queue for each instance/replica
# This queue name will be generated with: "#{queue_prefix}-#{hostname}.
# You can customize the prefix here.
# default: :sidekiq_alive
# default: :sidekiq-alive
#
# config.queue_prefix = :other

Expand Down
21 changes: 19 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task default: :spec

desc "Update version"
task :version, :new_version do |_, args|
version_path = "lib/sidekiq_alive/version.rb"
new_version = args[:new_version]
version_file = File.read(version_path)

version_file.match(/VERSION = "(.*)"/)[1].then do |version|
File.write(version_path, version_file.gsub(version, new_version))
end

sh("bundle install")
sh("git add #{version_path} Gemfile.lock")
sh("git commit -m 'Update version to #{new_version}'")
end
7 changes: 4 additions & 3 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'sidekiq_alive'
require "bundler/setup"
require "sidekiq_alive"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand All @@ -10,5 +11,5 @@ require 'sidekiq_alive'
# require "pry"
# Pry.start

require 'irb'
require "irb"
IRB.start(__FILE__)
Loading

0 comments on commit e686c88

Please sign in to comment.