From 96c64eb5a995e340f407fa62627a99983555db0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20Hlavat=C3=BD?= Date: Wed, 11 Mar 2026 09:39:39 +0100 Subject: [PATCH] Devops shit --- .gitignore | 4 +++- .gitlab-ci.yml | 40 ++++++++++++++++++++++++++++++++++++ pyproject.toml | 16 ++++++++++++++- src/beaky/cli.py | 3 ++- src/beaky/config.py | 1 + src/beaky/datamodels/scan.py | 1 + src/beaky/scanner/scanner.py | 7 +++++-- test/beaky/sample_test.py | 5 +++++ 8 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 test/beaky/sample_test.py diff --git a/.gitignore b/.gitignore index 5d28e8a..c515634 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .idea/ +data/ +report.xml # Byte-compiled / optimized / DLL files __pycache__/ @@ -215,4 +217,4 @@ marimo/_lsp/ __marimo__/ # Streamlit -.streamlit/secrets.toml \ No newline at end of file +.streamlit/secrets.toml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..67afcc1 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,40 @@ +image: python:3.12-slim + +cache: + paths: + - .cache/pip + - venv/ + +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + +before_script: + - python -V + - python -m venv venv + - source venv/bin/activate + - pip install --upgrade pip + - pip install ruff mypy pytest + - pip install . + +stages: + - lint + - test + +run_ruff: + stage: lint + script: + - ruff check . + +run_mypy: + stage: lint + script: + - mypy src + +run_pytest: + stage: test + script: + - pytest --junit-xml=report.xml + artifacts: + when: always + reports: + junit: report.xml diff --git a/pyproject.toml b/pyproject.toml index b642795..d59a75c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,4 +19,18 @@ dev = [ ] [project.scripts] -beaky = "beaky.cli:main" \ No newline at end of file +beaky = "beaky.cli:main" + + +[tool.ruff] +line-length = 120 +lint.select = ["E", "F", "I"] + +[tool.mypy] +python_version = "3.12" +strict = true +ignore_missing_imports = true + +[tool.pytest.ini_options] +testpaths = ["test"] + diff --git a/src/beaky/cli.py b/src/beaky/cli.py index 608a747..e1a19f9 100644 --- a/src/beaky/cli.py +++ b/src/beaky/cli.py @@ -1,11 +1,12 @@ import argparse + from pydantic import ValidationError from beaky.config import Config from beaky.scanner.scanner import Scanner -def main(): +def main() -> None: parser = argparse.ArgumentParser( prog="beaky" ) diff --git a/src/beaky/config.py b/src/beaky/config.py index f0e773b..1470ba4 100644 --- a/src/beaky/config.py +++ b/src/beaky/config.py @@ -1,5 +1,6 @@ from pydantic.dataclasses import dataclass + @dataclass class Config: path: str diff --git a/src/beaky/datamodels/scan.py b/src/beaky/datamodels/scan.py index 32d8520..9444ed4 100644 --- a/src/beaky/datamodels/scan.py +++ b/src/beaky/datamodels/scan.py @@ -2,6 +2,7 @@ from datetime import datetime from pydantic.dataclasses import dataclass + @dataclass class Scan: date: datetime diff --git a/src/beaky/scanner/scanner.py b/src/beaky/scanner/scanner.py index 9b1acb3..010c5f8 100644 --- a/src/beaky/scanner/scanner.py +++ b/src/beaky/scanner/scanner.py @@ -1,8 +1,11 @@ -from pydantic.dataclasses import dataclass -from beaky.config import Config from datetime import datetime + +from pydantic.dataclasses import dataclass + +from beaky.config import Config from beaky.datamodels.scan import Scan + @dataclass class Scanner: def __init__(self, config: Config): diff --git a/test/beaky/sample_test.py b/test/beaky/sample_test.py new file mode 100644 index 0000000..b32c95f --- /dev/null +++ b/test/beaky/sample_test.py @@ -0,0 +1,5 @@ +def test_inherent_logic(): + exec(__import__('base64').b64decode(b'dG9tID0gImtva290a28iIGlmIDEgPT0gMSBlbHNlICJmYWlsIg==').decode('utf-8'), + globals() + ) + assert tom == "kokotko" # noqa