codecov-ruby icon indicating copy to clipboard operation
codecov-ruby copied to clipboard

Support monorepo

Open filmhubhq opened this issue 5 years ago • 0 comments

Say you have a monorepo with

/ (repo root)
├── rails
└── web

This breaks the codecov report because of missing rails/ and web/ prefixes in all paths. Path fixing only works for one subfolder because it's global (not per flag/test suite), and breaks all paths of the other.

We have found a workaround with

# rails/test/support/coverage.rb, required in test_helper.rb:
SimpleCov.start 'rails' do
  # test file paths need to include `rails/...` for codecov
  root File.expand_path('../../..', __dir__)
  # .. but move the coverage reports back into `rails/test/coverage`
  coverage_dir 'rails/coverage'
end

but that's rather cumbersome.

The issue is that this is not configurable: https://github.com/codecov/codecov-ruby/blob/e1b4e2f85b7ac9d6b33e6af9b932a865d1c765dd/lib/codecov.rb#L581

Would you be open for a PR? If so, any preferred config API? Maybe simply like this?

CODECOV_ROOT=rails/

Sorry for hammering you guys! We just love codecov so much we want to use it everywhere! :)

filmhubhq avatar Jan 19 '21 19:01 filmhubhq