Skip to content

Commit

Permalink
Merge pull request #355 from redis-store/add-github-actions
Browse files Browse the repository at this point in the history
add github actions
  • Loading branch information
tubbo committed Feb 24, 2023
2 parents ff1059b + aec6280 commit e527c99
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 69 deletions.
13 changes: 13 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
changelog:
exclude:
labels: [dependencies]
authors: [renovate-bot]
categories:
- title: Breaking Changes
labels: [breaking]
- title: New Features
labels: [enhancement]
- title: Bug Fixes
labels: [bug]
- title: Other Changes
labels: ["*"]
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI
on: [push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: "test (ruby: ${{ matrix.ruby }}, redis.rb: ${{ matrix.redis }})"
runs-on: ubuntu-latest
continue-on-error: ${{ contains(matrix.ruby, 'head') }}
strategy:
fail-fast: false
matrix:
ruby:
- "2.7"
- "3.0"
- "3.1"
# - 'head'
- "jruby"
# - 'jruby-head'
- "truffleruby"
# - 'truffleruby-head'
redis:
- 4_0_x
- 4_1_x
- 4_x
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/redis_${{ matrix.redis }}.gemfile
services:
redis:
image: redis
ports:
- 6379:6379
distributed1:
image: redis
ports:
- 6380:6380
distributed2:
image: redis
ports:
- 6381:6381
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- run: bundle exec rake lint
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish
on:
push:
tags: [v*]
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-ruby@v3
with:
ruby-version: 3.1
bundle-cache: true
- run: |
cat << EOF > ~/.gem/credentials
---
:rubygems_api_key: ${secrets.RUBYGEMS_API_KEY}
EOF
chmod 0600 ~/.gem/credentials
- run: bundle exec rake release
- uses: softprops/action-gh-release@v1
with:
files: "*.gem"
generate_release_notes: true
prerelease: ${{ contains(github.ref, '.pre') }}
16 changes: 5 additions & 11 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@ AllCops:
# to ignore them, so only the ones explicitly set in this file are enabled.
DisabledByDefault: true
Exclude:
- '**/vendor/**/*'
- "**/vendor/**/*"

# Prefer &&/|| over and/or.
Style/AndOr:
Enabled: true

# Do not use braces for hash literals when they are the last argument of a
# method call.
Style/BracesAroundHashParameters:
Enabled: true
EnforcedStyle: context_dependent

# Align comments with method definitions.
Layout/CommentIndentation:
Enabled: true
Expand Down Expand Up @@ -46,7 +40,7 @@ Layout/FirstParameterIndentation:
# extra level of indentation.
Layout/IndentationConsistency:
Enabled: true
EnforcedStyle: rails
EnforcedStyle: indented_internal_methods

# Two spaces, no tabs (for indentation).
Layout/IndentationWidth:
Expand Down Expand Up @@ -99,19 +93,19 @@ Layout/SpaceInsideParens:
Enabled: true

# Detect hard tabs, no hard tabs.
Layout/Tab:
Layout/IndentationStyle:
Enabled: true

# Blank lines should not have any spaces.
Layout/TrailingBlankLines:
Layout/TrailingEmptyLines:
Enabled: true

# No trailing whitespace.
Layout/TrailingWhitespace:
Enabled: true

# Use quotes for string literals when they are enough.
Style/UnneededPercentQ:
Style/RedundantPercentQ:
Enabled: true

# Align `end` with the matching keyword or starting expression except for
Expand Down
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require 'rubocop/rake_task'

RuboCop::RakeTask.new :lint

if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
if !ENV["APPRAISAL_INITIALIZED"] && !ENV["CI"]
task :default do
sh "appraisal install && rake appraisal default"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/redis/store/namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def scan(cursor, match: nil, **kwargs)
if match
namespace(match) do |pattern|
cursor, keys = super(cursor, match: pattern, **kwargs)
[ cursor, keys.map{ |key| strip_namespace(key) } ]
[ cursor, keys.map { |key| strip_namespace(key) } ]
end
else
super(cursor, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion test/redis/distributed_store_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ def teardown
@dmr.get "rabbit"
end
end
end
end unless ENV['CI']
2 changes: 1 addition & 1 deletion test/redis/store/namespace_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe "Redis::Store::Namespace" do
def setup
@namespace = "theplaylist"
@store = Redis::Store.new :namespace => @namespace, :serializer => nil
@store = Redis::Store.new :namespace => @namespace, :serializer => nil
@client = @store.instance_variable_get(:@client)
@rabbit = "bunny"
@default_store = Redis::Store.new
Expand Down
32 changes: 17 additions & 15 deletions test/redis/store/serialization_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,24 @@ def teardown
_(@store.get("rabbit2")).must_be_nil
end

it "marshals setex (over a distributed store)" do
@store = Redis::DistributedStore.new [
{ :host => "localhost", :port => "6380", :db => 0 },
{ :host => "localhost", :port => "6381", :db => 0 }
]
@store.setex "rabbit", 50, @white_rabbit
_(@store.get("rabbit")).must_equal(@white_rabbit)
end
unless ENV['CI']
it "marshals setex (over a distributed store)" do
@store = Redis::DistributedStore.new [
{ :host => "localhost", :port => "6380", :db => 0 },
{ :host => "localhost", :port => "6381", :db => 0 }
]
@store.setex "rabbit", 50, @white_rabbit
_(@store.get("rabbit")).must_equal(@white_rabbit)
end

it "doesn't marshal setex if raw option is true (over a distributed store)" do
@store = Redis::DistributedStore.new [
{ :host => "localhost", :port => "6380", :db => 0 },
{ :host => "localhost", :port => "6381", :db => 0 }
]
@store.setex "rabbit", 50, @white_rabbit, :raw => true
_(@store.get("rabbit", :raw => true)).must_equal(%(#<OpenStruct color="white">))
it "doesn't marshal setex if raw option is true (over a distributed store)" do
@store = Redis::DistributedStore.new [
{ :host => "localhost", :port => "6380", :db => 0 },
{ :host => "localhost", :port => "6381", :db => 0 }
]
@store.setex "rabbit", 50, @white_rabbit, :raw => true
_(@store.get("rabbit", :raw => true)).must_equal(%(#<OpenStruct color="white">))
end
end

it "unmarshals on multi get" do
Expand Down

0 comments on commit e527c99

Please sign in to comment.