From 0b764d18ae288f8b14ed439cb80664e7702afe88 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 1 Jul 2026 23:17:58 +0200 Subject: [PATCH] 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. --- .forgejo/workflows/ci.yml | 57 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .forgejo/workflows/ci.yml diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml new file mode 100644 index 0000000..7b32e56 --- /dev/null +++ b/.forgejo/workflows/ci.yml @@ -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