Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easier to run coverage reports locally #1750

Merged
merged 3 commits into from
May 23, 2023

Conversation

jdelStrother
Copy link
Contributor

@jdelStrother jdelStrother commented May 13, 2023

What are you trying to accomplish?

In #1075 we discovered a regression in coverage from CI, but I found it quite hard to run the coverage reports locally - multiple bundle exec appraisal rails-X rake runs would overwrite the coverage from previous runs with different rails/ruby versions. And then the rake coverage:report task expects the coverage reports to be in simplecov-resultset-* directories, which are usually generated in CI from the actions/download-artifact task.

What approach did you choose and why?

spec_helper/test_helper do set a simplecov command_name, but only when ENV["RUBY_VERSION"] is set.
I've updated it to always set a command name based on Rails::VERSION / RUBY_VERSION rather than needing environment variables to be specified.

I've also updated the rake coverage:report task to include resultsets in the default coverage directory, in addition to simplecov-resultset-*

@jdelStrother jdelStrother marked this pull request as draft May 13, 2023 12:24
This keeps simplecov's command names separate so that they don't
overwrite each other when running locally.

(In CI we generate one coverage/.resultset.json for each
RAILS_VERSION/RUBY_VERSION set, and then those are downloaded to
separate directories for the final `rake coverage:report`, so it's not
necessary there)
@jdelStrother jdelStrother marked this pull request as ready for review May 13, 2023 12:40
@jdelStrother jdelStrother changed the title Update coverage command names Make it easier to run coverage reports locally May 13, 2023
test/test_helper.rb Outdated Show resolved Hide resolved
@joelhawksley joelhawksley merged commit 3b3a37f into ViewComponent:main May 23, 2023
claudiob pushed a commit to claudiob/view_component that referenced this pull request Dec 22, 2023
* Make it easier to run coverage reports locally

This keeps simplecov's command names separate so that they don't
overwrite each other when running locally.

(In CI we generate one coverage/.resultset.json for each
RAILS_VERSION/RUBY_VERSION set, and then those are downloaded to
separate directories for the final `rake coverage:report`, so it's not
necessary there)

* Update test/test_helper.rb

---------

Co-authored-by: Joel Hawksley <joelhawksley@github.com>
Co-authored-by: Joel Hawksley <joel@hawksley.org>
claudiob pushed a commit to claudiob/view_component that referenced this pull request Jan 3, 2024
* Make it easier to run coverage reports locally

This keeps simplecov's command names separate so that they don't
overwrite each other when running locally.

(In CI we generate one coverage/.resultset.json for each
RAILS_VERSION/RUBY_VERSION set, and then those are downloaded to
separate directories for the final `rake coverage:report`, so it's not
necessary there)

* Update test/test_helper.rb

---------

Co-authored-by: Joel Hawksley <joelhawksley@github.com>
Co-authored-by: Joel Hawksley <joel@hawksley.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants