From 4cbcf978047f2b3f4f81f4d33ccc4dd118005203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Sch=C3=B6nlaub?= Date: Tue, 12 Sep 2023 13:14:36 -0600 Subject: [PATCH] chore: add codecov integration (#59) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Schönlaub --- .github/workflows/main.yml | 6 ++++++ .simplecov | 12 +++++++++++ Gemfile.lock | 42 +++++++++++++++++++++++++------------- openfeature-sdk.gemspec | 2 ++ spec/spec_helper.rb | 2 ++ 5 files changed, 50 insertions(+), 14 deletions(-) create mode 100644 .simplecov diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4ca916e..fa7fbd2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,6 +32,12 @@ jobs: - run: bundle install - name: RSpec run: bundle exec rspec + - name: Upload coverage to Codecov + uses: codecov/codecov-action@398b9de041a7e69750d45077b10c5912201a3466 + with: + fail_ci_if_error: true + verbose: true + file: coverage/coverage.xml rubocop: name: Rubocop runs-on: ubuntu-latest diff --git a/.simplecov b/.simplecov new file mode 100644 index 0000000..d304cda --- /dev/null +++ b/.simplecov @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require "simplecov-cobertura" + +SimpleCov.start do + add_filter "/spec/" + if ENV["CI"] == "true" + formatter SimpleCov::Formatter::CoberturaFormatter + else + formatter SimpleCov::Formatter::HTMLFormatter + end +end diff --git a/Gemfile.lock b/Gemfile.lock index 5817217..17f8323 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,28 +9,31 @@ GEM ast (2.4.2) concurrent-ruby (1.2.2) diff-lcs (1.5.0) - json (2.6.2) - markly (0.7.0) - parallel (1.22.1) - parser (3.1.2.1) + docile (1.4.0) + json (2.6.3) + markly (0.10.0) + parallel (1.23.0) + parser (3.2.2.3) ast (~> 2.4.1) + racc + racc (1.7.1) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.6.0) - rexml (3.2.5) + regexp_parser (2.8.1) + 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.0) + rspec-core (3.12.2) rspec-support (~> 3.12.0) - rspec-expectations (3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.0) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-support (3.12.0) + rspec-support (3.12.1) rubocop (1.37.1) json (~> 2.3) parallel (~> 1.10) @@ -41,10 +44,19 @@ GEM rubocop-ast (>= 1.23.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.23.0) - parser (>= 3.1.1.0) - ruby-progressbar (1.11.0) - unicode-display_width (2.3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) + ruby-progressbar (1.13.0) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-cobertura (2.1.0) + rexml + simplecov (~> 0.19) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + unicode-display_width (2.4.2) PLATFORMS arm64-darwin-21 @@ -63,6 +75,8 @@ DEPENDENCIES rake (~> 13.0) rspec (~> 3.12.0) rubocop (~> 1.37.1) + simplecov (~> 0.22.0) + simplecov-cobertura (~> 2.1.0) BUNDLED WITH 2.3.25 diff --git a/openfeature-sdk.gemspec b/openfeature-sdk.gemspec index f507b22..430073c 100644 --- a/openfeature-sdk.gemspec +++ b/openfeature-sdk.gemspec @@ -35,4 +35,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "rake", "~> 13.0" spec.add_development_dependency "rspec", "~> 3.12.0" spec.add_development_dependency "rubocop", "~> 1.37.1" + spec.add_development_dependency "simplecov", "~> 0.22.0" + spec.add_development_dependency "simplecov-cobertura", "~> 2.1.0" end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4911b63..5d8d52e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "simplecov" + require "openfeature/sdk" require "markly"