seting up contaner for ebook search #40

Merged
Richie merged 7 commits from feature/seting-up-contaner-for-ebook-search into main 2026-07-12 17:47:16 -04:00
4 changed files with 19 additions and 8 deletions
Showing only changes of commit 4799054601 - Show all commits
+1
View File
@@ -4,6 +4,7 @@
.pytest_cache .pytest_cache
.ruff_cache .ruff_cache
.venv .venv
**/.venv
.env .env
.cache .cache
.claude .claude
+6 -3
View File
@@ -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"
+11 -5
View File
@@ -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`.
+1
View File
@@ -138,6 +138,7 @@ in
nixos-rebuild nixos-rebuild
nodejs nodejs
treefmt treefmt
uv
wget wget
]; ];
}; };