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

Unable to specify coverage reports flags per file #1522

Open
ssbarnea opened this issue Jul 25, 2024 · 1 comment
Open

Unable to specify coverage reports flags per file #1522

ssbarnea opened this issue Jul 25, 2024 · 1 comment
Assignees

Comments

@ssbarnea
Copy link

Current way to define flags forces them to apply to all files part of a single upload step. Ideally the flags should be per file and not per upload action.

This makes Github Actions definition much harder to manage as we are forced to add extra calls to the upload action, especially as GHA does not have any support for looping.

It would be far more flexible if we could so something like:

    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v4
      with:
        directory: ./coverage/reports/
        files: ./coverage1.xml:unit,./coverage2.xml:e2e,!./cache # <- note the `:flag` after file pattern.
        # flags: unit,e2e

Or maybe someone else has another idea?

@thomasrockhu-codecov thomasrockhu-codecov self-assigned this Aug 1, 2024
@belgattitude
Copy link

Not totally sure about the intent... But I'm facing a similar issue. My issue is that with the current codecov action, I'm not able to upload coverage for each packages (flagged): ie: flag-lib1: coverage 90%, flag-lib2: coverage: 81%

I have a nodejs monorepo setup: https://github.com/belgattitude/httpx

.
└── packages
    │── assert
        └── coverage/clover.xml 
    │── dsn-parser
        └── coverage/clover.xml
    │── exception
        └── coverage/clover.xml
    └── plain-object
        └── coverage/clover.xml
- codecov.yml

In my codecov.yml, I've set up the flags for each packages

See here
coverage:
  range: 60..100
  round: down
  precision: 2

flag_management:
  default_rules:
    carryforward: false
  individual_flags:
    - name: httpx-exception-unit
      paths:
        - packages/exception
      statuses:
        - type: project
          target: 90%
          threshold: 1%

    - name: httpx-dsn-parser-unit
      paths:
        - packages/dsn-parser
      statuses:
        - type: project
          target: 90%
          threshold: 1%

    - name: httpx-memo-intl-unit
      paths:
        - packages/memo-intl
      statuses:
        - type: project
          target: 90%
          threshold: 1%

    - name: httpx-plain-object-unit
      paths:
        - packages/plain-object
      statuses:
        - type: project
          target: 90%
          threshold: 1%

    - name: httpx-assert-unit
      paths:
        - packages/assert
      statuses:
        - type: project
          target: 90%
          threshold: 1%

    - name: httpx-json-api-unit
      paths:
        - packages/json-api
      statuses:
        - type: project
          target: 50%
          threshold: 1%

ignore:
  - '.yarn/**/*'
  - '.husky/**/*'
  - 'docs/**/*'
  - 'examples/**/*'
  - '**/dist/**/*'

github_checks: true

comment:
  layout: 'reach, diff, flags, files'
  behavior: default
  require_changes: false
  require_base: yes
  require_head: yes
  branches: null
  show_carryforward_flags: true

I was expecting the codecov action to read paths assicated to the flags... but it actually doesn't.

So to be able to get covergae independently, I have to upload multiple times with each flags.

It would be nice to have a better way to do

PS: I have done it with the cli, but it does not work anymore (complains about missing token..., or rate limits)

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

No branches or pull requests

3 participants