You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -18,9 +19,22 @@ For Python backends, you'll typically need:
18
19
-`run.sh` - Runtime script
19
20
-`test.py` / `test.sh` - Test files
20
21
22
+
For Rust backends, you'll typically need (see `backend/rust/kokoros/` as a reference):
23
+
-`Cargo.toml` - Crate manifest; depend on the upstream project as a submodule under `sources/`
24
+
-`build.rs` - Invokes `tonic_build` to generate gRPC stubs from `backend/backend.proto` (use the `BACKEND_PROTO_PATH` env var so the Makefile can inject the canonical copy)
25
+
-`src/` - The gRPC server implementation (implement `Backend` via `tonic`)
26
+
-`Makefile` - Copies `backend.proto` into the crate, runs `cargo build --release`, then `package.sh`
27
+
-`package.sh` - Uses `ldd` to bundle the binary's dynamic deps and `ld.so` into `package/lib/`
28
+
-`run.sh` - Sets `LD_LIBRARY_PATH`/`SSL_CERT_DIR` and execs the binary via the bundled `lib/ld.so`
29
+
-`sources/<UpstreamProject>/` - Git submodule with the upstream Rust crate
30
+
21
31
## 2. Add Build Configurations to `.github/workflows/backend.yml`
22
32
23
-
Add build matrix entries for each platform/GPU type you want to support. Look at similar backends (e.g., `chatterbox`, `faster-whisper`) for reference.
33
+
Add build matrix entries for each platform/GPU type you want to support. Look at similar backends for reference — `chatterbox`/`faster-whisper` for Python, `piper`/`silero-vad` for Go, `kokoros` for Rust.
34
+
35
+
**Without an entry here no image is ever built or pushed, and the gallery entry in `backend/index.yaml` will point at a tag that does not exist.** The `dockerfile:` field must point at `./backend/Dockerfile.<lang>` matching the language bucket from step 1 (e.g. `Dockerfile.python`, `Dockerfile.golang`, `Dockerfile.rust`). The `tag-suffix` must match the `uri:` in the corresponding `backend/index.yaml` image entry exactly.
36
+
37
+
If you add a new language bucket, `scripts/changed-backends.js` also needs a branch in `inferBackendPath` so PR change-detection routes file edits correctly.
24
38
25
39
**Placement in file:**
26
40
- CPU builds: Add after other CPU builds (e.g., after `cpu-chatterbox`)
@@ -56,24 +70,28 @@ Add `backends/<backend-name>` to the `.NOTPARALLEL` line (around line 2) to prev
For Rust backends the target is usually the crate build target itself (e.g. `$(MAKE) -C backend/rust/<backend-name> <backend-name>-grpc`) so the binary is in place before `test` runs.
Each backend's own `Makefile` should define a `test` target so this line works regardless of language. Integration tests that need large model downloads should be gated behind an env var (see `backend/rust/kokoros/`'s `KOKOROS_MODEL_PATH` pattern) so CI only runs unit tests.
Use `github.com/mudler/xlog` for logging which has the same API as slog.
44
44
45
+
## Go tests
46
+
47
+
All Go tests — including backend tests — must use [Ginkgo](https://onsi.github.io/ginkgo/) (v2) with Gomega matchers, not the stdlib `testing` package with `t.Run` / `t.Errorf`. A test file should register a suite with `RegisterFailHandler(Fail)` in a `TestXxx(t *testing.T)` bootstrap and use `Describe`/`Context`/`It` blocks for the actual cases. Look at any existing `*_test.go` under `core/` or `pkg/` for a template.
48
+
49
+
Do not mix styles within a package. If you are extending tests in a package that already uses Ginkgo, keep using Ginkgo. If you find stdlib-style Go tests in the tree, treat them as tech debt to be migrated rather than as a pattern to follow.
50
+
45
51
## Documentation
46
52
47
53
The project documentation is located in `docs/content`. When adding new features or changing existing functionality, it is crucial to update the documentation to reflect these changes. This helps users understand how to use the new capabilities and ensures the documentation stays relevant.
0 commit comments