question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting Flags for monorepo projects

See original GitHub issue

I have a Lerna Monorepo setup where I have packages in two folders:

  • root/platform/project-name/
  • root/extensions/project-name/

Upload All Reports From Root

I first tried using Jest’s multiproject runner, and then rely on .codecov.yml to properly split the one coverage report. Each project generates it’s coverage report, then the parent project runs codecov:

overage:
  status:
    project:
      default:
        threshold: 0.10%
      core:
        flags: core
      ui:
        flags: ui
      cornerstone:
        flags: cornerstone
    patch: off
flags:
  core:
    paths:
      - platform/core/src
  ui:
    paths:
      - platform/ui/src
  cornerstone:
    paths:
      - extensions/cornerstone/src

I see the following output in CI:

lerna success - ohif-core
lerna success - @ohif/i18n
lerna success - react-viewerbase
lerna success - ohif-viewer
  _____          _  
 / ____|        | |  
| |     ___   __| | ___  ___ _____   __  
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /  
| |___| (_) | (_| |  __/ (_| (_) \ V /  
 \_____\___/ \__,_|\___|\___\___/ \_/  
                                v3.5.0
==> Detecting CI Provider
    Circle CI Detected
==> Configuration: 
    Endpoint: https://codecov.io
{ commit: '3acea218fbc52e1f6fc010ff8ef501e4444cb57b',
  branch: 'pull/629',
  package: 'node-v3.5.0' }
==> Building file structure
==> Generating gcov reports (skip via --disable=gcov)
    $ find /home/circleci/repo -type f -name '*.gcno'  -exec gcov  {} +
==> Scanning for reports
    + /home/circleci/repo/platform/core/coverage/lcov.info
    + /home/circleci/repo/platform/core/coverage/clover.xml
    + /home/circleci/repo/platform/viewer/coverage/lcov.info
    + /home/circleci/repo/platform/viewer/coverage/clover.xml
    + /home/circleci/repo/platform/ui/coverage/lcov.info
    + /home/circleci/repo/platform/ui/coverage/clover.xml
==> Uploading reports
    Success!
    View report at: https://codecov.io/github/OHIF/Viewers/commit/3acea218fbc52e1f6fc010ff8ef501e4444cb57b

The GitHub reporter shows each project, but assumes the coverage report applies entirely to each project.

Upload Reports Individually

After running into issues with the above, I modified each project to upload it’s report individually, and to specify it’s flag/

Run once, for each project:

jest --ci --runInBand --collectCoverage && codecov --flags=someflag

CI reports the files as having been uploaded, but codecov shows an error/issue in the dashboard.

There was an error processing coverage reports.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
drazisilcommented, Aug 5, 2019

The only odd bit is that when I download the raw files for each upload, the file is completely garbled, and I’m unsure of why that is.

Because, if you are using Firefox, it needs to be renamed to *.txt.gz and extracted. The header and the filename aren’t in agreement, it’s on our backlog. If using Chrome, it’s similar, but in reverse, I believe.

1reaction
drazisilcommented, Aug 2, 2019

I’ll take a look Monday, but we do currently have an issue where if the YAML fails validation it is silently ignored.

That said, you should be able to view the raw reports from the build tab of the commit page on Codecov by clicking download for the build job that uploaded them

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Guide to Monorepos for Front-end Code - Toptal
A monorepo or monorepository is a code management and architectural concept whereby you keep all your isolated bits of code inside one super...
Read more >
Flags - Codecov
Group coverage reports based on type of tests or sub-projects/teams. ... Flags allow you to isolate and categorize coverage reports for different tests...
Read more >
Getting Started - monorepo guide
We've compiled a step-by-step guide for setting up your first monorepo. Hi! Welcome. This is a very quick tutorial to help you set...
Read more >
Monorepo - Handbook
This overhead hurts the amount of code sharing between projects. ... Compared to a multi-repo setup where we need to version every change,...
Read more >
How to Setup a JavaScript Monorepo Like a Professional
Add the --independent or --i flag to the init command to set up ... I started to look into the monorepo setup after...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found