ci: add workflow for lint, type check and tests

This commit is contained in:
Abolfazl Ranjbaran committed 2026-11-13 07:19:15 +00:00
1 parent bf9f424200
commit 69b62b9f0b
3 files changed
+71

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install backend and bot packages
run: |
python -m pip install --upgrade pip
pip install -e "backend[dev]" -e "bot[dev]"
- name: Lint (ruff)
run: ruff check backend bot
- name: Type check (mypy)
run: mypy --config-file backend/pyproject.toml backend/sokhan
- name: Tests
env:
CELERY_ENABLED: "false"
DATA_DIR: /tmp/sokhan-ci-data
run: pytest -m "not gpu_optional"
web:
runs-on: ubuntu-latest
if: ${{ hashFiles('web/package.json') != '' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: web
- name: Build
run: npm run build
working-directory: web
compose:
runs-on: ubuntu-latest
if: ${{ hashFiles('deploy/docker-compose.yml') != '' }}
steps:
- uses: actions/checkout@v4
- name: Validate compose file
run: docker compose -f deploy/docker-compose.yml config -q
+6
View File
@@ -0,0 +1,6 @@
[pytest]
testpaths = backend/tests bot/tests
markers =
gpu_optional: requires the real Whisper model and network access; skipped in CI
filterwarnings =
ignore::DeprecationWarning
+11
View File
@@ -0,0 +1,11 @@
line-length = 100
target-version = "py311"
[lint]
select = ["E", "F", "I", "W", "UP", "B"]
ignore = ["B008"]
[lint.per-file-ignores]
"backend/tests/*" = ["E501"]
"backend/alembic/versions/*" = ["E501"]
"bot/tests/*" = ["E501"]