Codecov presents Coverage Flags, which is an uploading strategy to isolate coverage reports.
Source code overlay Toggle
ui coverage reports with one tap.
Navigate with specific flags visible.
Badges and graphs may express specific flags only. More details on this will come soon.
You can specify Flags in your Codecov Yaml for statuses and all notifications.
coverage status project defaultoff frontend flagsfrontend backend target50% flagsbackend api target89% flagsapi flags # filter the folder(s) you wish to measure by that flag backend # only include files in the backend folder paths app/backend/ frontend paths app/frontend/ api paths app/api/ tests paths tests/
Custom Statuses only report on specific Flags.
To apply a flag simply submit coverage reports with the
-F flagname included in the upload command; Codecov will do the rest. The following example illustrates how you may run specific test groups and upload coverage, flagging each coverage group.
# example running unittests only py.test --cov=./ -k tests/unittests/ bash <(curl -s https://codecov.io/bash) -C -F unittests # example running integration tests only py.test --cov=./ -k tests/integration/ bash <(curl -s https://codecov.io/bash) -C -F integration # example running ui tests only npm test bash <(curl -s https://codecov.io/bash) -C -F ui
-Cwill remove all previously uploaded reports.
Remove old reports after uploading (optional)
-C argument to clear the workspace of all coverage reports before running you next set of tests.
Flags must be lowercase, alphanumeric, and not exceed 45 characters
Only lowercase, alphanumeric values are accepted.
Codecov provides a strategy to isolate specific builds from the master report while maintaining the report's integrity. When reports are not joined into the master report, they will be ignored for comparison, although they will remain accessible for source overlay, api, badges, and graphing.
A nightly build is an excellent example of this feature. What follows is a yaml configuration for a nightly build.
flags nightly joinedfalse
Now that we have configured the flag
nightly to not join into the master report, let's upload a report flagged as
bash <(curl -s https://codecov.io/bash) -F nightly
-F nightly we mark all the coverage report data for this build as
nightly coverage data.