diff --git a/.github/workflows/cops_and_specs.yml b/.github/workflows/cops_and_specs.yml deleted file mode 100644 index fd492d3..0000000 --- a/.github/workflows/cops_and_specs.yml +++ /dev/null @@ -1,34 +0,0 @@ -# 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: Cops and Specs - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - test: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - name: Run Rubocop - run: bundle exec rubocop - - name: Test & publish code coverage - uses: paambaati/codeclimate-action@v2.6.0 - env: - CC_TEST_REPORTER_ID: 5c1f50b6c3beb11b20e0e1d40800ebd81a5e1724b626060e9b366f2942acc315 - with: - coverageCommand: bundle exec rspec diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..4e5d665 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,19 @@ +name: Lint + +on: + push: + pull_request: + +jobs: + rubocop: + name: Rubocop + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: sanger/.github/.github/actions/setup/checkout@master + + - name: Setup Ruby + uses: sanger/.github/.github/actions/setup/ruby@master + + - name: Run rubocop + run: bundle exec rubocop -c .rubocop.yml --fail-fast diff --git a/.github/workflows/ruby_test.yml b/.github/workflows/ruby_test.yml new file mode 100644 index 0000000..6471a3f --- /dev/null +++ b/.github/workflows/ruby_test.yml @@ -0,0 +1,32 @@ +name: Ruby Tests + +env: + TZ: Europe/London + +on: + push: + pull_request: + +jobs: + test: + name: Rspec + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: sanger/.github/.github/actions/setup/checkout@master + + - name: Setup Ruby + uses: sanger/.github/.github/actions/setup/ruby@master + + - name: Run rspec + run: bundle exec rspec + + - name: Upload coverage reports to Codecov + uses: sanger/.github/.github/actions/tests/codecov@master + with: + name: ${{ github.run_id }}_${{ github.job }}_${{ github.event_name }} + token: ${{ secrets.CODECOV_TOKEN }} + flags: ${{ github.event_name }} + disable-search: true + files: ${{ github.workspace }}/lcov.info diff --git a/.gitignore b/.gitignore index b04a8c8..5b6f87d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ /.bundle/ /.yardoc /_yardoc/ -/coverage/ /doc/ /pkg/ /spec/reports/ @@ -9,3 +8,7 @@ # rspec failure tracking .rspec_status + +# coverage +/coverage/ +lcov.info diff --git a/.simplecov b/.simplecov new file mode 100644 index 0000000..23e31f2 --- /dev/null +++ b/.simplecov @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# https://github.com/simplecov-ruby/simplecov#getting-started + +require 'simplecov_json_formatter' +require 'simplecov-lcov' +SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true +SimpleCov::Formatter::LcovFormatter.config.single_report_path = 'lcov.info' +SimpleCov.formatters = + SimpleCov::Formatter::MultiFormatter.new( + [SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::JSONFormatter, SimpleCov::Formatter::LcovFormatter] + ) +SimpleCov.start :rails do + add_filter '/coverage/' + add_filter '/spec/' + + enable_coverage :branch + + # You can add_filter here to add anything else you don't want to cover + + # Mainly here for reference, and wont be running it again + add_filter '/lib/ability_analysis/spec_generator.rb' +end diff --git a/Gemfile.lock b/Gemfile.lock index 45ffc14..8f0350f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,7 +10,7 @@ GEM base64 (0.1.1) coderay (1.1.3) diff-lcs (1.5.0) - docile (1.4.0) + docile (1.4.1) json (2.6.3) language_server-protocol (3.17.0.3) method_source (1.0.0) @@ -66,7 +66,8 @@ GEM docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.2) + simplecov-lcov (0.9.0) simplecov_json_formatter (0.1.4) unicode-display_width (2.4.2) yard (0.9.34) @@ -83,6 +84,7 @@ DEPENDENCIES rubocop (~> 1.56) rubocop-rspec (~> 2.24) simplecov (~> 0.22) + simplecov-lcov (~> 0.9) yard (~> 0.9) BUNDLED WITH diff --git a/README.md b/README.md index 6ffa9c7..0377488 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ - # RecordLoader -![Cops and Specs](https://github.com/sanger/record_loader/workflows/Cops%20and%20Specs/badge.svg) -[![Maintainability](https://api.codeclimate.com/v1/badges/0ce827d110dfced197ab/maintainability)](https://codeclimate.com/github/sanger/record_loader/maintainability) -[![Test Coverage](https://api.codeclimate.com/v1/badges/0ce827d110dfced197ab/test_coverage)](https://codeclimate.com/github/sanger/record_loader/test_coverage) +[![Ruby](https://img.shields.io/badge/ruby-3.0-e2242a?logo=ruby)](https://ruby-doc.org/3.0.6/) +[![Test Coverage](https://codecov.io/gh/sanger/record_loader/graph/badge.svg?token=AO7PUU5SB0)](https://codecov.io/gh/sanger/record_loader) [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](https://rubydoc.info/github/sanger/record_loader) RecordLoader provides a simple and standardized way of populating databases from information described in a series of diff --git a/record_loader.gemspec b/record_loader.gemspec index 5d42f0b..9d65c29 100644 --- a/record_loader.gemspec +++ b/record_loader.gemspec @@ -47,9 +47,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rspec', '~> 3.12' spec.add_development_dependency 'rubocop', '~> 1.56' spec.add_development_dependency 'rubocop-rspec', '~> 2.24' - spec.add_development_dependency 'yard', '~> 0.9' - # Pin simplecov to ~> 0.17 until CodeClimate compatibility - # issues resolved: - # https://github.com/codeclimate/test-reporter/issues/413 spec.add_development_dependency 'simplecov', '~> 0.22' + spec.add_development_dependency 'simplecov-lcov', '~> 0.9' + spec.add_development_dependency 'yard', '~> 0.9' end