From 4799054601bdf1566141a6a1b6c55719d150af3e Mon Sep 17 00:00:00 2001 From: Richie Cahill Date: Sun, 12 Jul 2026 16:40:56 -0400 Subject: [PATCH] ci(ebook-search): run tests via uv on the runner instead of docker The gitea runner containers have no docker access, so build the test env with uv from the existing lockfile and run pytest directly: - test_ebook_search workflow: uv sync --locked + uv run pytest, with UV_PYTHON_DOWNLOADS=never so uv uses the nix-provided python 3.14 - add uv to the runner hostPackages (needs a jeeves rebuild to apply) - ignore nested **/.venv in .dockerignore (uv sync creates one in python/ebook_search/docker) - document the uv test commands in the docker README; the docker test image remains for validating the image itself --- .dockerignore | 1 + .github/workflows/test_ebook_search.yml | 9 ++++++--- python/ebook_search/docker/README.md | 16 +++++++++++----- systems/jeeves/runners/nix_builder.nix | 1 + 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.dockerignore b/.dockerignore index 3578a3a..a45d9ec 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,7 @@ .pytest_cache .ruff_cache .venv +**/.venv .env .cache .claude diff --git a/.github/workflows/test_ebook_search.yml b/.github/workflows/test_ebook_search.yml index 5dc296b..0e43e3e 100644 --- a/.github/workflows/test_ebook_search.yml +++ b/.github/workflows/test_ebook_search.yml @@ -9,13 +9,16 @@ on: branches: - main +env: + UV_PYTHON_DOWNLOADS: never + jobs: test-ebook-search: runs-on: self-hosted steps: - uses: actions/checkout@v4 - - name: Build test image - run: docker build --file python/ebook_search/docker/Dockerfile --target test --tag ebook-search:test . + - name: Install dependencies + run: uv sync --locked --project python/ebook_search/docker - name: Run ebook search tests - run: docker run --rm ebook-search:test + run: uv run --project python/ebook_search/docker --no-sync pytest tests/ebook_search --override-ini addopts="-n auto -ra" diff --git a/python/ebook_search/docker/README.md b/python/ebook_search/docker/README.md index 97c2ccf..3606863 100644 --- a/python/ebook_search/docker/README.md +++ b/python/ebook_search/docker/README.md @@ -46,22 +46,28 @@ cd python/ebook_search/docker && uv lock ## Tests The main pytest suite excludes `tests/ebook_search` (its dependencies are no longer -in the nix dev shell). The ebook tests run inside the Docker `test` image instead: +in the nix dev shell). The `test ebook search` CI workflow runs them in a uv env +built from the lockfile in this directory — same commands work locally from the +repo root (the `--override-ini` drops the main suite's ignore): + +```sh +uv sync --locked --project python/ebook_search/docker +uv run --project python/ebook_search/docker --no-sync pytest tests/ebook_search --override-ini addopts="-n auto -ra" +``` + +They can also run inside the Docker `test` image, which validates the image itself: ```sh python -m python.ebook_search.docker.containers test ``` -or the raw docker equivalent (what the `test ebook search` CI workflow runs): +or the raw docker equivalent: ```sh docker build --file python/ebook_search/docker/Dockerfile --target test --tag ebook-search:test . docker run --rm ebook-search:test ``` -To run them on the host instead, use a venv with the ebook deps installed and -override the ignore: `pytest tests/ebook_search -o addopts="-ra"`. - ## Configuration The compose service loads the repo root `.env` into the container via `env_file`. diff --git a/systems/jeeves/runners/nix_builder.nix b/systems/jeeves/runners/nix_builder.nix index 0d1785a..a5e47b7 100644 --- a/systems/jeeves/runners/nix_builder.nix +++ b/systems/jeeves/runners/nix_builder.nix @@ -138,6 +138,7 @@ in nixos-rebuild nodejs treefmt + uv wget ]; };