Skip to content

Commit 33f8394

Browse files
authored
Configured codecov (#174)
1 parent 93d71a1 commit 33f8394

File tree

11 files changed

+50
-54
lines changed

11 files changed

+50
-54
lines changed

.github/labeler.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ tracker:
1919
CLI:
2020
- changed-files:
2121
- any-glob-to-any-file: '**/__main__.py'
22+
DevOps:
23+
- head-branch:
24+
- 'devops/*'
25+
- 'ci/*'
26+
- changed-files:
27+
- any-glob-to-any-file: '.github/workflows/ci.yaml'
2228
release:
2329
- base-branch: 'main'
2430
enhancement:

.github/workflows/ci.yaml

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -98,48 +98,24 @@ jobs:
9898
token_format: access_token
9999

100100
- name: Run pytest
101-
uses: pavelzw/pytest-action@v2
102101
env:
103102
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
104103
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
105104
AWS_S3_ENDPOINT_URL: ${{ secrets.AWS_S3_ENDPOINT_URL }}
106105
LUXONISML_BUCKET: luxonis-test-bucket
107-
with:
108-
emoji: false
109-
custom-arguments: --cov luxonis_ml --cov-report xml --junit-xml pytest.xml
106+
run:
107+
pytest --cov --junitxml=junit.xml -o junit_family=legacy
110108

111-
- name: Create Test Report
112-
uses: EnricoMi/publish-unit-test-result-action@v2
109+
- name: Upload test results to Codecov
113110
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
111+
uses: codecov/test-results-action@v1
114112
with:
115-
files: pytest.xml
113+
token: ${{ secrets.CODECOV_TOKEN }}
114+
fail_ci_if_error: false
116115

117-
- name: Generate coverage badge
118-
uses: tj-actions/coverage-badge-py@v2
116+
- name: Upload coverage results to Codecov
119117
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
118+
uses: codecov/codecov-action@v4
120119
with:
121-
output: media/coverage_badge.svg
122-
123-
- name: Generate coverage report
124-
uses: orgoro/[email protected]
125-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
126-
with:
127-
coverageFile: coverage.xml
128-
token: ${{ secrets.GITHUB_TOKEN }}
129-
130-
- name: Commit coverage badge
131-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
132-
run: |
133-
git config --global user.name 'GitHub Actions'
134-
git config --global user.email '[email protected]'
135-
git diff --quiet media/coverage_badge.svg || {
136-
git add media/coverage_badge.svg
137-
git commit -m "[Automated] Updated coverage badge"
138-
}
139-
140-
- name: Push changes
141-
uses: ad-m/github-push-action@master
142-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
143-
with:
144-
branch: ${{ github.head_ref }}
145-
120+
token: ${{ secrets.CODECOV_TOKEN }}
121+
fail_ci_if_error: false

CONTRIBUTING.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ We use [pytest](https://docs.pytest.org/en/stable/) for testing.
4646
The tests are located in the `tests` directory. You can run the tests locally with:
4747

4848
```bash
49-
pytest tests --cov=luxonis_ml
49+
pytest tests --cov
5050
```
5151

5252
This command will run all tests and print a coverage report. The coverage report
@@ -62,7 +62,7 @@ The tests are run only if the pre-commit hook and documentation build pass.
6262
Successful tests are required for merging a PR.
6363

6464
1. Checks and tests are run automatically when you open a pull request.
65-
1. For the tests to run, the [pre-commit](#pre-commit-hooks) hook must pass and
65+
1. For the tests to run, the [pre-commit](#pre-commit-hooks) hook must pass, and
6666
the [documentation](#documentation) must be built successfully.
6767
1. Review the GitHub Actions output if your PR fails.
6868
1. Fix any issues to ensure that all checks and tests pass.
@@ -72,10 +72,6 @@ Successful tests are required for merging a PR.
7272
1. Make changes in a new branch.
7373
1. Test your changes locally.
7474
1. Commit (pre-commit hook will run).
75-
1. Push to your branch and create a pull request. Always request a review from:
76-
- [Martin Kozlovský](https://github.com/kozlov721)
77-
- [Klemen Skrlj](https://github.com/klemen1999)
78-
- [Matija Teršek](https://github.com/tersekmatija)
79-
- [Conor Simmons](https://github.com/conorsim)
75+
1. Push to your branch and create a pull request.
8076
1. Any other relevant team members can be added as reviewers as well.
8177
1. The team will review and merge your PR.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![PyPI - Downloads](https://img.shields.io/pypi/dm/luxonis-ml)](https://pypi.org/project/luxonis-ml/)
77

88
![CI](https://github.com/luxonis/luxonis-ml/actions/workflows/ci.yaml/badge.svg)
9-
![Coverage](https://github.com/luxonis/luxonis-ml/blob/dev/media/coverage_badge.svg)
9+
[![codecov](https://codecov.io/gh/luxonis/luxonis-ml/graph/badge.svg?token=01E7QTYXWU)](https://codecov.io/gh/luxonis/luxonis-ml)
1010

1111
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
1212
[![Docformatter](https://img.shields.io/badge/%20formatter-docformatter-fedcba.svg)](https://github.com/PyCQA/docformatter)

luxonis_ml/data/datasets/luxonis_dataset.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,8 @@ def add(self, generator: DatasetIterator, batch_size: int = 1_000_000) -> Self:
522522

523523
def _warn_on_duplicates(self) -> None:
524524
df = self._load_df_offline(lazy=True)
525+
if df is None:
526+
return
525527
# Warn on duplicate UUIDs
526528
duplicates_paired = (
527529
df.group_by("uuid")
@@ -541,7 +543,7 @@ def _warn_on_duplicates(self) -> None:
541543
# Warn on duplicate annotations
542544
duplicate_annotation = (
543545
df.group_by(["file", "annotation"])
544-
.agg(pl.count().alias("count"))
546+
.agg(pl.len().alias("count"))
545547
.filter(pl.col("count") > 1)
546548
)
547549
duplicate_annotation_df = duplicate_annotation.collect()

luxonis_ml/nn_archive/config_building_blocks/base_models/input.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ class Input(BaseModelExtraForbid):
8484
def validate_layout(self) -> Self:
8585
self.layout = self.layout.upper()
8686

87+
if len(self.layout) != len(set(self.layout)):
88+
raise ValueError("Layout must not contain duplicate letters.")
89+
8790
if len(self.layout) != len(self.shape):
8891
raise ValueError("Layout and shape must have the same length.")
8992

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ ignore_missing_imports = true
8383
[tool.pyright]
8484
typeCheckingMode = "basic"
8585

86+
[tool.pytest.ini_options]
87+
addopts = "--disable-warnings"
88+
8689
[tool.coverage.run]
8790
omit = [
8891
"luxonis_ml/embeddings/*",

tests/test_data/test_annotations.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import pytest
2-
31
from luxonis_ml.data.datasets.utils import add_generator_wrapper, rescale_values
42

53

@@ -85,7 +83,3 @@ def dummy_generator():
8583
tasks.append(record["annotation"]["task"])
8684

8785
assert sorted(tasks) == ["people-boundingbox", "people-keypoints"]
88-
89-
90-
if __name__ == "__main__":
91-
pytest.main(["-v", "--tb=short"])

tests/test_data/test_dataset.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ def generator():
179179

180180
with pytest.raises(ValueError):
181181
dataset.set_skeletons()
182-
dataset.add(generator())
183182

184183

185184
@pytest.mark.dependency(name="test_dataset[BucketStorage.LOCAL]")
@@ -198,8 +197,7 @@ def _raise(*_):
198197

199198
loader._load_image_with_annotations = _raise
200199
with pytest.raises(IndexError):
201-
for _ in loader:
202-
pass
200+
_ = loader[0]
203201

204202

205203
@pytest.mark.parametrize(
@@ -269,11 +267,21 @@ def generator(step=15):
269267

270268
with pytest.raises(ValueError):
271269
dataset.make_splits()
270+
271+
with pytest.raises(ValueError):
272272
dataset.make_splits((0.7, 0.1, 1))
273+
274+
with pytest.raises(ValueError):
273275
dataset.make_splits((0.7, 0.1, 0.1, 0.1)) # type: ignore
276+
277+
with pytest.raises(ValueError):
274278
dataset.make_splits((0.7, 0.1, 1), definitions=definitions)
279+
280+
with pytest.raises(ValueError):
275281
dataset.make_splits({"train": 1.5})
276-
dataset.make_splits({split: defs * 2 for split, defs in definitions.items()})
282+
283+
with pytest.raises(ValueError):
284+
dataset.make_splits({split: defs * 2 for split, defs in splits.items()})
277285

278286
dataset.add(generator(10))
279287
dataset.make_splits({"custom_split": 1.0})

tests/test_nn_archive/test_nn_archive.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,20 +160,26 @@ def test_layout():
160160
"layout": "1chwc2",
161161
}
162162
)
163+
164+
with pytest.raises(ValidationError):
163165
Input(
164166
**{
165167
**default,
166168
"shape": [1, 3, 256, 256],
167169
"layout": "nch",
168170
}
169171
)
172+
173+
with pytest.raises(ValidationError):
170174
Input(
171175
**{
172176
**default,
173177
"shape": [1, 3, 256, 256],
174178
"layout": "nchh",
175179
}
176180
)
181+
182+
with pytest.raises(ValidationError):
177183
Output(
178184
**{
179185
"name": "output",
@@ -182,6 +188,8 @@ def test_layout():
182188
"layout": "ncn",
183189
}
184190
)
191+
192+
with pytest.raises(ValidationError):
185193
Output(
186194
**{
187195
"name": "output",

0 commit comments

Comments
 (0)