Skip to content

Commit

Permalink
Add redis service to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Verseth committed Nov 15, 2024
1 parent 63ce680 commit de45ad5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,23 @@ on:
jobs:
test:
runs-on: ubuntu-latest
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
CI: true
# The hostname used to communicate with the Redis service container
REDIS_HOST: redis
# The default Redis port
REDIS_PORT: 6379
strategy:
matrix:
ruby-version: ['3.1', '3.2', '3.3']
Expand Down
4 changes: 3 additions & 1 deletion test/simple_feature_flags/redis_storage_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def setup
file = Tempfile.new("feature_flags_#{Time.now.to_i}")
File.write(T.must(file.path), T.unsafe(flags).to_yaml)

redis = Redis.new(db: 14)
host = ENV['REDIS_HOST'] || 'localhost'
port = ENV['REDIS_PORT'] || '6379'
redis = Redis.new(host: host, port: port, db: 14)
redis_namespaced = Redis::Namespace.new(:feature_flags, redis: redis)

# clean redis before each test
Expand Down

0 comments on commit de45ad5

Please sign in to comment.