diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f5b431383..ee75d9fb6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,7 +40,18 @@ jobs: with: ruby-version: "${{ matrix.ruby }}" bundler-cache: true - - run: bundle exec rake ${{ matrix.task }} + - run: NO_COVERAGE=true bundle exec rake ${{ matrix.task }} + + coverage: + runs-on: ubuntu-latest + name: "Test coverage" + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2" + bundler-cache: true + - run: bundle exec rake spec edge-rubocop: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 93bd86757..f7286ff5b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ pkg .ruby-gemset .ruby-version + +# simplecov generated +coverage diff --git a/.simplecov b/.simplecov new file mode 100644 index 000000000..56bda648b --- /dev/null +++ b/.simplecov @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +SimpleCov.start do + enable_coverage :branch + minimum_coverage line: 99.86, branch: 95.33 + add_filter '/spec/' + add_filter '/vendor/bundle/' +end diff --git a/Gemfile b/Gemfile index fa7613df2..f6fddf529 100644 --- a/Gemfile +++ b/Gemfile @@ -10,6 +10,7 @@ gem 'rake' gem 'rspec', '~> 3.11' gem 'rubocop-performance', '~> 1.7' gem 'rubocop-rake', '~> 0.6' +gem 'simplecov', '>= 0.19' gem 'yard' local_gemfile = 'Gemfile.local' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cf19e9f84..006ad539b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,6 +3,8 @@ require 'rubocop' require 'rubocop/rspec/support' +require 'simplecov' unless ENV['NO_COVERAGE'] + module SpecHelper ROOT = Pathname.new(__dir__).parent.freeze end