From 27d8ba743e781e98fb2297f72e9765b50319e747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sp=C3=B6ttel?= <1682504+fspoettel@users.noreply.github.com> Date: Wed, 8 Feb 2023 14:15:50 +0100 Subject: [PATCH] ci: enable github actions --- .github/workflows/ci.yml | 20 +++++++++++--------- app/tests/test_api.py | 3 ++- mypy.ini | 2 +- pyproject.toml | 26 +++++++++++++------------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b963219..aba3c77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,13 +9,14 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.10' cache: 'pip' - - pip install -e .[dev] - - black --check app - - isort --check app - - flake8 app - - mypy app + cache-dependency-path: '**/pyproject.toml' + - run: pip install -e .[web,tooling] + - run: black --check app + - run: isort --check app + - run: flake8 app + - run: mypy app test: runs-on: ubuntu-latest name: Test @@ -23,7 +24,8 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.10' cache: 'pip' - - pip install -e .[test] - - pytest + cache-dependency-path: '**/pyproject.toml' + - run: pip install -e .[web,tooling] + - run: pytest diff --git a/app/tests/test_api.py b/app/tests/test_api.py index 34e4756..8bdc560 100644 --- a/app/tests/test_api.py +++ b/app/tests/test_api.py @@ -7,10 +7,11 @@ from sqlalchemy.orm import Session import app.shared.db.dtos as dtos import app.shared.db.models as models from app.shared.db.dtos import JobStatus, JobType -from app.web.main import app, celery +from app.web.main import app client = TestClient(app) + @pytest.fixture(name="mock_job", scope="function", autouse=False) def mock_job(db_session: Session) -> models.Job: job = models.Job( diff --git a/mypy.ini b/mypy.ini index 9813db0..1c26ad6 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,4 +1,4 @@ [mypy] -plugins = pydantic.mypy, sqlmypy +plugins = sqlmypy ignore_missing_imports = True disallow_untyped_defs = True diff --git a/pyproject.toml b/pyproject.toml index 8a33afc..dd7915b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "whisperbox" +name = "whisperbox_transcription" description = "" version = "0.0.1" @@ -21,25 +21,25 @@ worker=[ "requests ==2.28.2" ] -lint = [ +tooling = [ # code formatting - "black", - "isort", + "black ==23.1.0", + "isort ==5.12.0", # linting - "flake8", - "mypy", -] - -test = [ + "flake8 ==6.0.0", + # tests "httpx", - "sqlalchemy-stubs", "sqlalchemy-utils ==0.39.0", - "python-dotenv", - "pytest", + "python-dotenv ==0.21.1", + "pytest ==7.2.1", + # types + "mypy ==1.0.0", + "sqlalchemy-stubs ==0.4", + "types-requests ==2.28.11.12" ] worker_dev = [ - "watchdog[watchmedo]" + "watchdog[watchmedo] ==2.2.1" ] [tool.isort]