ci(ebook-search): run tests via uv on the runner instead of docker
treefmt / nix fmt (pull_request) Successful in 5s
pytest / pytest (pull_request) Successful in 27s
build_systems / build-brain (pull_request) Successful in 44s
build_systems / build-bob (pull_request) Successful in 47s
build_systems / build-rhapsody-in-green (pull_request) Successful in 56s
build_systems / build-jeeves (pull_request) Successful in 2m54s
test ebook search / test-ebook-search (pull_request) Failing after 19s
treefmt / nix fmt (pull_request) Successful in 5s
pytest / pytest (pull_request) Successful in 27s
build_systems / build-brain (pull_request) Successful in 44s
build_systems / build-bob (pull_request) Successful in 47s
build_systems / build-rhapsody-in-green (pull_request) Successful in 56s
build_systems / build-jeeves (pull_request) Successful in 2m54s
test ebook search / test-ebook-search (pull_request) Failing after 19s
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
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
.pytest_cache
|
.pytest_cache
|
||||||
.ruff_cache
|
.ruff_cache
|
||||||
.venv
|
.venv
|
||||||
|
**/.venv
|
||||||
.env
|
.env
|
||||||
.cache
|
.cache
|
||||||
.claude
|
.claude
|
||||||
|
|||||||
@@ -9,13 +9,16 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
env:
|
||||||
|
UV_PYTHON_DOWNLOADS: never
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-ebook-search:
|
test-ebook-search:
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build test image
|
- name: Install dependencies
|
||||||
run: docker build --file python/ebook_search/docker/Dockerfile --target test --tag ebook-search:test .
|
run: uv sync --locked --project python/ebook_search/docker
|
||||||
- name: Run ebook search tests
|
- 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"
|
||||||
|
|||||||
@@ -46,22 +46,28 @@ cd python/ebook_search/docker && uv lock
|
|||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
The main pytest suite excludes `tests/ebook_search` (its dependencies are no longer
|
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
|
```sh
|
||||||
python -m python.ebook_search.docker.containers test
|
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
|
```sh
|
||||||
docker build --file python/ebook_search/docker/Dockerfile --target test --tag ebook-search:test .
|
docker build --file python/ebook_search/docker/Dockerfile --target test --tag ebook-search:test .
|
||||||
docker run --rm 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
|
## Configuration
|
||||||
|
|
||||||
The compose service loads the repo root `.env` into the container via `env_file`.
|
The compose service loads the repo root `.env` into the container via `env_file`.
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ in
|
|||||||
nixos-rebuild
|
nixos-rebuild
|
||||||
nodejs
|
nodejs
|
||||||
treefmt
|
treefmt
|
||||||
|
uv
|
||||||
wget
|
wget
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user