-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
T-79: Set up Coveralls using GitHub Actions
- Loading branch information
Showing
4 changed files
with
70 additions
and
11 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,53 @@ | ||
# DOCS: https://github.com/colszowka/simplecov | ||
# DOCS: https://docs.coveralls.io/ruby-on-rails | ||
## | ||
# Coverage using SimpleCov. | ||
# | ||
# NOTE: What is SimpleCov? | ||
# https://github.com/simplecov-ruby/simplecov | ||
# | ||
# NOTE: What is lcov and how to set up it? | ||
# - https://github.com/fortissimo1997/simplecov-lcov | ||
# - https://github.com/tagliala/coveralls-ruby-reborn#github-actions | ||
# | ||
# NOTE: How to deploy coverage data to Coveralls using GitHub Actions? | ||
# - https://github.com/marketplace/actions/coveralls-github-action | ||
# - https://github.com/coverallsapp/github-action/issues/29 | ||
# | ||
# IMPORTANT: Why `basic_temperature/version.rb` is ignored? See: | ||
# https://github.com/simplecov-ruby/simplecov/issues/557 | ||
# | ||
|
||
## | ||
# Fixes the following error for older Ruby versions. | ||
# | ||
# Formatter SimpleCov::Formatter::LcovFormatter failed with NoMethodError: undefined method `branch_coverage?' for SimpleCov:Module | ||
# | ||
# https://github.com/fortissimo1997/simplecov-lcov/pull/25/files | ||
# | ||
# TODO: Remove when support for Rubies lower than 2.5 will be dropped. | ||
# | ||
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.5') | ||
module SimpleCov | ||
class << self | ||
def branch_coverage? | ||
false | ||
end | ||
end | ||
end | ||
end | ||
|
||
require 'simplecov' | ||
require 'coveralls' | ||
require 'simplecov-lcov' | ||
|
||
SimpleCov::Formatter::LcovFormatter.config do |config| | ||
config.report_with_single_file = true | ||
config.single_report_path = 'coverage/lcov.info' | ||
end | ||
|
||
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ | ||
SimpleCov::Formatter::HTMLFormatter, | ||
Coveralls::SimpleCov::Formatter | ||
SimpleCov::Formatter::LcovFormatter | ||
]) | ||
|
||
SimpleCov.start do | ||
add_filter '/spec/' | ||
end | ||
|
||
# NOTE: `basic_temperature/version.rb` is ignored intentionally. | ||
# See https://github.com/colszowka/simplecov/issues/557 |