diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..8730573 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,43 @@ +name: Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest ruff pyright + # Install project dependencies if requirements.txt exists + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + # Install project dependencies if pyproject.toml exists + if [ -f pyproject.toml ]; then pip install -e .; fi + + - name: Run ruff check + run: ruff check . + + - name: Run ruff format check + run: ruff format --check . + + - name: Run pyright + run: pyright + + - name: Run tests with pytest + run: pytest -v \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..aaf4c80 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,60 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "benchmark-saturation" +version = "0.1.0" +description = "Benchmark Saturation research project" +readme = "README.md" +requires-python = ">=3.9" +dependencies = [ + "matplotlib", + "numpy", +] + +[project.optional-dependencies] +dev = [ + "pytest", + "ruff", + "pyright", +] + +[tool.ruff] +line-length = 88 +target-version = "py39" + +[tool.ruff.lint] +select = [ + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # pyflakes + "I", # isort + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "UP", # pyupgrade +] +ignore = [ + "E501", # line too long, handled by black + "B008", # do not perform function calls in argument defaults + "C901", # too complex +] + +[tool.ruff.format] +quote-style = "double" +indent-style = "space" +skip-string-normalization = false + +[tool.pyright] +include = ["scripts", "tests"] +exclude = ["**/__pycache__", "build", "dist"] +reportMissingImports = true +reportMissingTypeStubs = false +pythonVersion = "3.9" + +[tool.pytest.ini_options] +testpaths = ["tests"] +python_files = ["test_*.py", "*_test.py"] +python_classes = ["Test*"] +python_functions = ["test_*"] +addopts = "-v --tb=short" \ No newline at end of file