From f9ccaace896b8f71e4895d8d165f6a5c1bbf3b84 Mon Sep 17 00:00:00 2001 From: Torben Nehmer Date: Tue, 1 Dec 2026 22:47:27 +0100 Subject: [PATCH] Add Gitea Actions CI for pull requests Run lint, format, pyright, pytest and pre-commit on every PR to main. uv is installed from a hash-pinned requirements file, not by name. Co-Authored-By: Claude Opus 5.5 --- .gitea/ci/uv-requirements.in | 1 + .gitea/ci/uv-requirements.txt | 23 ++++++++++++++ .gitea/workflows/ci.yml | 60 +++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 .gitea/ci/uv-requirements.in create mode 100644 .gitea/ci/uv-requirements.txt create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/ci/uv-requirements.in b/.gitea/ci/uv-requirements.in new file mode 100644 index 0000000..03c3418 --- /dev/null +++ b/.gitea/ci/uv-requirements.in @@ -0,0 +1 @@ +uv==0.13.7 diff --git a/.gitea/ci/uv-requirements.txt b/.gitea/ci/uv-requirements.txt new file mode 100644 index 0000000..3812e87 --- /dev/null +++ b/.gitea/ci/uv-requirements.txt @@ -0,0 +1,23 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile .gitea/ci/uv-requirements.in --generate-hashes --python-version 3.14 -o .gitea/ci/uv-requirements.txt +uv==0.13.7 \ + --hash=sha256:08f16fd463926786b702b497473511deae4b3e17a2fa6d22180950d6059a120d \ + --hash=sha256:158953b8669bee6f4bc2babdd997e34ff9f0d57170093cfe907f64448292b7c3 \ + --hash=sha256:1bc8543d930464bbb22ac01bb1a660a448235e558014914de1e1cd5b993361b8 \ + --hash=sha256:2835e2ab397d0db86323b9975dce75ecd76aa9cfa0d6a2aea84734aae7f8c9b3 \ + --hash=sha256:2c9bdc4a872b60a93c5f26c0791089ea11585a4f9d3b3c017d78eb8487505e25 \ + --hash=sha256:55e741a380a98008fc4985cf069855f36bc50242ef438e21a466786f5bc84da8 \ + --hash=sha256:57ff66891d9a738ec087c23fdde842ac8e5eb63189ffed6ee95caee1b82ceb54 \ + --hash=sha256:5e766791cb825d7a07e2ef9e622d307b48754fb682a31ba7bc5f272fab9ea395 \ + --hash=sha256:5f37cc4d4660e4aee8a24d0dc179a0b0ce99506259c6796d37fa69bca9543a03 \ + --hash=sha256:89df450624dec8c48b8b5a7adb654928cc50e95753f869c70cd65ef8333f2197 \ + --hash=sha256:8b8ac028ae4ebb2a3f9d04907c61794f2cf8d7a7002bfbb4019a3dee28351fb2 \ + --hash=sha256:8fc6019740794df995085f7b278d99dc11ccacffad9c63957278d3a6e272280b \ + --hash=sha256:917733990ebc178318af0321d6873823ed5da707e1c4b1e5060ac2065a81f1f3 \ + --hash=sha256:94f65a8ac5826dff76a93cb3cafbaad15def1788c63da2ce5ce09e0bd1303e7a \ + --hash=sha256:952dcae9b1a7742f2fab28e82391fbfabe8807e4e9363f674b0f6be1053b8dd4 \ + --hash=sha256:a90f5d95716ab83091f0f73a8e7ec64e557abf2a28537fcd719b2ac88e6f725a \ + --hash=sha256:d30cafb7070901ba35353ec64cf228ae46caf79ac0f6fae329f95468b1482531 \ + --hash=sha256:f91a229093163eefca89ea1b220a221d64c3beade05d03519a6584d1797a5a5f \ + --hash=sha256:fd04bf01ba5f2829f4f94ca8f0c24a743f21e73d75045613ed6fc2fd66fc7bda + # via -r .gitea/ci/uv-requirements.in diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..3be9111 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,60 @@ +# Checks every pull request against main: locked environment, ruff lint and +# format, pyright (strict), pytest and the pre-commit hooks. +# +# Triggered only by `pull_request`: no `push` (branches are checked once, in +# their PR) and never `pull_request_target`, which would run with repository +# secrets on code from the PR. +# +# The container image is named explicitly so the Python version does not +# depend on the runner's defaults. uv is installed from a hashed requirements +# file (.gitea/ci/uv-requirements.txt) so that nothing is installed by name +# only; all project tools then come from uv.lock. +name: CI + +on: + pull_request: + branches: [main] + +jobs: + checks: + runs-on: linux-docker + container: + image: python:3.14-slim-trixie + env: + UV_PYTHON_DOWNLOADS: never + UV_LINK_MODE: copy + PIP_DISABLE_PIP_VERSION_CHECK: "1" + steps: + # nodejs must come before checkout: act_runner runs the JavaScript + # action actions/checkout with node inside the job container. + # pyright needs node as well. + - name: System dependencies + run: | + apt-get update -qq + apt-get install -y --no-install-recommends nodejs git ca-certificates + rm -rf /var/lib/apt/lists/* + + - uses: actions/checkout@v7 + + - name: Install uv + run: pip install --root-user-action=ignore --require-hashes -r .gitea/ci/uv-requirements.txt + + - name: Sync locked environment + run: uv sync --locked + + - name: Ruff lint + run: uv run ruff check + + - name: Ruff format + run: uv run ruff format --check + + - name: Pyright + run: uv run pyright + + - name: Pytest + run: uv run pytest + + - name: Pre-commit hooks + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + uv run pre-commit run --all-files --show-diff-on-failure