Skip to content

Commit b6a6b5a

Browse files
authored
Merge pull request #2 from abstra-app/ci/add-github-actions-checks
Add CI/CD pipeline with pytest, ruff, and pyright
2 parents 8a78a91 + b927b3d commit b6a6b5a

File tree

5 files changed

+172
-0
lines changed

5 files changed

+172
-0
lines changed

.github/workflows/ci.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Tests
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.9", "3.10", "3.11", "3.12"]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
cache: 'pip'
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -r requirements.txt
30+
pip install -r requirements-dev.txt
31+
32+
- name: Run tests with pytest
33+
run: |
34+
pytest --cov=abstra_json_sql --cov-report=xml --cov-report=term -v
35+
36+
- name: Upload coverage to Codecov
37+
uses: codecov/codecov-action@v4
38+
if: matrix.python-version == '3.12'
39+
with:
40+
file: ./coverage.xml
41+
flags: unittests
42+
name: codecov-umbrella
43+
fail_ci_if_error: false
44+
45+
lint:
46+
name: Lint (Ruff)
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- name: Set up Python
53+
uses: actions/setup-python@v5
54+
with:
55+
python-version: "3.12"
56+
cache: 'pip'
57+
58+
- name: Install ruff
59+
run: |
60+
python -m pip install --upgrade pip
61+
pip install ruff
62+
63+
- name: Run ruff check
64+
run: ruff check .
65+
66+
- name: Run ruff format check
67+
run: ruff format --check .
68+
69+
typecheck:
70+
name: Type Check (Pyright)
71+
runs-on: ubuntu-latest
72+
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: Set up Python
77+
uses: actions/setup-python@v5
78+
with:
79+
python-version: "3.12"
80+
cache: 'pip'
81+
82+
- name: Install dependencies
83+
run: |
84+
python -m pip install --upgrade pip
85+
pip install -r requirements.txt
86+
pip install pyright
87+
88+
- name: Run pyright
89+
run: pyright abstra_json_sql
90+
91+
all-checks-passed:
92+
name: All Checks Passed
93+
runs-on: ubuntu-latest
94+
needs: [test, lint, typecheck]
95+
if: always()
96+
97+
steps:
98+
- name: Check all jobs
99+
run: |
100+
if [ "${{ needs.test.result }}" != "success" ] || \
101+
[ "${{ needs.lint.result }}" != "success" ] || \
102+
[ "${{ needs.typecheck.result }}" != "success" ]; then
103+
echo "One or more checks failed"
104+
exit 1
105+
fi
106+
echo "All checks passed successfully!"

pyrightconfig.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"include": [
3+
"abstra_json_sql"
4+
],
5+
"exclude": [
6+
"**/__pycache__",
7+
"**/build",
8+
"**/dist",
9+
"**/*_test.py"
10+
],
11+
"pythonVersion": "3.9",
12+
"pythonPlatform": "All",
13+
"typeCheckingMode": "off",
14+
"reportMissingImports": true,
15+
"reportMissingTypeStubs": false,
16+
"reportSyntaxError": true
17+
}

requirements-dev.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Development dependencies for abstra-json-sql
2+
3+
# Testing
4+
pytest>=7.4.0
5+
pytest-cov>=4.1.0
6+
7+
# Linting and formatting
8+
ruff>=0.1.0
9+
10+
# Type checking
11+
pyright>=1.1.0

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Production dependencies for abstra-json-sql
2+
3+
# Optional dependency for Pydantic model support
4+
pydantic>=2.0.0

ruff.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Ruff configuration for abstra-json-sql
2+
3+
# Exclude common directories
4+
exclude = [
5+
".git",
6+
".pytest_cache",
7+
".ruff_cache",
8+
"__pycache__",
9+
"build",
10+
"dist",
11+
"*.egg-info",
12+
]
13+
14+
# Target Python 3.9+
15+
target-version = "py39"
16+
17+
# Line length
18+
line-length = 88
19+
20+
[lint]
21+
# Enable pycodestyle (E, W), pyflakes (F), and isort (I)
22+
select = ["E", "F", "W", "I"]
23+
24+
# Ignore specific rules
25+
ignore = [
26+
"E501", # Line too long (handled by formatter)
27+
]
28+
29+
[format]
30+
# Use double quotes for strings
31+
quote-style = "double"
32+
33+
# Indent with spaces
34+
indent-style = "space"

0 commit comments

Comments
 (0)