Sha256: cd807256dd12a62bf6b038b033454a5bc2319531a9b64e02260f70f75e1fc51e

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

ruby_version = Gem::Version.new(RUBY_VERSION)
actual_version = lambda do |major, minor|
  actual = Gem::Version.new(ruby_version)
  major == actual.segments[0] && minor == actual.segments[1] && RUBY_ENGINE == "ruby"
end
coverage = actual_version.call(2, 6)

if coverage
  require "simplecov-cobertura"
  require "simplecov_json_formatter"
  require "codecov"

  SimpleCov.start do
    add_filter "/spec/"
    add_filter "/lib/activerecord/transactionable/version.rb"

    if ENV["CI"]
      # Disambiguate individual test runs
      command_name "#{ENV["GITHUB_WORKFLOW"]} Job #{ENV["GITHUB_RUN_ID"]}:#{ENV["GITHUB_RUN_NUMBER"]}"
      formatters = []
      formatters << SimpleCov::Formatter::HTMLFormatter
      formatters << SimpleCov::Formatter::CoberturaFormatter
      formatters << SimpleCov::Formatter::JSONFormatter # For CodeClimate
      formatters << SimpleCov::Formatter::Codecov # For CodeCov
      formatter SimpleCov::Formatter::MultiFormatter.new(formatters)
    else
      # Use default
      formatter SimpleCov::Formatter::HTMLFormatter
    end

    track_files "**/*.rb"
  end
else
  puts "Not running coverage on #{RUBY_ENGINE} #{RUBY_VERSION}"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-transactionable-3.0.1 .simplecov