diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 00000000..1d3e8d04 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,37 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +name: Ruby + +on: + push: + branches: [ workflow-branch ] + pull_request: + branches: [ workflow-branch ] + +jobs: + test: + + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['2.6', '2.7'] + + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: bundle exec rake + + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Gemfile b/Gemfile index 0ae69d18..f406471d 100644 --- a/Gemfile +++ b/Gemfile @@ -20,4 +20,6 @@ group :test do gem 'shoulda' gem 'shoulda-matchers' gem 'shoulda-context' + gem 'simplecov', require: false + gem 'simplecov-lcov', require: false end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c779112c..03e78985 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,18 @@ +require 'simplecov' +require 'simplecov-lcov' + +SimpleCov::Formatter::LcovFormatter.config do |c| + c.report_with_single_file = true + c.single_report_path = 'coverage/lcov.info' +end +SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new( + [ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::LcovFormatter, + ] +) +SimpleCov.start + # Encoding: UTF-8 # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration require 'bundler/setup' diff --git a/test/test_helper.rb b/test/test_helper.rb index 6efc7623..0d81aa44 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,18 @@ +require 'simplecov' +require 'simplecov-lcov' + +SimpleCov::Formatter::LcovFormatter.config do |c| + c.report_with_single_file = true + c.single_report_path = 'coverage/lcov.info' +end +SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new( + [ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::LcovFormatter, + ] +) +SimpleCov.start + # encoding: UTF-8 $:.unshift "lib" Gem.use_paths(nil, Gem.path << "vendor")