diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index 042c856..0000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Lint - -on: [push, pull_request] - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: psf/black@stable - with: - options: "--check --verbose" diff --git a/.github/workflows/poetry.yml b/.github/workflows/poetry.yml new file mode 100644 index 0000000..b2a6be4 --- /dev/null +++ b/.github/workflows/poetry.yml @@ -0,0 +1,28 @@ +name: Poetry + +on: [push, pull_request] + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v5 + - name: Install poetry + uses: abatilo/actions-poetry@v3 + - name: Setup a local virtual environment + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + - uses: actions/cache@v4 + name: Define a cache for the virtual environment based on the dependencies lock file + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + - name: Install the project dependencies + run: poetry install + - name: Lint check with python black + run: poetry run black --check --verbose . + - name: Isort check + run: poetry run isort . --check --diff diff --git a/kci-dev/kci-dev.py b/kci-dev/kci-dev.py index 1ea1c65..14c889d 100755 --- a/kci-dev/kci-dev.py +++ b/kci-dev/kci-dev.py @@ -2,8 +2,7 @@ # -*- coding: utf-8 -*- import click -from subcommands import commit -from subcommands import patch +from subcommands import commit, patch @click.group( diff --git a/kci-dev/subcommands/commit.py b/kci-dev/subcommands/commit.py index c3e2a7f..29d9c07 100644 --- a/kci-dev/subcommands/commit.py +++ b/kci-dev/subcommands/commit.py @@ -1,10 +1,11 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import json + import click -import toml import requests -import json +import toml from git import Repo diff --git a/kci-dev/subcommands/patch.py b/kci-dev/subcommands/patch.py index 1f81e9a..ed29f22 100644 --- a/kci-dev/subcommands/patch.py +++ b/kci-dev/subcommands/patch.py @@ -1,10 +1,11 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import json + import click -import toml import requests -import json +import toml from git import Repo diff --git a/pyproject.toml b/pyproject.toml index 29d63a4..40ab506 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ classifiers = [ ] [tool.poetry.dependencies] -python = "^3.12" +python = "^3.10" click = "^8.1.7" requests = "^2.32.3" toml = "^0.10.2" @@ -41,6 +41,8 @@ kci-dev = 'kci-dev.kci-dev:run' [tool.poetry.group.ci.dependencies] black = "^24.8.0" +isort = "^5.13.2" +pytest = "^8.3.3" [build-system] requires = ["poetry-core"]