Skip to content

Commit

Permalink
Merge branch 'main' into poll-cold-start-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunemaker committed Feb 4, 2025
2 parents e9f188f + c2d1c12 commit cd6541e
Show file tree
Hide file tree
Showing 141 changed files with 2,921 additions and 1,486 deletions.
33 changes: 27 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
services:
redis:
image: redis
ports: ['6379:6379']
ports: ["6379:6379"]
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
Expand All @@ -26,30 +26,51 @@ jobs:
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2']
rails: ['5.2', '6.0.0', '6.1.0', '7.0.0', '7.1.0']
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
rails: ["5.2", "6.0.0", "6.1.0", "7.0.0", "7.1.0", "7.2.0", "8.0.0"]
exclude:
- ruby: "2.6"
rails: "7.1.0"
- ruby: "2.6"
rails: "7.0.0"
- ruby: "2.6"
rails: "7.2.0"
- ruby: "2.6"
rails: "8.0.0"
- ruby: "2.7"
rails: "7.1.0"
- ruby: "2.7"
rails: "7.2.0"
- ruby: "2.7"
rails: "8.0.0"
- ruby: "3.0"
rails: "5.2"
- ruby: "3.0"
rails: "7.2.0"
- ruby: "3.0"
rails: "8.0.0"
- ruby: "3.1"
rails: "5.2"
- ruby: "3.1"
rails: "6.0.0"
- ruby: "3.1"
rails: "8.0.0"
- ruby: "3.2"
rails: "5.2"
- ruby: "3.2"
rails: "6.0.0"
- ruby: "3.2"
rails: "6.1.0"
- ruby: "3.3"
rails: "5.2"
- ruby: "3.3"
rails: "6.0.0"
- ruby: "3.3"
rails: "6.1.0"
env:
SQLITE3_VERSION: 1.4.1
SQLITE3_VERSION: ${{ matrix.rails == '8.0.0' && '2.1.0' || '1.4.1' }}
REDIS_URL: redis://localhost:6379/0
CI: true
RAILS_VERSION: ${{ matrix.rails }}
Expand All @@ -63,13 +84,13 @@ jobs:
- name: Setup memcached
uses: KeisukeYamashita/memcached-actions@v1
- name: Start MongoDB
uses: supercharge/mongodb-github-action@v1.10.0
uses: supercharge/mongodb-github-action@1.12.0
with:
mongodb-version: 4.0
- name: Check out repository code
uses: actions/checkout@v4
- name: Do some action caching
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ hashFiles('**/Gemfile.lock') }}
Expand Down
32 changes: 26 additions & 6 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,71 @@ jobs:
services:
redis:
image: redis
ports: ['6379:6379']
ports: ["6379:6379"]
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2']
rails: ['5.2', '6.0.0', '6.1.0', '7.0.0', '7.1.0']
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
rails: ["5.2", "6.0.0", "6.1.0", "7.0.0", "7.1.0", "7.2.0", "8.0.0"]
exclude:
- ruby: "2.6"
rails: "7.1.0"
- ruby: "2.6"
rails: "7.0.0"
- ruby: "2.6"
rails: "7.2.0"
- ruby: "2.6"
rails: "8.0.0"
- ruby: "2.7"
rails: "7.1.0"
- ruby: "2.7"
rails: "7.2.0"
- ruby: "2.7"
rails: "8.0.0"
- ruby: "3.0"
rails: "5.2"
- ruby: "3.0"
rails: "7.2.0"
- ruby: "3.0"
rails: "8.0.0"
- ruby: "3.1"
rails: "5.2"
- ruby: "3.1"
rails: "6.0.0"
- ruby: "3.1"
rails: "8.0.0"
- ruby: "3.2"
rails: "5.2"
- ruby: "3.2"
rails: "6.0.0"
- ruby: "3.2"
rails: "6.1.0"
- ruby: "3.3"
rails: "5.2"
- ruby: "3.3"
rails: "6.0.0"
- ruby: "3.3"
rails: "6.1.0"
env:
SQLITE3_VERSION: 1.4.1
SQLITE3_VERSION: ${{ matrix.rails == '8.0.0' && '2.1.0' || '1.4.1' }}
REDIS_URL: redis://localhost:6379/0
CI: true
RAILS_VERSION: ${{ matrix.rails }}
steps:
- name: Setup memcached
uses: KeisukeYamashita/memcached-actions@v1
- name: Start MongoDB
uses: supercharge/mongodb-github-action@v1.10.0
uses: supercharge/mongodb-github-action@1.12.0
with:
mongodb-version: 4.0
- name: Check out repository code
uses: actions/checkout@v4
- name: Do some action caching
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ hashFiles('**/Gemfile.lock') }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ log
bin
.DS_Store
.tool-versions
tags
node_modules
11 changes: 7 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ Dir['flipper-*.gemspec'].each do |gemspec|
gemspec(name: "flipper-#{plugin}", development_group: plugin)
end

