From b13c00e8e4ee9a80347278f47a7fbefeb2e38168 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Tue, 9 May 2023 19:40:46 -0400 Subject: [PATCH 1/4] Add codeclimate coverage step to build GH action --- .github/workflows/ruby.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 157f699a..1e17cb52 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -70,5 +70,10 @@ jobs: with: ruby-version: 3.2.2 bundler-cache: true - - name: Report rspec test coverage to coveralls.io - run: COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} bundle exec rspec + - name: Report rspec test coverage to coveralls.io and codeclimate.com + uses: paambaati/codeclimate-action@v4.0.0 + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + with: + coverageCommand: bundle exec rspec From da6867373f3040de5302070c3442b8fb7106c842 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Tue, 9 May 2023 19:55:30 -0400 Subject: [PATCH 2/4] Do things differently for coveralls and code climate --- .github/workflows/ruby.yml | 7 +++++-- spec/spec_helper.rb | 20 +++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 1e17cb52..8ea0c3be 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -70,10 +70,13 @@ jobs: with: ruby-version: 3.2.2 bundler-cache: true - - name: Report rspec test coverage to coveralls.io and codeclimate.com + - name: Report rspec test coverage to coveralls.io + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + run: bundle exec rspec + - name: Report rspec test coverage to codeclimate.com uses: paambaati/codeclimate-action@v4.0.0 env: CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} with: coverageCommand: bundle exec rspec diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6bcd7948..03e16a45 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,15 +1,21 @@ # frozen_string_literal: true +require 'yaml' require 'simplecov' -require 'coveralls' -SimpleCov.formatters = [ - SimpleCov::Formatter::HTMLFormatter, - Coveralls::SimpleCov::Formatter, -] +if ENV.has_key? 'COVERALLS_REPO_TOKEN' + require 'coveralls' -Coveralls.wear! do - add_filter '/spec/' + SimpleCov.formatters = [ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter, + ] + + Coveralls.wear! do + add_filter '/spec/' + end +else + SimpleCov.start end require 'rspec' From c88317861b48ac53534e59b07c62bbd9830ff0a9 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Tue, 9 May 2023 19:55:42 -0400 Subject: [PATCH 3/4] Use correct test --- spec/lib/rambling/trie/container_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/lib/rambling/trie/container_spec.rb b/spec/lib/rambling/trie/container_spec.rb index 534ad113..ad8c56d6 100644 --- a/spec/lib/rambling/trie/container_spec.rb +++ b/spec/lib/rambling/trie/container_spec.rb @@ -323,7 +323,7 @@ context 'with compressed node' do before { container.compress! } - it_behaves_like 'a matching container#words_within?' + it_behaves_like 'a non-matching container#words_within?' end end From ea697503759f94795f0f541d04cff1cf021b3e0e Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Tue, 9 May 2023 19:57:37 -0400 Subject: [PATCH 4/4] rubocop! --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 03e16a45..61cd434b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,7 +3,7 @@ require 'yaml' require 'simplecov' -if ENV.has_key? 'COVERALLS_REPO_TOKEN' +if ENV.key? 'COVERALLS_REPO_TOKEN' require 'coveralls' SimpleCov.formatters = [