Skip to content

Commit

Permalink
feat: engine CI runs tests and coverage (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
picsalex committed Apr 3, 2024
1 parent 7627d10 commit f830f02
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/engine_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, 3.10, 3.11]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3

Expand All @@ -39,14 +39,16 @@ jobs:
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=tests/
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=tests/ --max-line-length=88
- name: Test with pytest
run: |
pytest tests/decorators tests/logger --cov=src/decorators src/logger.py --cov-report=xml
pytest tests/decorators tests/logger --cov=src.decorators --cov=src.logger --cov-report=xml
- name: Codecov
uses: codecov/codecov-action@v4.1.1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
file: ./coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
slug: picselliahq/picsellia-training-engine
7 changes: 7 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
black
mypy
pre-commit
pytest
pytest-cov
ruff
tabulate
2 changes: 1 addition & 1 deletion src/decorators/pipeline_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class Pipeline:
ACTIVE_PIPELINE: Optional["Pipeline"] = None
STEPS_REGISTRY: dict[str, StepMetadata] = {}
STEPS_REGISTRY: Dict[str, StepMetadata] = {}

def __init__(
self,
Expand Down
6 changes: 3 additions & 3 deletions src/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import tempfile
from datetime import datetime
from typing import Optional, TextIO, cast
from typing import Optional, TextIO, cast, List

from src.models.logging.stream_to_logger import StreamToLogger
from src.models.steps.step_metadata import StepMetadata
Expand Down Expand Up @@ -53,7 +53,7 @@ def configure_pipeline_initialization_log_file(self) -> str:

return pipeline_initialization_log_file_path

def configure_log_files(self, steps_metadata: list[StepMetadata]) -> None:
def configure_log_files(self, steps_metadata: List[StepMetadata]) -> None:
"""Configures the folders and log files for the pipeline and its steps.
If the `log_folder_path` is not provided when decorating a pipeline, a temporary directory is created instead.
Expand Down Expand Up @@ -144,7 +144,7 @@ def prepare_logger(self, log_file_path: Optional[str]) -> logging.Logger:

return self.logger

def _configure_steps_log_files(self, steps_metadata: list[StepMetadata]) -> None:
def _configure_steps_log_files(self, steps_metadata: List[StepMetadata]) -> None:
"""Configures the log files for each step.
For each step, will look at the metadata to create a log file.
Expand Down

0 comments on commit f830f02

Please sign in to comment.