diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5d4f1e8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,106 @@ +name: CI + +on: + pull_request: + branches: [main] + push: + branches: [main] + +jobs: + test: + name: Tests + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r requirements-dev.txt + + - name: Run tests with pytest + run: | + pytest --cov=abstra_json_sql --cov-report=xml --cov-report=term -v + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + if: matrix.python-version == '3.12' + with: + file: ./coverage.xml + flags: unittests + name: codecov-umbrella + fail_ci_if_error: false + + lint: + name: Lint (Ruff) + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: 'pip' + + - name: Install ruff + run: | + python -m pip install --upgrade pip + pip install ruff + + - name: Run ruff check + run: ruff check . + + - name: Run ruff format check + run: ruff format --check . + + typecheck: + name: Type Check (Pyright) + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pyright + + - name: Run pyright + run: pyright abstra_json_sql + + all-checks-passed: + name: All Checks Passed + runs-on: ubuntu-latest + needs: [test, lint, typecheck] + if: always() + + steps: + - name: Check all jobs + run: | + if [ "${{ needs.test.result }}" != "success" ] || \ + [ "${{ needs.lint.result }}" != "success" ] || \ + [ "${{ needs.typecheck.result }}" != "success" ]; then + echo "One or more checks failed" + exit 1 + fi + echo "All checks passed successfully!" diff --git a/pyrightconfig.json b/pyrightconfig.json new file mode 100644 index 0000000..cff2041 --- /dev/null +++ b/pyrightconfig.json @@ -0,0 +1,17 @@ +{ + "include": [ + "abstra_json_sql" + ], + "exclude": [ + "**/__pycache__", + "**/build", + "**/dist", + "**/*_test.py" + ], + "pythonVersion": "3.9", + "pythonPlatform": "All", + "typeCheckingMode": "off", + "reportMissingImports": true, + "reportMissingTypeStubs": false, + "reportSyntaxError": true +} diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..1c52b44 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,11 @@ +# Development dependencies for abstra-json-sql + +# Testing +pytest>=7.4.0 +pytest-cov>=4.1.0 + +# Linting and formatting +ruff>=0.1.0 + +# Type checking +pyright>=1.1.0 diff --git a/requirements.txt b/requirements.txt index e69de29..ba8d98f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1,4 @@ +# Production dependencies for abstra-json-sql + +# Optional dependency for Pydantic model support +pydantic>=2.0.0 diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..d26eb04 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,34 @@ +# Ruff configuration for abstra-json-sql + +# Exclude common directories +exclude = [ + ".git", + ".pytest_cache", + ".ruff_cache", + "__pycache__", + "build", + "dist", + "*.egg-info", +] + +# Target Python 3.9+ +target-version = "py39" + +# Line length +line-length = 88 + +[lint] +# Enable pycodestyle (E, W), pyflakes (F), and isort (I) +select = ["E", "F", "W", "I"] + +# Ignore specific rules +ignore = [ + "E501", # Line too long (handled by formatter) +] + +[format] +# Use double quotes for strings +quote-style = "double" + +# Indent with spaces +indent-style = "space"