Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic GitHub actions workflow #20

Merged
merged 6 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: repl

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
test:

name: ${{ matrix.python-version }}
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
allow-prereleases: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade poetry
python -m poetry install
- name: Lint with ruff
run: |
poetry run ruff check .
- name: Check types with mypy
run: |
poetry run mypy pymodbus_repl
- name: Pytest
run: |
poetry run pytest
146 changes: 127 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pymodbus_repl/lib/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
)


class Command:
class Command(dict):
"""Class representing Commands to be consumed by Completer."""

def __init__(self, name, signature, doc, slave=False):
Expand Down
5 changes: 4 additions & 1 deletion pymodbus_repl/server/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from pymodbus_repl import __VERSION__ as repl_version
from pymodbus_repl.lib.completer import CmdCompleter
from pymodbus_repl.lib.helper import Command, style
from pymodbus_repl.lib.reactive import (
ReactiveServer,
)


TITLE = r"""
Expand Down Expand Up @@ -167,7 +170,7 @@ def _print_help():
_print_help()


def print_server_config(server: "ReactiveServer", print_server_context: bool = False, *extra) -> dict: # noqa
def print_server_config(server: ReactiveServer, print_server_context: bool = False, *extra):
"""Print server config."""
print_formatted_text()
print_formatted_text(HTML("<u>Server Configs:</u>"))
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ include = ["pymodbus_repl"]

[tool.poetry.group.dev.dependencies]
pymodbus = {git = "https://github.com/pymodbus-dev/pymodbus", rev = "dev"}
ruff = "^0.2.1"
ruff = "^0.5.6"
coverage = "^7.4.1"
pytest-xdist = "^3.5.0"
pytest-cov = "^4.1.0"
twine = "^5.0.0"
mypy = "^1.11.1"
types-pygments = "^2.18.0.20240506"
types-tabulate = "^0.9.0.20240106"

[build-system]
requires = ["poetry-core"]
Expand Down
Loading