From fed7e17527789d228190ede61694f5a395782a8c Mon Sep 17 00:00:00 2001 From: Jens Tirsvad Nielsen Date: Thu, 8 Oct 2026 01:18:47 +0800 Subject: [PATCH] Add the CI workflow and make it run on this project Add .gitea/workflows/ci.yml: tests, ruff check, ruff format --check and mypy on every push and pull request, with Python 3.13 on ubuntu-latest. Two things in the first draft would have failed: - It installed the dev tools with `pip install -e ".[dev]"`, but the project declares them as a dependency group, not an extra. pip only warns and exits 0, so pytest, ruff and mypy were missing and the first step died with "No module named pytest". It now runs `pip install -e . --group dev`. - The 10 test cases that use Tk need a display, which a CI runner does not have. The workflow now installs xvfb and python3-tk and runs the tests with xvfb-run, so the display requirement accepted on RC-006 still holds. No test code changes. Checked locally: the YAML parses to the intended eight steps, the install line gives all three tools in a clean environment, and the test, lint, format and type commands pass as written. The Linux display steps have not run yet; they need a runner. --- .gitea/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..a2e2ca5 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + pull_request: + +jobs: + checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + - name: Install system packages + # The tests open a hidden Tk window, so the runner needs the Tk libraries + # and a virtual display (xvfb). sudo is used only where the image has it. + env: + DEBIAN_FRONTEND: noninteractive + run: | + SUDO=$(command -v sudo || true) + $SUDO apt-get update + $SUDO apt-get install -y xvfb python3-tk + - name: Install + # The dev tools are a dependency group in pyproject.toml, not an extra, + # so they need --group dev (pip 25.1 or newer). + run: | + python -m pip install --upgrade pip + python -m pip install -e . --group dev + - name: Tests + run: xvfb-run -a python -m pytest + - name: Lint + run: python -m ruff check src tests + - name: Format check + run: python -m ruff format --check src tests + - name: Types + run: python -m mypy src tests