gem 'concurrent-ruby', '1.3.4'
gem 'debug'
gem 'rake'
gem 'statsd-ruby', '~> 1.2.1'
gem 'rspec', '~> 3.0'
gem 'rack-test'
gem 'rackup'
gem 'sqlite3', "~> #{ENV['SQLITE3_VERSION'] || '1.4.1'}"
gem 'rails', "~> #{ENV['RAILS_VERSION'] || '7.0.4'}"
gem 'rackup', '= 1.0.0'
gem 'sqlite3', "~> #{ENV['SQLITE3_VERSION'] || '2.1.0'}"
gem 'rails', "~> #{ENV['RAILS_VERSION'] || '8.0'}"
gem 'minitest', '~> 5.18'
gem 'minitest-documentation'
gem 'pstore'
gem 'webmock'
gem 'ice_age'
gem 'redis-namespace'
Expand All @@ -24,9 +26,10 @@ gem 'stackprof'
gem 'benchmark-ips'
gem 'stackprof-webnav'
gem 'flamegraph'
gem 'climate_control'
gem 'mysql2'
gem 'pg'
gem 'cuprite'
gem 'puma'

group(:guard) do
gem 'guard'
Expand Down
8 changes: 8 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ guard 'rspec', rspec_options do
watch('lib/flipper/api/middleware.rb') { 'spec/flipper/api_spec.rb' }
watch(/shared_adapter_specs\.rb$/) { 'spec' }
watch('spec/helper.rb') { 'spec' }
watch('lib/flipper/adapters/http/client.rb') { 'spec/flipper/adapters/http_spec.rb' }
watch('lib/flipper/adapters/cache_base.rb') {
[
'spec/flipper/adapters/redis_cache_spec.rb',
'spec/flipper/adapters/dalli_cache_spec.rb',
'spec/flipper/adapters/active_support_cache_store_spec.rb',
]
}

