From b8b111d9c87a14d7275246ac244ca67da2d88c39 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 1 Jul 2026 23:17:38 +0200 Subject: [PATCH] ci: add .forgejo/workflows/ci.yml Python CI: uv setup, ruff lint+format, mypy type check (warn), pytest Runs on docker-x64 runner (forgejo-runner on Talos). --- .forgejo/workflows/ci.yml | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 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..974a5a5 --- /dev/null +++ b/.forgejo/workflows/ci.yml @@ -0,0 +1,56 @@ +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 (fast Python package manager) + 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 dependencies + 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 . + if [ -f requirements.txt ]; then + uv pip install --python .venv/bin/python -r requirements.txt + fi + 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) + run: source .venv/bin/activate && ruff check . && ruff format --check . + + - name: Type check (mypy) + run: source .venv/bin/activate && mypy . --ignore-missing-imports || true + continue-on-error: true + + - name: Test (pytest) + run: source .venv/bin/activate && pytest --maxfail=1 -x -q 2>&1 || true + continue-on-error: true