diff --git a/.dockerignore b/.dockerignore
index 0480658..4e2878d 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -5,6 +5,9 @@ __pycache__
*.pyc
data
*.md
-Dockerfile
+# Dockerfile stays IN the context on purpose: tests/test_streamlit_config.py
+# reads it to check that the runtime stage copies .streamlit/, so the test
+# stage has to copy it in. No stage does `COPY . .`, so it only ever lands
+# where it is named explicitly - never in the runtime image.
docker-compose.yml
.dockerignore
\ No newline at end of file
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..8e218d0
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,65 @@
+# Runs the test suite on GitHub so its result is visible as a check on every
+# pull request. Two jobs on purpose:
+#
+# pytest - fast feedback on a plain runner (~1 min).
+# docker - the same suite inside the pinned python:3.13-slim image, which is
+# the deploy path. It is the only place that catches a broken
+# version pin from requirements.txt or a new source file missing
+# from the Dockerfile's explicit COPY list (see AGENTS.md).
+#
+# No apt step in the pytest job: none of the runtime wheels link against libGL
+# or libglib, the Dockerfile installs those only because python:3.13-slim ships
+# with almost nothing.
+name: Tests
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ workflow_dispatch:
+
+# A new push supersedes the previous run on the same ref; no point in paying
+# for CI on a commit nobody will look at any more.
+concurrency:
+ group: tests-${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+jobs:
+ pytest:
+ name: pytest (Python 3.13)
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ steps:
+ - uses: actions/checkout@v5
+
+ # Python 3.13 exactly: manifold3d and pymeshfix have no wheels for 3.14,
+ # and the requirements are pinned against 3.13.
+ - uses: actions/setup-python@v6
+ with:
+ python-version: "3.13"
+ cache: pip
+ cache-dependency-path: |
+ requirements.txt
+ requirements-dev.txt
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install -r requirements-dev.txt
+
+ - name: Run test suite
+ run: pytest
+
+ docker:
+ name: Docker test stage
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v5
+
+ # The test stage runs pytest during the build: a red test fails the build.
+ - name: Build test stage
+ run: docker build --target test .
diff --git a/AGENTS.md b/AGENTS.md
index 93ff3d5..85fb948 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -11,8 +11,8 @@ High-signal context for OpenCode sessions in this repo.
- **Python 3.13 strictly required.** `manifold3d` and `pymeshfix` have no wheels for 3.14 yet.
- Runtime deps live in `requirements.txt`, test-only deps in `requirements-dev.txt` (which includes the former via `-r`). `scikit-image` is a runtime dep despite never being imported directly: `trimesh` imports it lazily inside `matrix_to_marching_cubes`, so pip won't pull it in on its own. Don't "clean it up".
-- No linters or build system are configured. Do not invent them unless asked.
-- **The runtime image must ship `.streamlit/config.toml`.** The Dockerfile copies files individually (not `COPY . .`), and the pinned dark theme lives in that file. Without it the container falls back to the light theme while the custom CSS in `app.py` stays dark-tuned — sidebar labels then render unreadable. Any new file the app reads at runtime has to be added to the `runtime` stage explicitly.
+- No linters or build system are configured. Do not invent them unless asked. `pyrefly.toml` is checked in for local type checks (`pyrefly check`), but it is deliberately **not** part of CI — keep it that way unless asked.
+- **The runtime image must ship `.streamlit/config.toml`.** The Dockerfile copies files individually (not `COPY . .`), and the pinned dark theme lives in that file. Without it the container falls back to the light theme while the custom CSS in `app.py` stays dark-tuned — sidebar labels then render unreadable. Any new file the app reads at runtime has to be added to the `runtime` stage explicitly. **The same holds for the `test` stage:** it copies its files individually too, so a repo file the tests read has to be named there *and* must not be excluded by `.dockerignore` — which is why the `Dockerfile` deliberately stays in the build context (`tests/test_streamlit_config.py` reads it). Miss one and the tests pass locally but fail inside the image.
## Testing
@@ -21,6 +21,7 @@ High-signal context for OpenCode sessions in this repo.
- **After every code change, run the tests.** If the suite fails, fix the regression before considering the change done.
- **Extend the suite when you add or modify behavior.** New functions, new branches, new edge cases or bug fixes must come with matching tests. Keep test docstrings and comments in English per the language convention below.
- Shared fixtures (cube/sphere STL, fast config) live in `tests/conftest.py` — reuse them instead of regenerating geometry.
+- **CI is `.github/workflows/tests.yml`** (pull requests and pushes to `main`): one job runs `pytest` on a plain runner with Python 3.13, a second builds `docker build --target test .`. The Docker job is not redundant — it is what catches a version pin that no longer resolves on `python:3.13-slim` and a new source file missing from the Dockerfile's explicit `COPY` list. Its very first run proved the point: `.streamlit/` and the `Dockerfile` were missing from the `test` stage, so `docker build --target test .` had been failing four tests in `test_streamlit_config.py` while the same suite was green locally. Adding a source file therefore means touching the Dockerfile in the same change, or CI goes red. The pytest job deliberately installs no apt packages: no runtime wheel links against libGL or libglib (checked with `ldd`), the Dockerfile needs them only because the slim image ships with almost nothing.
## Language convention
diff --git a/Dockerfile b/Dockerfile
index ad14be2..ed2d782 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,15 +16,22 @@ COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
-# --- Teststage --------------------------------------------------------------
-# Laeuft die Suite waehrend des Builds; ein roter Test bricht den Build ab.
-# Nicht Teil von `runtime`, tests/ landen also nie im Deploy-Image.
+# --- Test stage -------------------------------------------------------------
+# Runs the suite during the build; a red test fails the build.
+# Not part of `runtime`, so tests/ never end up in the deploy image.
FROM base AS test
COPY requirements-dev.txt ./
RUN pip install --no-cache-dir -r requirements-dev.txt
COPY pytest.ini inlayer.py app.py app_helpers.py i18n.py ./
COPY tests/ ./tests/
+# tests/test_streamlit_config.py reads both of these: the config whose theme and
+# upload limit it pins down, and the Dockerfile itself to verify the runtime
+# stage's COPY line. Without them four tests fail inside the image only - which
+# is exactly the drift the containerised run is meant to catch.
+# `.dockerignore` keeps the Dockerfile in the context for this reason.
+COPY .streamlit/ ./.streamlit/
+COPY Dockerfile ./
RUN python -m pytest -q
diff --git a/README.md b/README.md
index c51965c..3a2d7e9 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@
upload STL → compute inlay → print
+
@@ -268,6 +269,19 @@ sphere fixtures. `tests/test_app_render.py` renders `app.py` through Streamlit's
`AppTest` in both languages, which is what makes the otherwise unimportable
frontend testable.
+### Continuous integration
+
+`.github/workflows/tests.yml` runs on every pull request and on every push to
+`main`, so the result shows up as a check on the pull request:
+
+| Job | What it does | Why |
+|---|---|---|
+| `pytest (Python 3.13)` | Installs `requirements-dev.txt` on a plain runner and runs the suite | Fast feedback (~1 min) |
+| `Docker test stage` | `docker build --target test .` | Runs the same suite inside the pinned `python:3.13-slim` image — the only place a broken version pin or a source file missing from the Dockerfile's `COPY` list shows up |
+
+Runs on the same branch supersede each other, so an outdated commit does not
+keep a runner busy.
+
---
## 🔧 Pipeline