From 803ded00b7a57de33c320c33f0e300c6523e2b7e Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Thu, 16 Feb 2023 09:46:45 -0500 Subject: [PATCH] Re-add code coverage. --- .DS_Store | Bin 0 -> 6148 bytes .github/workflows/coverage.yml | 24 ++++++++++++++++++++++++ .github/workflows/test.yml | 2 +- CHANGELOG.md | 1 + Gemfile | 1 + README.md | 2 -- Rakefile | 8 -------- test/test_helper.rb | 15 +++++++++++++++ 8 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 .DS_Store create mode 100644 .github/workflows/coverage.yml diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1ad899dbcdc748036dd701eacb0ec11e243703d4 GIT binary patch literal 6148 zcmeHKyJ`bL3>+mc4$`I(2Sbbi#2M3J zT*oXyY@Q(Y!ZDE|1kgGlC+ZoQs7@HV6)|Fx!@~RZ=JlH_u58Z)4k@C?#6Xc7@{2$qaAbO f?f5y0vab1>=e=-D3_9~cC+cUwb&*MdzgFN1-fR_w literal 0 HcmV?d00001 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..d501940 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,24 @@ +--- +name: coverage +on: [push, pull_request] + +env: + COVERAGE: 1 + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Ruby (2.7) + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + - name: Build and test with RSpec + run: | + bundle exec rake test + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff43635..792103e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,5 +21,5 @@ jobs: with: ruby-version: ${{ matrix.entry.ruby }} bundler-cache: true - - run: bundle exec rake test + - run: bundle exec rake test spinach continue-on-error: ${{ matrix.entry.allowed-failure || false }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 533de78..e75e91a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### 1.0.2 (Next) * [#268](https://github.com/codegram/hyperclient/pull/268): Replace Travis-CI with GHA - [@dblock](https://github.com/dblock). +* [#269](https://github.com/codegram/hyperclient/pull/269): Re-add code coverage - [@dblock](https://github.com/dblock). * Your contribution here. ### 1.0.1 (2021/01/02) diff --git a/Gemfile b/Gemfile index 2b30dc4..6f38768 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ group :development, :test do gem 'rake' gem 'rubocop', '0.81.0', require: false gem 'simplecov', require: false + gem 'simplecov-lcov', require: false end group :test do diff --git a/README.md b/README.md index 69dfe6b..8ab765f 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,6 @@ Hyperclient is a Hypermedia API client written in Ruby. It fully supports [JSON # Table of Contents -- [Hyperclient](#hyperclient) -- [Table of Contents](#table-of-contents) - [Usage](#usage) - [API Client](#api-client) - [Resources and Attributes](#resources-and-attributes) diff --git a/Rakefile b/Rakefile index 0c01671..fd517a6 100755 --- a/Rakefile +++ b/Rakefile @@ -6,14 +6,6 @@ Bundler.setup :default, :test, :development Bundler::GemHelper.install_tasks -if ENV['COVERAGE'] - require 'simplecov' - SimpleCov.start do - add_filter '/test/' - add_filter '/features/' - end -end - require 'rake/testtask' Rake::TestTask.new(:test) do |t| diff --git a/test/test_helper.rb b/test/test_helper.rb index 80bd6f7..c9f1875 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,20 @@ $LOAD_PATH << 'lib' +if ENV['COVERAGE'] + require 'simplecov' + require 'simplecov-lcov' + SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter + SimpleCov::Formatter::LcovFormatter.config do |c| + c.report_with_single_file = true + c.lcov_file_name = 'lcov.info' + c.single_report_path = 'coverage/lcov.info' + end + SimpleCov.start do + add_filter '/test/' + add_filter '/features/' + end +end + require 'minitest/autorun' require 'minitest/pride' require 'mocha/minitest'