diff --git a/.github/workflows/test.yml b/.github/workflows/ci.yml similarity index 55% rename from .github/workflows/test.yml rename to .github/workflows/ci.yml index 0157123..b65392f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Test +name: CI on: push: @@ -24,7 +24,7 @@ jobs: strategy: matrix: - ruby: [2.7, 3.0, 3.1, 3.2] + ruby: [3.0, 3.1, 3.2] steps: - uses: actions/checkout@v2 @@ -34,3 +34,20 @@ jobs: bundler-cache: true - name: Run rspec run: bundle exec rspec + + release: + runs-on: ubuntu-latest + + environment: release + + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + + steps: + - uses: actions/checkout@v3 + + - name: Release Gem + uses: skirushkin/publish-rubygems-action@main + env: + RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}} + GIT_EMAIL: oss@umbrellio.biz + GIT_NAME: Team Umbrellio diff --git a/Gemfile.lock b/Gemfile.lock index aa1d8a3..3dca97f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,42 +1,42 @@ PATH remote: . specs: - yabeda-rabbit_messaging (0.0.1) + yabeda-rabbit_messaging (0.0.2) rabbit_messaging (~> 0.6) yabeda (~> 0.8) GEM remote: https://rubygems.org/ specs: - actioncable (7.1.2) - actionpack (= 7.1.2) - activesupport (= 7.1.2) + actioncable (7.1.3) + actionpack (= 7.1.3) + activesupport (= 7.1.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.2) - actionpack (= 7.1.2) - activejob (= 7.1.2) - activerecord (= 7.1.2) - activestorage (= 7.1.2) - activesupport (= 7.1.2) + actionmailbox (7.1.3) + actionpack (= 7.1.3) + activejob (= 7.1.3) + activerecord (= 7.1.3) + activestorage (= 7.1.3) + activesupport (= 7.1.3) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.2) - actionpack (= 7.1.2) - actionview (= 7.1.2) - activejob (= 7.1.2) - activesupport (= 7.1.2) + actionmailer (7.1.3) + actionpack (= 7.1.3) + actionview (= 7.1.3) + activejob (= 7.1.3) + activesupport (= 7.1.3) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.2) - actionview (= 7.1.2) - activesupport (= 7.1.2) + actionpack (7.1.3) + actionview (= 7.1.3) + activesupport (= 7.1.3) nokogiri (>= 1.8.5) racc rack (>= 2.2.4) @@ -44,35 +44,35 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.2) - actionpack (= 7.1.2) - activerecord (= 7.1.2) - activestorage (= 7.1.2) - activesupport (= 7.1.2) + actiontext (7.1.3) + actionpack (= 7.1.3) + activerecord (= 7.1.3) + activestorage (= 7.1.3) + activesupport (= 7.1.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.2) - activesupport (= 7.1.2) + actionview (7.1.3) + activesupport (= 7.1.3) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.2) - activesupport (= 7.1.2) + activejob (7.1.3) + activesupport (= 7.1.3) globalid (>= 0.3.6) - activemodel (7.1.2) - activesupport (= 7.1.2) - activerecord (7.1.2) - activemodel (= 7.1.2) - activesupport (= 7.1.2) + activemodel (7.1.3) + activesupport (= 7.1.3) + activerecord (7.1.3) + activemodel (= 7.1.3) + activesupport (= 7.1.3) timeout (>= 0.4.0) - activestorage (7.1.2) - actionpack (= 7.1.2) - activejob (= 7.1.2) - activerecord (= 7.1.2) - activesupport (= 7.1.2) + activestorage (7.1.3) + actionpack (= 7.1.3) + activejob (= 7.1.3) + activerecord (= 7.1.3) + activesupport (= 7.1.3) marcel (~> 1.0) - activesupport (7.1.2) + activesupport (7.1.3) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -83,21 +83,21 @@ GEM mutex_m tzinfo (~> 2.0) amq-protocol (2.3.2) - anyway_config (2.6.0) - ruby-next-core (>= 0.15) + anyway_config (2.6.2) + ruby-next-core (~> 1.0) ast (2.4.2) base64 (0.2.0) - bigdecimal (3.1.5) + bigdecimal (3.1.6) builder (3.2.4) bunny (2.22.0) amq-protocol (~> 2.3, >= 2.3.1) sorted_set (~> 1, >= 1.0.2) coderay (1.1.3) - concurrent-ruby (1.2.2) + concurrent-ruby (1.2.3) connection_pool (2.4.1) crass (1.0.6) date (3.3.4) - diff-lcs (1.5.0) + diff-lcs (1.5.1) drb (2.2.0) ruby2_keywords dry-initializer (3.1.1) @@ -106,12 +106,12 @@ GEM activesupport (>= 6.1) i18n (1.14.1) concurrent-ruby (~> 1.0) - io-console (0.7.1) - irb (1.10.1) + io-console (0.7.2) + irb (1.11.1) rdoc - reline (>= 0.3.8) + reline (>= 0.4.2) json (2.7.1) - lamian (1.7.0) + lamian (1.8.0) rails (>= 4.2) loofah (2.22.0) crass (~> 1.0.2) @@ -124,24 +124,24 @@ GEM marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.5) - minitest (5.20.0) + minitest (5.22.0) mutex_m (0.2.0) - net-imap (0.4.8) + net-imap (0.4.10) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0) + net-smtp (0.4.0.1) net-protocol nio4r (2.7.0) - nokogiri (1.15.5-arm64-darwin) + nokogiri (1.16.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.5-x86_64-linux) + nokogiri (1.16.2-x86_64-linux) racc (~> 1.4) parallel (1.24.0) - parser (3.2.2.4) + parser (3.3.0.5) ast (~> 2.4.1) racc pry (0.14.2) @@ -156,7 +156,7 @@ GEM sneakers (~> 2.0) tainbox racc (1.7.3) - rack (3.0.8) + rack (3.0.9) rack-session (2.0.0) rack (>= 3.0.0) rack-test (2.1.0) @@ -164,20 +164,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.1.2) - actioncable (= 7.1.2) - actionmailbox (= 7.1.2) - actionmailer (= 7.1.2) - actionpack (= 7.1.2) - actiontext (= 7.1.2) - actionview (= 7.1.2) - activejob (= 7.1.2) - activemodel (= 7.1.2) - activerecord (= 7.1.2) - activestorage (= 7.1.2) - activesupport (= 7.1.2) + rails (7.1.3) + actioncable (= 7.1.3) + actionmailbox (= 7.1.3) + actionmailer (= 7.1.3) + actionpack (= 7.1.3) + actiontext (= 7.1.3) + actionview (= 7.1.3) + activejob (= 7.1.3) + activemodel (= 7.1.3) + activerecord (= 7.1.3) + activestorage (= 7.1.3) + activesupport (= 7.1.3) bundler (>= 1.15.0) - railties (= 7.1.2) + railties (= 7.1.3) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -185,9 +185,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.2) - actionpack (= 7.1.2) - activesupport (= 7.1.2) + railties (7.1.3) + actionpack (= 7.1.3) + activesupport (= 7.1.3) irb rackup (>= 1.0.0) rake (>= 12.2) @@ -198,23 +198,23 @@ GEM rbtree (0.4.6) rdoc (6.6.2) psych (>= 4.0.0) - regexp_parser (2.8.3) - reline (0.4.1) + regexp_parser (2.9.0) + reline (0.4.2) io-console (~> 0.5) rexml (3.2.6) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.6) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-support (3.12.1) + rspec-support (~> 3.13.0) + rspec-support (3.13.0) rubocop (1.50.2) json (~> 2.3) parallel (~> 1.10) @@ -227,7 +227,7 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.30.0) parser (>= 3.2.1.0) - rubocop-capybara (2.19.0) + rubocop-capybara (2.20.0) rubocop (~> 1.41) rubocop-config-umbrellio (1.50.0.85) rubocop (~> 1.50.0) @@ -250,12 +250,12 @@ GEM rubocop-capybara (~> 2.17) rubocop-sequel (0.3.4) rubocop (~> 1.0) - ruby-next-core (1.0.0) + ruby-next-core (1.0.1) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) serverengine (2.1.1) sigdump (~> 0.2.2) - set (1.0.4) + set (1.1.0) sigdump (0.2.5) sneakers (2.12.0) bunny (~> 2.14) @@ -282,7 +282,7 @@ GEM anyway_config (>= 1.0, < 3) concurrent-ruby dry-initializer - zeitwerk (2.6.12) + zeitwerk (2.6.13) PLATFORMS arm64-darwin-22 @@ -295,4 +295,4 @@ DEPENDENCIES yabeda-rabbit_messaging! BUNDLED WITH - 2.4.21 + 2.5.5 diff --git a/README.md b/README.md index 2c18d61..29cd0f5 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ Works through [Yabeda Framework](https://github.com/yabeda-rb). ## Installation +Put gem in your Gemfile after `rabbit_messaging` gem. + ```ruby gem "rabbit_messaging" gem "table_sync" @@ -30,7 +32,7 @@ Metrics representing state of TableSync receiving jobs processing: ## Contributing -Bug reports and pull requests are welcome on GitHub at https://github.com/umbrellio/table_sync. +Bug reports and pull requests are welcome on GitHub at https://github.com/umbrellio/yabeda-rabbit_messaging. ## License diff --git a/lib/yabeda/rabbit_messaging/version.rb b/lib/yabeda/rabbit_messaging/version.rb index e05a5ed..82e6ffc 100644 --- a/lib/yabeda/rabbit_messaging/version.rb +++ b/lib/yabeda/rabbit_messaging/version.rb @@ -2,6 +2,6 @@ module Yabeda module RabbitMessaging - VERSION = "0.0.1" + VERSION = "0.0.2" end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0e2e167..4cbf692 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,8 @@ require "yabeda/rabbit_messaging" +Yabeda.configure! + Dir[File.join(__dir__, "support/**/*.rb")].sort.each { |f| require(f) } RSpec.configure do |config| diff --git a/spec/yabeda/rabbit_messaging_spec.rb b/spec/yabeda/rabbit_messaging_spec.rb index 80c5d8f..871b775 100644 --- a/spec/yabeda/rabbit_messaging_spec.rb +++ b/spec/yabeda/rabbit_messaging_spec.rb @@ -6,4 +6,37 @@ expect(Rabbit::Receiving::Job.ancestors.first).to eq(described_class::JobPatch) end end + + describe "#configure" do + it "configure metrics" do + expect(Yabeda.metrics.keys).to include("rabbit_messages_total", "rabbit_messages_duration") + end + end +end + +describe Yabeda::RabbitMessaging::JobPatch do + describe "#perform" do + before { allow(Yabeda.rabbit_messages_total).to receive(:increment).and_call_original } + + let(:arguments) do + { + app_id: "test_app_id", + type: "test_type", + exchange: "test_exchange", + routing_key: "test_routing_key", + } + end + + it "send metrics to Yabeda" do + Rabbit::Receiving::Job.perform_now("{}", arguments) rescue nil + + expect(Yabeda.rabbit_messages_total).to have_received(:increment) do |args| + expect(args).to eq( + exchange: "test_exchange", + routing_key: "test_routing_key", + success: false, + ) + end + end + end end diff --git a/yabeda-rabbit_messaging.gemspec b/yabeda-rabbit_messaging.gemspec index 9f99f3f..d35f529 100644 --- a/yabeda-rabbit_messaging.gemspec +++ b/yabeda-rabbit_messaging.gemspec @@ -5,8 +5,8 @@ require_relative "lib/yabeda/rabbit_messaging/version" Gem::Specification.new do |spec| spec.name = "yabeda-rabbit_messaging" spec.version = Yabeda::RabbitMessaging::VERSION - spec.authors = ["Stepan Kirushkin"] - spec.email = ["stepan.kirushkin@gmail.com"] + spec.authors = ["Team Umbrellio"] + spec.email = ["oss@umbrellio.biz"] spec.summary = "Yabeda plugin for rabbit_messaging gem." spec.description = "Easy collect your TableSync metrics."