Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y libxkbcommon-dev libgtk-3-dev libwayland-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
- run: cargo test
- run: cargo build --release
- run: cargo test --workspace
- run: cargo build --workspace --release
- uses: actions/upload-artifact@v4
with:
name: openecraft-${{ matrix.os }}
path: |
target/release/openecraft
target/release/openecraft.exe
target/release/openecraft-server
target/release/openecraft-server.exe

web:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/target
/dist
/.idea/
# Local parts server databases
parts-db.json
*.tmp
25 changes: 21 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,32 @@ macOS and in the browser (WebAssembly).
Run these before considering a change done. All of them must pass without warnings.

```bash
cargo test
cargo clippy --all-targets
cargo clippy --target wasm32-unknown-unknown
cargo test --workspace
cargo clippy --workspace --all-targets
cargo clippy -p openecraft --target wasm32-unknown-unknown
```

- Desktop: `cargo run --release`
- Parts server: `cargo run -p openecraft-server -- --token <secret>` (http://127.0.0.1:8090)
- Web: `trunk serve` (dev server on http://127.0.0.1:8080), `trunk build --release`
- The web target needs `rustup target add wasm32-unknown-unknown` and `cargo install trunk --locked`.

## Workspace layout

| Crate | Path | Purpose |
| --- | --- | --- |
| `openecraft` | `.` (`src/`) | Editor (desktop + web) – the root package, built by trunk |
| `openecraft-parts` | `crates/openecraft-parts` | Shared library: part model, function templates, CSV/JSON, catalog, parts server API types |
| `openecraft-server` | `server/` | Standalone parts database server (axum, JSON file storage) |

- Code needed by more than one executable belongs in a library crate under `crates/`,
never duplicated. The library must stay free of UI and platform dependencies
(only `serde` / `serde_json`).
- API types and request paths of the parts server live in `openecraft_parts::api`; change
server and client together.
- New crates are added to `[workspace] members` in the root `Cargo.toml`; the
convention test reads that list, so its rules apply to every member.

## Unit tests – mandatory layout

**Unit tests never live inline in a module file.** Each module keeps its tests in a
Expand All @@ -30,7 +47,7 @@ src/geom.rs ← module code, ends with:
src/geom/tests.rs ← the tests, starting with `use super::*;`
```

Rules:
Rules (for every crate of the workspace):

1. No `#[test]` functions and no `mod tests { … }` blocks in module files.
2. The module file declares its tests exactly as `#[cfg(test)]` followed by `mod tests;`
Expand Down
Loading
Loading