diff --git a/.circleci/config.yml b/.circleci/config.yml index 9b6a0d6..003cd8b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,6 +51,15 @@ commands: - &cache-key gem-cache-v4-{{ checksum "<< parameters.path >>/<< parameters.gemspec-file >>" }}-<< parameters.ruby-image >> - gem-cache-v4-{{ checksum "<< parameters.path >>/<< parameters.gemspec-file >>" }} - gem-cache-v4- + - when: + condition: + equal: [ jruby:9.4-dev-jdk11, << parameters.ruby-image >> ] + steps: + - run: + name: Install Git + command: | + apt-get update + apt-get install -y git - run: name: Install dependencies command: | @@ -72,6 +81,7 @@ commands: - run: name: Collecting coverage reports command: | + apt-get update && apt-get install -y perl curl -Os https://uploader.codecov.io/latest/linux/codecov curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig @@ -271,10 +281,10 @@ workflows: - client-r2.4 - tests-ruby: name: client-jruby - ruby-image: "jruby:9.3.1.0-jdk11" + ruby-image: "jruby:9.4-dev-jdk11" - tests-ruby: name: APIs-jruby - ruby-image: "jruby:9.3.1.0-jdk11" + ruby-image: "jruby:9.4-dev-jdk11" gemspec-file: influxdb-client-apis.gemspec path: ./apis requires: diff --git a/.rubocop-cops.yml b/.rubocop-cops.yml index 6b42492..2e52b5c 100644 --- a/.rubocop-cops.yml +++ b/.rubocop-cops.yml @@ -40,3 +40,5 @@ Metrics/PerceivedComplexity: Max: 15 Metrics/ParameterLists: Max: 10 +Style/EmptyLiteral: + Enabled: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 494f687..1a4d21b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## 3.3.0 [unreleased] +### CI +1. [152](https://github.com/influxdata/influxdb-client-ruby/pull/152): +- Switches the JRuby jobs from jruby:9.3.1.0-jdk11 to jruby:9.4-dev-jdk11. +- Adds a monkeypatch for REXML::Document#initialize to tolerate malformed XML emitted during Cobertura report formatting. + 1. [#149](https://github.com/influxdata/influxdb-client-ruby/pull/149): Fix FrozenError in Point#to_line_protocol when frozen string literals are enabled ## 3.2.0 [2024-11-27] diff --git a/apis/test/test_helper.rb b/apis/test/test_helper.rb index faa80a4..bc5d3ff 100644 --- a/apis/test/test_helper.rb +++ b/apis/test/test_helper.rb @@ -26,6 +26,26 @@ if ENV['CI'] == 'true' require 'simplecov-cobertura' SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter + + # Monkeypatch REXML to handle malformed XML from simplecov-cobertura 1.4.2/2.1.0 + # see: https://github.com/dashingrocket/simplecov-cobertura/issues/31 + # TODO: remove this when simplecov-cobertura is updated + require 'rexml/document' + module REXML + class Document + alias original_initialize initialize + def initialize(source = nil, context = {}) + if source.is_a?(String) && source.include?('Generated by simplecov-cobertura') && !source.include?('" + original_initialize(source_with_root, context) + # Remove the dummy root element so simplecov-cobertura can add its own + delete_element('/coverage') + else + original_initialize(source, context) + end + end + end + end end $LOAD_PATH.unshift File.expand_path('../lib', __dir__) diff --git a/test/test_helper.rb b/test/test_helper.rb index 7fdd8d9..5150122 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -27,6 +27,26 @@ if ENV['CI'] == 'true' require 'simplecov-cobertura' SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter + + # Monkeypatch REXML to handle malformed XML from simplecov-cobertura 1.4.2/2.1.0 + # see: https://github.com/dashingrocket/simplecov-cobertura/issues/31 + # TODO: remove this when simplecov-cobertura is updated + require 'rexml/document' + module REXML + class Document + alias original_initialize initialize + def initialize(source = nil, context = {}) + if source.is_a?(String) && source.include?('Generated by simplecov-cobertura') && !source.include?('" + original_initialize(source_with_root, context) + # Remove the dummy root element so simplecov-cobertura can add its own + delete_element('/coverage') + else + original_initialize(source, context) + end + end + end + end end $LOAD_PATH.unshift File.expand_path('../lib', __dir__)