From a360cfa7d6351b1f7e7e18b93eabc66694deb999 Mon Sep 17 00:00:00 2001 From: jiikko Date: Tue, 22 Nov 2022 17:50:34 +0900 Subject: [PATCH 1/2] Use ruby3.0 --- .github/workflows/ruby.yml | 26 ++++++++++++++++ .travis.yml | 7 ----- Dockerfile | 6 ++++ Gemfile.lock | 52 +++++++++++++++++--------------- README.md | 5 +++ docker-compose.yml | 11 +++++++ resque_unit_without_mock.gemspec | 8 ++--- test/support/resque.rb | 2 +- 8 files changed, 81 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/ruby.yml delete mode 100644 .travis.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..18d9102 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,26 @@ +name: Ruby + +on: + [push] + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 5 + strategy: + matrix: + ruby-version: ['2.7', '3.0', '3.1'] + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + - name: Install Redis + run: sudo apt-get install -y redis-tools redis-server + - name: Verify that redis is up + run: redis-cli ping + - name: Run tests + run: |- + bundle exec rake diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index af76b67..0000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -sudo: false -language: ruby -cache: bundler -rvm: - - 2.5.3 -before_install: gem install bundler -v 1.17.1 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ec3d108 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM ruby:3.0 +WORKDIR /app +RUN apt-get update && apt-get install redis -y +RUN bundle config set --global force_ruby_platform true +RUN gem i bundler +COPY . . diff --git a/Gemfile.lock b/Gemfile.lock index 1c83b24..681f51a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,49 +1,53 @@ PATH remote: . specs: - resque_unit_without_mock (0.1.0) + resque_unit_without_mock (0.1.1) GEM remote: https://rubygems.org/ specs: - minitest (5.11.3) + connection_pool (2.3.0) + minitest (5.16.3) minitest-hooks (1.5.0) minitest (> 5.3) - mono_logger (1.1.0) - multi_json (1.13.1) - mustermann (1.0.3) - rack (2.0.6) - rack-protection (2.0.5) + mono_logger (1.1.1) + multi_json (1.15.0) + mustermann (3.0.0) + ruby2_keywords (~> 0.0.1) + rack (2.2.4) + rack-protection (3.0.3) rack - rake (10.5.0) - redis (4.1.0) - redis-namespace (1.6.0) - redis (>= 3.0.4) - resque (2.0.0) + rake (13.0.6) + redis (5.0.5) + redis-client (>= 0.9.0) + redis-client (0.11.2) + connection_pool + redis-namespace (1.9.0) + redis (>= 4) + resque (2.4.0) mono_logger (~> 1.0) multi_json (~> 1.0) redis-namespace (~> 1.6) sinatra (>= 0.9.2) - vegas (~> 0.1.2) - sinatra (2.0.5) - mustermann (~> 1.0) - rack (~> 2.0) - rack-protection (= 2.0.5) + ruby2_keywords (0.0.5) + sinatra (3.0.3) + mustermann (~> 3.0) + rack (~> 2.2, >= 2.2.4) + rack-protection (= 3.0.3) tilt (~> 2.0) - tilt (2.0.9) - vegas (0.1.11) - rack (>= 1.0.0) + tilt (2.0.11) PLATFORMS ruby + x86_64-linux DEPENDENCIES - bundler (~> 1.17) - minitest (~> 5.0) + bundler + minitest minitest-hooks - rake (~> 10.0) + rake resque resque_unit_without_mock! BUNDLED WITH - 1.17.1 + 2.3.26 diff --git a/README.md b/README.md index 6500bcf..65af49a 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,11 @@ end Resque.singleton_class.prepend(ResqueHelpersExt) ``` +## Development +* docker compose run --rm app bash +* bundle install +* bundle exec rake + ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..40c3c3a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3' +services: + app: + build: . + volumes: + - './:/app:delegated' + - bundle_path:/bundle + environment: + - BUNDLE_PATH=/bundle +volumes: + bundle_path: diff --git a/resque_unit_without_mock.gemspec b/resque_unit_without_mock.gemspec index 86f0e85..011ab93 100644 --- a/resque_unit_without_mock.gemspec +++ b/resque_unit_without_mock.gemspec @@ -1,4 +1,3 @@ - lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "resque_unit_without_mock/version" @@ -13,6 +12,7 @@ Gem::Specification.new do |spec| spec.description = spec.summary spec.homepage = "https://github.com/jiikko/resque_unit_without_mock" spec.license = "MIT" + spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0") # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. @@ -23,9 +23,9 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.17" - spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "minitest", "~> 5.0" + spec.add_development_dependency "bundler" + spec.add_development_dependency "rake" + spec.add_development_dependency "minitest" spec.add_development_dependency "minitest-hooks" spec.add_development_dependency "resque" end diff --git a/test/support/resque.rb b/test/support/resque.rb index 410415a..05331e0 100644 --- a/test/support/resque.rb +++ b/test/support/resque.rb @@ -1,4 +1,4 @@ -Resque.redis = Redis.new(host: 'localhost', port: RedisManeger::PORT, thread_safe: true) +Resque.redis = Redis.new(host: 'localhost', port: RedisManeger::PORT) module ResqueHelpersExt def reset! From 350c53e4fc8f3c35950126741c2572b117583c00 Mon Sep 17 00:00:00 2001 From: jiikko Date: Mon, 28 Nov 2022 17:16:05 +0900 Subject: [PATCH 2/2] Update ruby.yml --- .github/workflows/ruby.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 18d9102..52582f0 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -1,7 +1,14 @@ name: Ruby on: - [push] + push: + branches: + - master + pull_request: + types: + - opened + - synchronize + - reopened jobs: test: