I’m trying to learn the difference between defining flags in a codecov.yml
file and for manually defining the flag when publishing a report via the cli.
In our example, we have a mono repo with 3x projects. As such, I’ve created a codecov.yml
file with 3x flags in it:
coverage:
status:
project:
default: on
project1:
target: 85%
flags: project1
project2:
target: 85%
flags: project2
project3:
target: 85%
flags: project3
flags:
project1:
paths:
- <paths to src and all tests, etc>
project2:
paths:
- <paths to src and all tests, etc>
project3:
paths:
- <paths to src and all tests, etc>
now, in any of the projects i send the reports up to codcov like this…
(This is using Azure DevOps but it’s a CLI tool so it could be anywhere)
** Project 1’s CI file (called a pipeline yml file)
# Send coverage reports
- script: |
codecov -f "$(Build.SourcesDirectory)/Project1.UnitTest1/coverage.opencover.xml" -t $(CODECOV_TOKEN) --flag project1
displayName: 'upload report to codecov.io for Project1 UnitTest 1'
- script: |
codecov -f "$(Build.SourcesDirectory)/Project1.UnitTest2/coverage.opencover.xml" -t $(CODECOV_TOKEN) --flag project1
displayName: 'upload report to codecov.io for Project1 UnitTest 2'
=> notice the flag there?
of course, i’ll hardcode different flag values in the other project CI files …
so …
Q1: do i need to define the flag stuff in BOTH files?
Q2: what is the releationship between the flag settings in the codecov.yml file vs the CLI tool ?