# To run all specs on every change... (useful with focus and fit)
# watch(%r{.*}) { 'spec' }
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Flipper Mark](docs/images/banner.jpg)](https://www.flippercloud.io)

[Website](https://flippercloud.io?utm_source=oss&utm_medium=readme&utm_campaign=website_link) | [Documentation](https://flippercloud.io/docs?utm_source=oss&utm_medium=readme&utm_campaign=docs_link) | [Examples](examples) | [Twitter](https://twitter.com/flipper_cloud) | [Ruby.social](https://ruby.social/@flipper)
[Website](https://flippercloud.io?utm_source=oss&utm_medium=readme&utm_campaign=website_link) | [Documentation](https://flippercloud.io/docs?utm_source=oss&utm_medium=readme&utm_campaign=docs_link) | [Examples](examples) | [Chat](https://chat.flippercloud.io/join/xjHq-aJsA-BeZH) | [Twitter](https://twitter.com/flipper_cloud) | [Ruby.social](https://ruby.social/@flipper)

# Flipper

Expand Down Expand Up @@ -111,3 +111,5 @@ We also have a [free plan](https://www.flippercloud.io?utm_source=oss&utm_medium
| ![@alexwheeler](https://avatars3.githubusercontent.com/u/3260042?s=64) | [@alexwheeler](https://github.com/alexwheeler) | api |
| ![@thetimbanks](https://avatars1.githubusercontent.com/u/471801?s=64) | [@thetimbanks](https://github.com/thetimbanks) | ui |
| ![@lazebny](https://avatars1.githubusercontent.com/u/6276766?s=64) | [@lazebny](https://github.com/lazebny) | docker |
| ![@pagertree](https://avatars.githubusercontent.com/u/24941240?s=64) | [@pagertree](https://github.com/pagertree) | sponsor |
| ![@kdaigle](https://avatars.githubusercontent.com/u/2501?s=64) | [@kdaigle](https://github.com/kdaigle) | sponsor |
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ end

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = %w(--color --format documentation)
t.rspec_opts = %w(--color)
t.verbose = false
end

namespace :spec do
Expand All @@ -41,7 +42,6 @@ end
Rake::TestTask.new do |t|
t.libs = %w(lib test)
t.pattern = 'test/**/*_test.rb'
t.options = '--documentation'
t.warning = false
end

Expand Down
7 changes: 5 additions & 2 deletions benchmark/active_record_adapter_ips.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@

flipper = Flipper.new(Flipper::Adapters::ActiveRecord.new)

2000.times do |i|
flipper.enable_actor :foo, Flipper::Actor.new("User;#{i}")
10.times do |n|
2000.times do |i|
flipper.enable_actor 'feature' + n.to_s, Flipper::Actor.new("User;#{i}")
end
end

Benchmark.ips do |x|
x.report("get_all") { flipper.preload_all }
x.report("features") { flipper.features }
end
Binary file modified docs/images/banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/cloud/backoff_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
intervals = []
policy = Flipper::Cloud::Telemetry::BackoffPolicy.new

10.times do |n|
5.times do |n|
intervals << policy.next_interval
end

Expand Down
7 changes: 5 additions & 2 deletions examples/ui/basic.ru
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ Flipper::UI.configure do |config|

config.actor_names_source = lambda do |_keys|
{
'1' => 'John',
'6' => 'Brandon',
'1' => '<a href="https://johnnunemaker.com">John</a>',
'6' => '<a href="https://opensoul.org">Brandon</a>',
}
end

config.application_href = "https://example.com"
end

# You can uncomment these to get some default data:
Expand All @@ -63,5 +65,6 @@ end
use Rack::Reloader

run Flipper::UI.app { |builder|
builder.use Rack::Reloader, 1
builder.use Rack::Session::Cookie, secret: "_super_secret"
}
5 changes: 5 additions & 0 deletions exe/flipper
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env ruby

require "flipper/cli"

Flipper::CLI.run(ARGV)
2 changes: 1 addition & 1 deletion flipper-active_record.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ Gem::Specification.new do |gem|
gem.metadata = Flipper::METADATA

gem.add_dependency 'flipper', "~> #{Flipper::VERSION}"
gem.add_dependency 'activerecord', '>= 4.2', '< 8'
gem.add_dependency 'activerecord', '>= 4.2', '< 9'
end
2 changes: 1 addition & 1 deletion flipper-active_support_cache_store.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ Gem::Specification.new do |gem|
gem.metadata = Flipper::METADATA

gem.add_dependency 'flipper', "~> #{Flipper::VERSION}"
gem.add_dependency 'activesupport', '>= 4.2', '< 8'
gem.add_dependency 'activesupport', '>= 4.2', '< 9'
end
2 changes: 1 addition & 1 deletion flipper-moneta.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Gem::Specification.new do |gem|
gem.version = Flipper::VERSION

gem.add_dependency 'flipper', "~> #{Flipper::VERSION}"
gem.add_dependency 'moneta', '>= 0.7.0', '< 1.2'
gem.add_dependency 'moneta', '>= 0.7.0', '< 2'
end
5 changes: 3 additions & 2 deletions flipper-ui.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ Gem::Specification.new do |gem|
gem.metadata = Flipper::METADATA

gem.add_dependency 'rack', '>= 1.4', '< 4'
gem.add_dependency 'rack-protection', '>= 1.5.3', '<= 4.0.0'
gem.add_dependency 'rack-protection', '>= 1.5.3', '<5.0.0'
gem.add_dependency 'rack-session', '>= 1.0.2', '< 3.0.0'
gem.add_dependency 'flipper', "~> #{Flipper::VERSION}"
gem.add_dependency 'erubi', '>= 1.0.0', '< 2.0.0'
gem.add_dependency 'sanitize', '< 7'
gem.add_dependency 'sanitize', '< 8'
end
4 changes: 3 additions & 1 deletion flipper.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugin_files = []
plugin_test_files = []

Dir['flipper-*.gemspec'].map do |gemspec|
spec = eval(File.read(gemspec))
spec = Gem::Specification.load(gemspec)
plugin_files << spec.files
plugin_test_files << spec.files
end
Expand All @@ -27,6 +27,8 @@ Gem::Specification.new do |gem|
gem.homepage = 'https://www.flippercloud.io/docs'
gem.license = 'MIT'

gem.bindir = "exe"
gem.executables = `git ls-files -- exe/*`.split("\n").map { |f| File.basename(f) }
gem.files = `git ls-files`.split("\n") - ignored_files + ['lib/flipper/version.rb']
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - ignored_test_files
gem.name = 'flipper'
Expand Down
4 changes: 3 additions & 1 deletion lib/flipper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,12 @@ def groups_registry=(registry)

require 'flipper/actor'
require 'flipper/adapter'
require 'flipper/adapters/wrapper'
require 'flipper/adapters/actor_limit'
require 'flipper/adapters/instrumented'
require 'flipper/adapters/memoizable'
require 'flipper/adapters/memory'
require 'flipper/adapters/strict'
require 'flipper/adapters/instrumented'
require 'flipper/adapter_builder'
require 'flipper/configuration'
require 'flipper/dsl'
Expand Down
2 changes: 1 addition & 1 deletion lib/flipper/adapter_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Flipper
#
# adapter = Flipper::AdapterBuilder.new do
# use Flipper::Adapters::Strict
# use Flipper::Adapters::Memoizer
# use Flipper::Adapters::Memoizable
# store Flipper::Adapters::Memory
# end.to_adapter
#
Expand Down
Loading

0 comments on commit cd6541e

Please sign in to comment.