Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
106 changes: 106 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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!"
17 changes: 17 additions & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -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
}
11 changes: 11 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Production dependencies for abstra-json-sql

# Optional dependency for Pydantic model support
pydantic>=2.0.0
34 changes: 34 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -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"