https://github.com/codecov/example-components
An example of how to use Codecov's Components feature
https://github.com/codecov/example-components
Last synced: 5 months ago
JSON representation
An example of how to use Codecov's Components feature
- Host: GitHub
- URL: https://github.com/codecov/example-components
- Owner: codecov
- License: mit
- Created: 2023-01-28T19:44:06.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-05T22:55:05.000Z (about 1 year ago)
- Last Synced: 2025-08-17T18:59:11.950Z (5 months ago)
- Language: Python
- Size: 21.5 KB
- Stars: 2
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# example-components
An example of how to use Codecov's Components feature
The initial setup consists of 2 directories `calculator` and `smiles`. The `calculator` directory also consists of 2 sub-directories `simple` and `complex`.
```
.
├── calculator
│ ├── complex
│ │ ├── complex_calculator.py
│ │ └── test_complex_calculator.py
│ └── simple
│ ├── simple_calculator.py
│ └── test_simple_calculator.py
└── smiles
├── smiles.py
└── test_smiles.py
```
As shown above, each file exists alongside its corresponding test file.
For this example, there will be **2 components**, `calculator` and `smiles` which correspond to the directories. You will need to edit the `codecov.yml` file as is done in this repository in order to see Components in your codebases. See [our documentation](https://docs.codecov.com/docs/components) for details.
## Components in the PR comment
To see an example of what components look like in the Codecov [PR comment](https://github.com/codecov/example-components/pull/2#issuecomment-1407490619), see this [pull request](https://github.com/codecov/example-components/pull/2). Note the section `Components` where you will see the increase in the `calculator` component.
## Components with multiple uploads
To see how Components deal with multiple uploads, see this [pull request](https://github.com/codecov/example-components/pull/3). The `calculator` Component is created as a union of the `complex` and `simple` coverage uploads.
Since Components are not correlated with uploads, you do not need to specify Components during upload time, only in the `codecov.yml` file. They will work with any number of uploads.
## Components with flags
Unlike Components, Flags are correlated with uploads. For larger codebases, you may find that you will need a Flag for internal services (e.g. `simple/` and `complex/`) of projects (e.g. `calculator/` and `smiles/`) in a monorepository.
See this [pull request](https://github.com/codecov/example-components/pull/4) with how to incorporate both into your systems.