diff --git a/.github/workflows/.rspec_parallel b/.github/workflows/.rspec_parallel new file mode 100644 index 0000000..5baea93 --- /dev/null +++ b/.github/workflows/.rspec_parallel @@ -0,0 +1,3 @@ +--format documentation +--format RspecJunitFormatter +--out junit/<%= ENV['TEST_ENV_NUMBER'] %>_<%= ENV['TEST_TYPE'] %>_<%= ENV['PROTOCOL'] %>_ruby-<%= ENV['RUBY_VERSION'] %>.junit diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..fba9f19 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,47 @@ +on: + pull_request: + push: + branches: + - main + +jobs: + check: + runs-on: ubuntu-latest + continue-on-error: true + strategy: + matrix: + ruby: [ '2.7', '3.0', '3.1' ] + protocol: [ 'json', 'msgpack' ] + type: [ 'unit', 'acceptance' ] + steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: 'Run ${{ matrix.type }} tests on ruby ${{ matrix.ruby }} (${{ matrix.protocol }} protocol)' + env: + PARALLEL_TEST_PROCESSORS: 2 + RSPEC_RETRY: true + PROTOCOL: ${{ matrix.protocol }} + TEST_TYPE: ${{ matrix.type }} + RUBY_VERSION: ${{ matrix.ruby }} + run: | + cp .github/workflows/.rspec_parallel .rspec_parallel + mkdir junit + bundle exec parallel_rspec --prefix-output-with-test-env-number --first-is-1 -- spec/${{ matrix.type }} + - uses: actions/upload-artifact@v3 + with: + path: | + junit/ + coverage/ + retention-days: 7 + - name: Upload test results + if: always() + uses: ably-labs/test-observability-action@main + with: + server-url: 'https://test-observability.herokuapp.com' + server-auth: ${{ secrets.TEST_OBSERVABILITY_SERVER_AUTH_KEY }} + path: 'junit/' diff --git a/.gitignore b/.gitignore index 551eeb8..45e6ccd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ Gemfile.lock .yardoc doc/* pkg +coverage/ +junit/ diff --git a/README.md b/README.md index 42267fd..18afecc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# [Ably](https://www.ably.io) +# [Ably](https://ably.com) + +[![Gem Version](https://img.shields.io/gem/v/ably?style=flat)](https://img.shields.io/gem/v/ably?style=flat) -[![Gem Version](https://badge.fury.io/rb/ably-rest.svg)](http://badge.fury.io/rb/ably-rest) -[![Coverage Status](https://coveralls.io/repos/ably/ably-ruby-rest/badge.svg)](https://coveralls.io/r/ably/ably-ruby-rest) _[Ably](https://ably.com) is the platform that powers synchronized digital experiences in realtime. Whether attending an event in a virtual venue, receiving realtime financial information, or monitoring live car performance data – consumers simply expect realtime digital experiences as standard. Ably provides a suite of APIs to build, extend, and deliver powerful digital experiences in realtime for more than 250 million devices across 80 countries each month. Organizations like Bloomberg, HubSpot, Verizon, and Hopin depend on Ably’s platform to offload the growing complexity of business-critical realtime data synchronization at global scale. For more information, see the [Ably documentation](https://ably.com/documentation)._ diff --git a/ably-rest.gemspec b/ably-rest.gemspec index 3e1e1ec..b4ed954 100644 --- a/ably-rest.gemspec +++ b/ably-rest.gemspec @@ -48,10 +48,15 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'yard', '~> 0.9' spec.add_development_dependency 'webmock', '~> 3.14.0' - spec.add_development_dependency 'coveralls' spec.add_development_dependency 'pry', '~> 0.14.1' spec.add_development_dependency 'pry-byebug' + spec.add_development_dependency 'rspec_junit_formatter', '~> 0.5.1' + spec.add_development_dependency 'rspec-instafail', '~> 1.0' + spec.add_development_dependency 'simplecov', '~> 0.21.2' + spec.add_development_dependency 'simplecov-lcov', '~> 0.8.0' + spec.add_development_dependency 'parallel_tests', '~> 3.8' + if RUBY_VERSION.match(/^3\./) spec.add_development_dependency 'webrick', '~> 1.7.0' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d48c66f..cc0935b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,20 @@ def console(message) puts "\033[31m[#{Time.now.strftime('%H:%M:%S.%L')}]\033[0m \033[33m#{message}\033[0m" end +unless RUBY_VERSION.match(/^1\./) + require 'simplecov' + + SimpleCov.start do + require 'simplecov-lcov' + SimpleCov::Formatter::LcovFormatter.config do |c| + c.report_with_single_file = true + c.single_report_path = 'coverage/lcov.info' + end + formatter SimpleCov::Formatter::LcovFormatter + add_filter %w[vendor spec] + end +end + require 'webmock/rspec' require 'ably-rest'