Skip to content
Open
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
16 changes: 14 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
**/target
**/target_ci
**/target/
/target_ci/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should still be **/target_ci I think?


# Ignore lock files, except where we don't.
# - examples: ignore, they are just samples
# - tests: keep. This provides a common ground of dependencies for CI, for example, without providing too much hassle
# for co-developers.
#
# Note: 'host/' carries both a library and tests. We have the Cargo.lock and expect it *not to be used* by dependencies
# (this should be confirmed).
Cargo.lock
!/examples/tests/Cargo.lock
!/host/Cargo.lock

/tests/
.idea
40 changes: 40 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## 📦 Cargo.lock Policy

This repository contains a mix of libraries, examples, and test binaries. To ensure clarity and reproducibility, we follow a nuanced approach to `Cargo.lock` inclusion:

### ✅ What we commit
We include `Cargo.lock` files **only** for test binaries that are executed in CI:

- [`examples/tests/Cargo.lock`](examples/tests/Cargo.lock)
- [`host/Cargo.lock`](host/Cargo.lock) — used by `host/tests`

These lockfiles ensure reproducible CI runs and provide a stable dependency baseline for contributors running tests locally.

### ❌ What we ignore
We do **not** commit `Cargo.lock` for:

- The root crate (which is a library)
- Example applications (which are not CI-tested and often target MCU hardware)

This aligns with [Cargo's official guidance](https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html), which recommends:

> *“Cargo.lock is not used for libraries to avoid locking dependencies for downstream users.”*
### 🧠 Why this matters
- **Libraries** should remain flexible for downstream consumers.
- **Examples** are illustrative and not CI-tested; locking them would add unnecessary maintenance burden.
- **Test binaries** benefit from locked dependencies to ensure consistent CI behavior and easier debugging.

### 🛠 `.gitignore` setup
Our root `.gitignore` reflects this policy:

```gitignore
# Ignore lock files, except where we don't.
Cargo.lock
!/examples/tests/Cargo.lock
!/host/Cargo.lock
```

<!--
Text from Copilot discussion, 16-Oct-25
-->
Loading
Loading