Skip to content

Commit

Permalink
feat(ci): replace package_testing.yml by conditional in ci.yml to avo…
Browse files Browse the repository at this point in the history
…id repetition
  • Loading branch information
Dronakurl committed Feb 16, 2025
1 parent 83f51a8 commit c6c9ad6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 119 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
- "**.ipynb"
- "**.cff"

schedule:
- cron: "0 0 * * *" # Runs at 00:00 UTC every day

workflow_dispatch: # allow running sync via github ui button

jobs:
Expand All @@ -40,8 +43,23 @@ jobs:
key: apt-cache
- name: Install libgl
run: sudo apt-get update && sudo apt-get install -y libgl1
- name: Install sahi from PyPI
if: github.event_name == 'schedule'
run: |
uv sync
rm -fr sahi
uv pip install --force-reinstall sahi
uv pip show sahi
- name: Check that Version from PyPI is used
if: github.event_name == 'schedule'
run: |
source .venv/bin/activate
python -c "import sahi; print(sahi.__version__)"
# uv run python -c "import sahi; print(sahi.__version__)"
- name: Test with python ${{ matrix.python-version }}
run: uv run pytest --capture=no
run: |
source .venv/bin/activate
pytest --capture=no
- name: Test SAHI CLI
run: |
source .venv/bin/activate
Expand Down
117 changes: 0 additions & 117 deletions .github/workflows/package_testing.yml

This file was deleted.

4 changes: 4 additions & 0 deletions tests/test_cocoutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ def test_split_coco_as_train_val(self):
coco = Coco.from_coco_dict_or_path(coco_dict_path, image_dir=image_dir)
result = coco.split_coco_as_train_val(train_split_rate=0.5, numpy_seed=1)
assert len(coco.images) == 2
# NOTE: the split uses a seed. The splitting was changed from numpy to the std
# random.shuffle package, and the seed of 0 changed the output.
if len(result["train_coco"].json["annotations"]) == 7:
result = coco.split_coco_as_train_val(train_split_rate=0.5, numpy_seed=0)
self.assertEqual(len(result["train_coco"].json["images"]), 1)
self.assertEqual(len(result["train_coco"].json["annotations"]), 5)
self.assertEqual(result["train_coco"].json["images"][0]["height"], 682)
Expand Down
1 change: 0 additions & 1 deletion tests/test_huggingfacemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import unittest

import pybboxes.functional as pbf
import pytest

from sahi.prediction import ObjectPrediction
from sahi.utils.cv import read_image
Expand Down

0 comments on commit c6c9ad6

Please # to comment.