Pre-commit and Github workflows were added.
This commit is contained in:
parent
8265c62fa9
commit
9e47d08275
2 changed files with 121 additions and 0 deletions
81
.github/workflows/ci.yml
vendored
Normal file
81
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint & typecheck
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v8
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: uv.lock
|
||||
|
||||
- name: Install Python
|
||||
run: uv python install
|
||||
|
||||
- name: Sync dev dependencies
|
||||
run: uv sync --group dev --frozen
|
||||
|
||||
- name: Ruff check
|
||||
run: uv run ruff check src tests
|
||||
|
||||
- name: Ruff format check
|
||||
run: uv run ruff format --check src tests
|
||||
|
||||
- name: Mypy
|
||||
run: uv run mypy src
|
||||
|
||||
test-unit:
|
||||
name: Unit tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v8
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: uv.lock
|
||||
|
||||
- name: Install Python
|
||||
run: uv python install
|
||||
|
||||
- name: Sync dev dependencies
|
||||
run: uv sync --group dev --frozen
|
||||
|
||||
- name: Run unit tests
|
||||
run: uv run pytest -m "not integration"
|
||||
|
||||
test-integration:
|
||||
name: Integration tests (testcontainers)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v8
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: uv.lock
|
||||
|
||||
- name: Install Python
|
||||
run: uv python install
|
||||
|
||||
- name: Sync dev dependencies
|
||||
run: uv sync --group dev --frozen
|
||||
|
||||
- name: Run integration tests
|
||||
run: uv run pytest -m integration
|
||||
40
.pre-commit-config.yaml
Normal file
40
.pre-commit-config.yaml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# Local hooks run through `uv run` so they use the pinned tool versions
|
||||
# from uv.lock (ruff/mypy in the `dev` group). Install with: uv run pre-commit install
|
||||
|
||||
minimum_pre_commit_version: "4.0.0"
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-toml
|
||||
- id: check-added-large-files
|
||||
- id: check-merge-conflict
|
||||
- id: mixed-line-ending
|
||||
args: [--fix=lf]
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: ruff-check
|
||||
name: ruff check (autofix)
|
||||
entry: uv run ruff check --fix --exit-non-zero-on-fix
|
||||
language: system
|
||||
types: [python]
|
||||
require_serial: true
|
||||
|
||||
- id: ruff-format
|
||||
name: ruff format
|
||||
entry: uv run ruff format
|
||||
language: system
|
||||
types: [python]
|
||||
require_serial: true
|
||||
|
||||
- id: mypy
|
||||
name: mypy (src)
|
||||
entry: uv run mypy src
|
||||
language: system
|
||||
types: [python]
|
||||
pass_filenames: false
|
||||
Loading…
Add table
Reference in a new issue