From 60a1bdee901c8cc44f37bad867187d0fb0db5f80 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 29 Apr 2026 15:51:24 +0100 Subject: [PATCH 1/6] ci: replace build workflows Based on traction-service --- .github/workflows/cops_and_specs.yml | 34 ---------------------------- .github/workflows/lint.yml | 19 ++++++++++++++++ .github/workflows/ruby_test.yml | 23 +++++++++++++++++++ 3 files changed, 42 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/cops_and_specs.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/ruby_test.yml 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..ebf522e --- /dev/null +++ b/.github/workflows/ruby_test.yml @@ -0,0 +1,23 @@ +name: Ruby Tests + +env: + TZ: Europe/London + +on: + push: + pull_request: + +jobs: + test: + name: All Ruby Tests + 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 From 6ff472d0cf963351b00a520d411fc12584239434 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 29 Apr 2026 15:57:10 +0100 Subject: [PATCH 2/6] ci: rename tests --- .github/workflows/ruby_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby_test.yml b/.github/workflows/ruby_test.yml index ebf522e..90ceeb5 100644 --- a/.github/workflows/ruby_test.yml +++ b/.github/workflows/ruby_test.yml @@ -9,7 +9,7 @@ on: jobs: test: - name: All Ruby Tests + name: Rspec runs-on: ubuntu-latest steps: From 219c3c8061b15f43362ad591df165878e2b2a662 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 29 Apr 2026 16:07:38 +0100 Subject: [PATCH 3/6] ci: add back coverage checking with codecov --- .github/workflows/ruby_test.yml | 9 +++++++++ .gitignore | 5 ++++- .simplecov | 23 +++++++++++++++++++++++ Gemfile.lock | 2 ++ record_loader.gemspec | 6 ++---- 5 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 .simplecov diff --git a/.github/workflows/ruby_test.yml b/.github/workflows/ruby_test.yml index 90ceeb5..46efa1b 100644 --- a/.github/workflows/ruby_test.yml +++ b/.github/workflows/ruby_test.yml @@ -21,3 +21,12 @@ jobs: - 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: ruby,${{ 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..475605e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,6 +67,7 @@ GEM simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) + 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/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 From af78a36b1da215d8bdcc6303f13fc6466fa8a07a Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 29 Apr 2026 16:21:35 +0100 Subject: [PATCH 4/6] ci: remove extra flag --- .github/workflows/ruby_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby_test.yml b/.github/workflows/ruby_test.yml index 46efa1b..6471a3f 100644 --- a/.github/workflows/ruby_test.yml +++ b/.github/workflows/ruby_test.yml @@ -27,6 +27,6 @@ jobs: with: name: ${{ github.run_id }}_${{ github.job }}_${{ github.event_name }} token: ${{ secrets.CODECOV_TOKEN }} - flags: ruby,${{ github.event_name }} + flags: ${{ github.event_name }} disable-search: true files: ${{ github.workspace }}/lcov.info From d6ce2093869bf62d48d5347459ab069b13eb2b6b Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 29 Apr 2026 16:37:41 +0100 Subject: [PATCH 5/6] docs: update readme badges --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5228ca6..93b1f75 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 @@ -213,7 +211,7 @@ also run `bin/console` for an interactive prompt that will allow you to experime To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, ensure the CHANGELOG.md is updated and that everything is committed. -Then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push +Then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing From d080289ba837264b0ea60043795a54e901c34dc2 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 29 Apr 2026 16:44:49 +0100 Subject: [PATCH 6/6] build: update simplecov dependencies --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 475605e..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,7 @@ 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)