From 4755de616a5dea87d998f9ad4a51cfb4b62e0cc3 Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Fri, 9 May 2025 11:00:42 +0200 Subject: [PATCH 1/3] CI: build with Ruby 3.4 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7c46fce..9c35af2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['2.0', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', 'jruby'] + ruby-version: ['2.0', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4', 'jruby'] steps: - uses: actions/checkout@v3 From 8233cda6d39994344ec26cec1133d5bd4ffb767a Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Fri, 9 May 2025 11:08:47 +0200 Subject: [PATCH 2/3] Minimum supported Ruby version is now 2.1 --- .github/workflows/test.yml | 2 +- discid.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c35af2..bb3e105 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['2.0', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4', 'jruby'] + ruby-version: ['2.1', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4', 'jruby'] steps: - uses: actions/checkout@v3 diff --git a/discid.gemspec b/discid.gemspec index 9fbb573..29dbd15 100644 --- a/discid.gemspec +++ b/discid.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |spec| spec.post_install_message = %q{Please make sure you have libdiscid (http://musicbrainz.org/doc/libdiscid) installed.} spec.requirements = "libdiscid >= 0.1.0" - spec.required_ruby_version = ">= 2.0" + spec.required_ruby_version = ">= 2.1" spec.required_rubygems_version = ">= 1.3.6" spec.files = Dir['{lib,examples,test}/**/*.rb'] + From d903e6c194848208a72ad707c66153daa5e9f8fa Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Fri, 9 May 2025 11:11:10 +0200 Subject: [PATCH 3/3] Allow building with newer simplecov versions --- .github/workflows/test.yml | 3 ++- discid.gemspec | 7 ++++++- test/helper.rb | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bb3e105..f9308ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,8 @@ jobs: - name: Run tests run: bundle exec rake test - name: Submit code coverage results - uses: paambaati/codeclimate-action@v3.2.0 + uses: paambaati/codeclimate-action@v9.0.0 + if: matrix.ruby-version != '2.1' env: CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_REPO_TOKEN }} diff --git a/discid.gemspec b/discid.gemspec index 29dbd15..f610f5d 100644 --- a/discid.gemspec +++ b/discid.gemspec @@ -31,5 +31,10 @@ Gem::Specification.new do |spec| spec.add_development_dependency "yard" spec.add_development_dependency "redcarpet" if not RUBY_PLATFORM == "java" spec.add_development_dependency "test-unit" - spec.add_development_dependency "simplecov", "< 0.18" + + # The code coverage is only supported for Ruby >= 2.4 + if (RUBY_VERSION.split('.').map{|s|s.to_i} <=> [2, 4, 0]) >= 0 + spec.add_development_dependency "simplecov" + spec.add_development_dependency "simplecov_json_formatter" + end end diff --git a/test/helper.rb b/test/helper.rb index 8dc5991..49b40f4 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2013-2014 Philipp Wolfer +# Copyright (C) 2013-2014, 2025 Philipp Wolfer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -15,10 +15,12 @@ begin require 'simplecov' + require "simplecov_json_formatter" + SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter SimpleCov.start do add_filter "/test/" end rescue LoadError - puts 'WARNING: codeclimate-test-reporter not available, no code coverage reported.' + puts 'WARNING: simplecov not available, no code coverage reported.' end