Skip to content

Commit 6dd949e

Browse files
committed
ci: add CI/CD pipeline with auto versioning and release
- Add GitHub Actions CI workflow (ruff lint/format, mypy, pytest matrix 3.11/3.12/3.13) - Add release workflow with python-semantic-release for auto versioning - Add pyproject.toml with all tool config (ruff, mypy, pytest, coverage, semantic-release) - Add .gitignore for Python - Add CHANGELOG.md - Fix lint issues across codebase (formatting, raise-from, imports, Union syntax)
1 parent 51cdec7 commit 6dd949e

25 files changed

Lines changed: 1662 additions & 1275 deletions

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_call:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
lint:
15+
name: Lint & Format
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.13"
23+
24+
- name: Install dependencies
25+
run: pip install ruff
26+
27+
- name: Ruff check
28+
run: ruff check .
29+
30+
- name: Ruff format check
31+
run: ruff format --check .
32+
33+
type-check:
34+
name: Type Check
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- uses: actions/setup-python@v5
40+
with:
41+
python-version: "3.13"
42+
43+
- name: Install dependencies
44+
run: pip install mypy
45+
46+
- name: Mypy
47+
continue-on-error: true
48+
run: mypy minidb/
49+
50+
test:
51+
name: Test (Python ${{ matrix.python-version }})
52+
runs-on: ubuntu-latest
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
python-version: ["3.11", "3.12", "3.13"]
57+
steps:
58+
- uses: actions/checkout@v4
59+
60+
- uses: actions/setup-python@v5
61+
with:
62+
python-version: ${{ matrix.python-version }}
63+
64+
- name: Install dependencies
65+
run: pip install pytest pytest-cov
66+
67+
- name: Run tests with coverage
68+
run: pytest tests/ --cov=minidb --cov-report=term-missing --cov-report=xml
69+
70+
- name: Upload coverage
71+
if: matrix.python-version == '3.13'
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: coverage-report
75+
path: coverage.xml

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
id-token: write
10+
11+
jobs:
12+
ci:
13+
name: CI checks
14+
uses: ./.github/workflows/ci.yml
15+
16+
release:
17+
name: Semantic Release
18+
needs: ci
19+
runs-on: ubuntu-latest
20+
if: github.repository_owner == 'sebtardif'
21+
concurrency:
22+
group: release
23+
cancel-in-progress: false
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- uses: actions/setup-python@v5
32+
with:
33+
python-version: "3.13"
34+
35+
- name: Python Semantic Release
36+
id: release
37+
uses: python-semantic-release/python-semantic-release@v9
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Publish to GitHub Releases
42+
if: steps.release.outputs.released == 'true'
43+
uses: python-semantic-release/publish-action@v9
44+
with:
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Build package
48+
if: steps.release.outputs.released == 'true'
49+
run: pip install build && python -m build
50+
51+
- name: Publish to PyPI
52+
if: steps.release.outputs.released == 'true'
53+
uses: pypa/gh-action-pypi-publish@release/v1
54+
with:
55+
skip-existing: true

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*.egg-info/
5+
dist/
6+
build/
7+
*.egg
8+
9+
# Testing / Coverage
10+
.coverage
11+
coverage.xml
12+
htmlcov/
13+
.pytest_cache/
14+
15+
# IDE
16+
.vscode/
17+
.idea/
18+
19+
# OS
20+
.DS_Store
21+
Thumbs.db

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# CHANGELOG
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
This changelog is automatically generated by
6+
[python-semantic-release](https://python-semantic-release.readthedocs.io/).
7+
8+
<!--next-version-placeholder-->
9+
10+
## v1.0.0 (Initial Release)
11+
12+
### Features
13+
14+
- CREATE TABLE with typed columns (INTEGER, STRING, FLOAT, BOOLEAN)
15+
- INSERT, SELECT, UPDATE, DELETE operations
16+
- WHERE clause with AND/OR, comparisons, LIKE, IN
17+
- ORDER BY (ASC/DESC) and LIMIT
18+
- GROUP BY with aggregations (COUNT, SUM, AVG, MIN, MAX)
19+
- INNER JOIN between tables
20+
- Automatic hash-based indexing on primary keys
21+
- Query planner with index scan vs table scan
22+
- Persistence to JSON files with versioning

0 commit comments

Comments
 (0)