Open mcampo84 opened 4 years ago
same problem to yours
I tried to add path-to-lcov
but no luck
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/.resultset.json
I wonder if Rails is not supported
Overalls expects a consolidated lcov.info file.
# Gemfile
gem "simplecov-lcov"
# spec_helper.rb
if ENV["COVERAGE"]
require "simplecov"
require "simplecov-lcov"
SimpleCov.start "rails" do
if ENV["CI"]
SimpleCov::Formatter::LcovFormatter.config do |config
config.report_with_simgle_file = true
config.lcov_file_name = "lcov.info"
else
SimpleCov::Formatter::HTMLFormatter
end
end
# test.yml
...
- name: Run test
...
run: |
...
COVERAGE=true CI=true DISABLE_SPRING=true bundle exec rspec spec
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-tocken: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "./coverage/lcvo/lcov.info"
Here is some cleaned up code of @stephaneliu, etc.
spec_helper.rb
if ENV['COVERAGE'] == 'true'
require 'coveralls'
require 'simplecov'
require 'simplecov-lcov'
if ENV['CI'] == 'true'
SimpleCov::Formatter::LcovFormatter.config do |config|
config.report_with_single_file = true
config.lcov_file_name = 'lcov.info'
end
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::LcovFormatter,
Coveralls::SimpleCov::Formatter
])
else
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
end
SimpleCov.start('rails')
end
ci.yml
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-tocken: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "./coverage/lcov/lcov.info"
Gemfile
gem 'simplecov', require: false
gem 'simplecov-lcov', require: false
gem 'coveralls_reborn', '~> 0.18.0', require: false
You will need this library as well since the original is unmaintained.
Cheers
You don't need a the coveralls nor coverals_reborn gem if using github actions, it picks up the lcov file written by the simplecov gem.
You need to add to your gemfile 2 gems, under the test group
gem 'simplecov', require: false
gem 'simplecov-lcov', require: false
Also create a file called .simplecov
in your root dir
and add this
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = 'coverage/lcov.info'
end
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::LcovFormatter,
]
)
SimpleCov.start('rails')
I'm new to Ruby on Rails, Github Actions and Coveralls, and I can't seem to get this github action working. It doesn't seem to be able to find the coverage report file after I run rspec tests.
My .coveralls.yml file looks like this:
What am I missing?