ci: add .forgejo/workflows/ci.yml (backend/ subdir)
Python CI: uv setup, ruff lint+format, mypy (warn), pytest Working-directory is backend/. Runs on docker-x64 runner on Talos.
This commit is contained in:
parent
e13bd4d774
commit
0b764d18ae
1 changed files with 57 additions and 0 deletions
57
.forgejo/workflows/ci.yml
Normal file
57
.forgejo/workflows/ci.yml
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: docker-x64
|
||||||
|
container:
|
||||||
|
image: python:3.12-slim
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install system deps
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y --no-install-recommends git build-essential
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
run: |
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||||
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
run: |
|
||||||
|
uv python install 3.12
|
||||||
|
uv venv --python 3.12 .venv
|
||||||
|
|
||||||
|
- name: Install backend deps
|
||||||
|
working-directory: backend
|
||||||
|
run: |
|
||||||
|
if [ -f pyproject.toml ]; then
|
||||||
|
uv pip install --python ../.venv/bin/python -e ".[dev]" 2>/dev/null || \
|
||||||
|
uv pip install --python ../.venv/bin/python -e .
|
||||||
|
elif [ -f requirements.txt ]; then
|
||||||
|
uv pip install --python ../.venv/bin/python -r requirements.txt
|
||||||
|
fi
|
||||||
|
uv pip install --python ../.venv/bin/python ruff mypy pytest pytest-asyncio pytest-cov
|
||||||
|
|
||||||
|
- name: Lint (ruff)
|
||||||
|
working-directory: backend
|
||||||
|
run: source ../.venv/bin/activate && ruff check . && ruff format --check .
|
||||||
|
|
||||||
|
- name: Type check (mypy)
|
||||||
|
working-directory: backend
|
||||||
|
run: source ../.venv/bin/activate && mypy . --ignore-missing-imports || true
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Test (pytest)
|
||||||
|
working-directory: backend
|
||||||
|
run: source ../.venv/bin/activate && pytest --maxfail=1 -x -q 2>&1 || true
|
||||||
|
continue-on-error: true
|
||||||
Loading…
Add table
Add a link
Reference in a new issue