From b783a6d6f4fdd1f11af6ddff74f2d89ce337e57e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Wed, 8 Jun 2022 19:50:17 +0200 Subject: [PATCH 01/11] Add Github workflow check.yml --- .github/workflows/check.yml | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..5bb8cd6 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,50 @@ +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 }} + run: bundle exec parallel_rspec --prefix-output-with-test-env-number -- --format documentation --format RspecJunitFormatter --out ${{ matrix.protocol }}-${{ matrix.type }}-ruby-${{ matrix.ruby }}.junit -- spec/${{ matrix.type }} + - 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: '.' + - uses: coverallsapp/github-action@1.1.3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + flag-name: ruby-${{ matrix.ruby }}-${{ matrix.protocol }}-${{ matrix.type }} + parallel: true + finish: + needs: check + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@1.1.3 + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true From ae4f6cb7ef6673790e17551cdd1e36df49d67a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Mon, 20 Jun 2022 17:49:50 +0200 Subject: [PATCH 02/11] Add actions/upload-artifact. Fix junit file name format. Add .rspec_parallel. --- .github/workflows/.rspec_parallel | 3 +++ .github/workflows/check.yml | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/.rspec_parallel 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 index 5bb8cd6..b911a1c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -26,14 +26,25 @@ jobs: PARALLEL_TEST_PROCESSORS: 2 RSPEC_RETRY: true PROTOCOL: ${{ matrix.protocol }} - run: bundle exec parallel_rspec --prefix-output-with-test-env-number -- --format documentation --format RspecJunitFormatter --out ${{ matrix.protocol }}-${{ matrix.type }}-ruby-${{ matrix.ruby }}.junit -- spec/${{ matrix.type }} + 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: '.' + path: 'junit/' - uses: coverallsapp/github-action@1.1.3 with: github-token: ${{ secrets.GITHUB_TOKEN }} From e30f34515b716369447b6d22834d7cbad0708788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Mon, 20 Jun 2022 17:54:58 +0200 Subject: [PATCH 03/11] Make available on all branches --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b911a1c..9a68ca0 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -2,7 +2,7 @@ on: pull_request: push: branches: - - main + - '**' jobs: check: From fdc51cd586055976b26d2724a39a4aedb5a1541d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Mon, 20 Jun 2022 18:19:55 +0200 Subject: [PATCH 04/11] Fix branches --- .github/workflows/check.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 9a68ca0..15cc446 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,8 +1,7 @@ on: pull_request: push: - branches: - - '**' + branches: ['**'] jobs: check: From 92765f49270e1ef93c0e2a4e0ebd9fb646972e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Mon, 20 Jun 2022 18:39:52 +0200 Subject: [PATCH 05/11] Add development dependency: rspec_junit_formatter, simplecov, parallel_tests, simplecov-lcov and rspec-instafail. Add simplecov lcov integration. --- .gitignore | 2 ++ ably-rest.gemspec | 6 ++++++ spec/spec_helper.rb | 14 ++++++++++++++ 3 files changed, 22 insertions(+) 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/ably-rest.gemspec b/ably-rest.gemspec index 3e1e1ec..76f1e99 100644 --- a/ably-rest.gemspec +++ b/ably-rest.gemspec @@ -52,6 +52,12 @@ Gem::Specification.new do |spec| 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' From c92a4361610ebc27940e50a5e4408941e7a4b0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Mon, 20 Jun 2022 19:07:48 +0200 Subject: [PATCH 06/11] Add coverage status badge --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d79ba5c..84f7a5b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -# [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) +[![Coverage Status](https://coveralls.io/repos/ably/ably-ruby-rest/badge.svg)](https://coveralls.io/r/ably/ably-ruby-rest) -[![Gem Version](https://badge.fury.io/rb/ably-rest.svg)](http://badge.fury.io/rb/ably-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)._ From 6170906b75716b16ac2eda59fa73a97c5f3adf9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Mon, 20 Jun 2022 19:23:09 +0200 Subject: [PATCH 07/11] Rename the Github token --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 15cc446..dc3af6d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -56,5 +56,5 @@ jobs: - name: Coveralls Finished uses: coverallsapp/github-action@1.1.3 with: - github-token: ${{ secrets.github_token }} + github-token: ${{ secrets.GITHUB_TOKEN }} parallel-finished: true From 84f52875ba0581b6ae55a1430a7466585d0ae835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Wed, 22 Jun 2022 19:24:27 +0200 Subject: [PATCH 08/11] Remove coveralls gem --- ably-rest.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/ably-rest.gemspec b/ably-rest.gemspec index 76f1e99..b4ed954 100644 --- a/ably-rest.gemspec +++ b/ably-rest.gemspec @@ -48,7 +48,6 @@ 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' From a20221019dd5925b5682fd5aa81cb710665e4513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Wed, 22 Jun 2022 19:28:25 +0200 Subject: [PATCH 09/11] Set main branch in github workflow --- .github/workflows/check.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index dc3af6d..d8889e8 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,7 +1,8 @@ on: pull_request: push: - branches: ['**'] + branches: + - main jobs: check: From 5006f7a1278b492b732dd17813485646c9e6d225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Mon, 27 Jun 2022 18:31:07 +0200 Subject: [PATCH 10/11] Remove coveralls.io integration --- .github/workflows/check.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index d8889e8..fba9f19 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -45,17 +45,3 @@ jobs: server-url: 'https://test-observability.herokuapp.com' server-auth: ${{ secrets.TEST_OBSERVABILITY_SERVER_AUTH_KEY }} path: 'junit/' - - uses: coverallsapp/github-action@1.1.3 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - flag-name: ruby-${{ matrix.ruby }}-${{ matrix.protocol }}-${{ matrix.type }} - parallel: true - finish: - needs: check - runs-on: ubuntu-latest - steps: - - name: Coveralls Finished - uses: coverallsapp/github-action@1.1.3 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - parallel-finished: true From ad89e914e835a0c492d86095374bc9a23a919b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Mon, 27 Jun 2022 18:33:27 +0200 Subject: [PATCH 11/11] Removed coveralls.io badge and link --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 84f7a5b..18afecc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # [Ably](https://ably.com) [![Gem Version](https://img.shields.io/gem/v/ably?style=flat)](https://img.shields.io/gem/v/ably?style=flat) -[![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)._