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 ]; };