File tree Expand file tree Collapse file tree 12 files changed +159
-45
lines changed Expand file tree Collapse file tree 12 files changed +159
-45
lines changed Original file line number Diff line number Diff line change 1+ #
2+ # Github benchmark test workflow
3+ #
4+ name : CI Benchmark Test
5+ on : [pull_request]
6+ jobs :
7+ test :
8+ runs-on : ubuntu-latest
9+ strategy :
10+ matrix :
11+ ruby :
12+ - ' 3.2.0'
13+ services :
14+ redis :
15+ image : redis
16+ ports : ["6379:6379"]
17+ steps :
18+ - uses : actions/checkout@v4
19+ - uses : ruby/setup-ruby@v1
20+ with :
21+ ruby-version : ${{ matrix.ruby }}
22+ bundler-cache : true
23+ - name : Run benchmark tests
24+ run : bundle exec ruby benchmark.rb
Original file line number Diff line number Diff line change 1+ #
2+ # Github ruby gem build workflow
3+ #
4+ name : CI Ruby Gem Build
5+ on : [pull_request]
6+ jobs :
7+ release-please :
8+ runs-on : ubuntu-latest
9+ strategy :
10+ matrix :
11+ ruby :
12+ - ' 3.2.0'
13+ steps :
14+ - uses : actions/checkout@v4
15+ - uses : ruby/setup-ruby@v1
16+ with :
17+ ruby-version : ${{ matrix.ruby }}
18+ bundler-cache : true
19+ - name : Build Ruby Gem
20+ run : gem build *.gemspec
21+ # - name: publish gem
22+ # run: |
23+ # mkdir -p $HOME/.gem
24+ # touch $HOME/.gem/credentials
25+ # chmod 0600 $HOME/.gem/credentials
26+ # printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
27+ # gem push *.gem
28+ # env:
29+ # GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
Original file line number Diff line number Diff line change 1+ #
2+ # Github codeql analysis workflow
3+ #
4+ name : CI CodeQL Analysis
5+ on : [pull_request]
6+ jobs :
7+ analyze :
8+ name : Analyze
9+ runs-on : ubuntu-latest
10+ permissions :
11+ actions : read
12+ contents : read
13+ security-events : write
14+ strategy :
15+ fail-fast : false
16+ matrix :
17+ language : ['ruby']
18+ steps :
19+ - name : Checkout
20+ uses : actions/checkout@v4
21+ - name : Initialize CodeQL
22+ uses : github/codeql-action/init@v3
23+ with :
24+ languages : ${{matrix.language}}
25+ - name : Perform CodeQL Analysis
26+ uses : github/codeql-action/analyze@v3
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #
2+ # Github rspec unit test workflow
3+ #
4+ name : CI RSpec Tests
5+ on : [pull_request]
6+ jobs :
7+ test :
8+ runs-on : ubuntu-latest
9+ strategy :
10+ matrix :
11+ ruby :
12+ - ' 3.2.0'
13+ services :
14+ redis :
15+ image : redis
16+ ports : ["6379:6379"]
17+ steps :
18+ - uses : actions/checkout@v4
19+ - uses : ruby/setup-ruby@v1
20+ with :
21+ ruby-version : ${{ matrix.ruby }}
22+ bundler-cache : true
23+ - name : Run unit tests
24+ run : bundle exec rspec
Original file line number Diff line number Diff line change 1+ #
2+ # Github rubocop linting workflow
3+ #
4+ name : CI Rubocop Linting
5+ on : [pull_request]
6+ jobs :
7+ build :
8+ runs-on : ubuntu-latest
9+ strategy :
10+ matrix :
11+ ruby :
12+ - ' 3.2.0'
13+ # steps:
14+ # - uses: actions/checkout@v2
15+ # - name: Rubocop Linter Action
16+ # uses: andrewmcodes/[email protected] 17+ # env:
18+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+ steps :
20+ - uses : actions/checkout@v4
21+ - uses : ruby/setup-ruby@v1
22+ with :
23+ ruby-version : ${{ matrix.ruby }}
24+ bundler-cache : true
25+ - name : Rubocop Linter Action
26+ run : |
27+ bundle exec rubocop \
28+ --parallel \
29+ --fail-level convention \
30+ --display-only-fail-level-offenses \
31+ --display-style-guide \
32+ --force-exclusion \
33+ --format progress \
34+ --format github
Original file line number Diff line number Diff line change 11require :
22 - rubocop-rake
33 - rubocop-rspec
4+ - rubocop-factory_bot
45
56AllCops :
67 NewCops : enable
7- TargetRubyVersion : 3.1
8+ TargetRubyVersion : 3.2
89 Exclude :
910 - ' test.rb'
11+ - ' vendor/bundle/**/*'
1012
1113Metrics/MethodLength :
1214 Enabled : false
Original file line number Diff line number Diff line change @@ -5,12 +5,13 @@ source 'https://rubygems.org'
55# Specify your gem's dependencies in redis_single_file.gemspec
66gemspec
77
8+ gem 'benchmark' , '~> 0.4.0'
9+ gem 'benchmark-ips' , '~> 2.14.0'
10+ gem 'mock_redis' , '~> 0.49.0'
811gem 'pry' , '~> 0.15.2'
912gem 'rake' , '~> 13.0'
1013gem 'rspec' , '~> 3.0'
1114gem 'rubocop' , '~> 1.21'
15+ gem 'rubocop-factory_bot' , '~> 2.26.1'
1216gem 'rubocop-rake' , '~> 0.6.0'
1317gem 'rubocop-rspec' , '~> 3.4.0 '
14- gem 'mock_redis' , '~> 0.49.0'
15- gem 'benchmark' , '~> 0.4.0'
16- gem 'benchmark-ips' , '~> 2.14.0'
Original file line number Diff line number Diff line change 5858 unicode-display_width (>= 2.4.0 , < 4.0 )
5959 rubocop-ast (1.38.0 )
6060 parser (>= 3.3.1.0 )
61+ rubocop-factory_bot (2.26.1 )
62+ rubocop (~> 1.61 )
6163 rubocop-rake (0.6.0 )
6264 rubocop (~> 1.0 )
6365 rubocop-rspec (3.4.0 )
@@ -80,6 +82,7 @@ DEPENDENCIES
8082 redis-single-file !
8183 rspec (~> 3.0 )
8284 rubocop (~> 1.21 )
85+ rubocop-factory_bot (~> 2.26.1 )
8386 rubocop-rake (~> 0.6.0 )
8487 rubocop-rspec (~> 3.4.0 )
8588
Original file line number Diff line number Diff line change 33require 'benchmark/ips'
44require 'redis_single_file'
55
6- scenario_1_semaphore = RedisSingleFile . new ( name : :scenario_1 )
7- scenario_2_semaphore = RedisSingleFile . new ( name : :scenario_2 )
6+ scenario_1_semaphore = RedisSingleFile . new ( name : :scenario1 )
7+ scenario_2_semaphore = RedisSingleFile . new ( name : :scenario2 )
88
99Benchmark . ips do |x |
1010 x . report ( 'synchronize' ) do
1818 x . report ( 'threaded (10x)' ) do
1919 threads = 10 . times . map do
2020 Thread . new do
21- scenario_3_semaphore = RedisSingleFile . new ( name : :scenario_3 )
21+ scenario_3_semaphore = RedisSingleFile . new ( name : :scenario3 )
2222 scenario_3_semaphore . synchronize { nil }
2323 end
2424 end
2525
26- while threads . any? ( &:alive? ) do
27- threads . each { _1 . join ( 0.5 ) }
28- end
26+ threads . each { _1 . join ( 0.05 ) } while threads . any? ( &:alive? )
2927 end
3028
3129 x . report ( 'forked (10x)' ) do
3230 10 . times . each do
3331 fork do
34- scenario_4_semaphore = RedisSingleFile . new ( name : :scenario_4 )
32+ scenario_4_semaphore = RedisSingleFile . new ( name : :scenario4 )
3533 scenario_4_semaphore . synchronize { nil }
3634 end
3735 end
You can’t perform that action at this time.
0 commit comments