- Install Rust using rustup
- Copy the pre-commit hook in the hooks folder to .git/hooks/pre-commit
- Install docker, making sure your user has access to use it.
cp hooks/* .git/hooks/- For test coverage:
cargo install cargo-tarpaulin - For smart release:
cargo install cargo-smart-release - For workspaces:
cargo install cargo-workspaces
- We use rustfmt (triggered from cargo fmt) to format our source code
- We try to keep to conventional-commits - This simplifies creating and keeping a changelog up to date as well as helping to decide which version to bump when releasing a new version
- We will adhere to Semantic versioning
- We use Clippy to ensure that our code follows a consistent format, you can run Clippy using
cargo clippy --fixonce it's installed - We try to stick to one feature per crate. The workspace is configured to automatically pick up any new crates under
crates/*
- If this causes circular dependencies, have a chat with @chriswk or @sighphyre before implementing your new feature.
For a quicker build/test loop, we provide a just setup which takes around a tenth of the time of cargo build. You'll
need to install a few tools for this to work correctly.
Just can be installed with cargo:
cargo install justLinux (Debian/Ubuntu-based):
sudo apt install clang lldMacOS
xcode-select --installWindows Install the "Desktop Development with C++" workload via the Visual Studio Installer. This typically includes clang and lld.
Ensure you're using a nightly Rust toolchain
rustup default nightlyInstall cranelift with rustup:
rustup component add rustc-codegen-cranelift-preview --toolchain nightlyThe just file provides fast build and test commands using the Cranelift backend and LLD linker. These steps skip integration tests and are typically ~10x faster than a full cargo build.
just build
just testIf you're unable to use LLD (due to system configuration, linker errors, or platform limitations), use the system linker instead:
just sysbuild
just systestcargo add ...- Add a dependency to the Cargo.toml filecargo remove ...- Remove a dependency from the Cargo.toml filecargo check- Checks a local package and all of its dependencies for errorscargo clippy- Run Clippy to get code warningscargo fmt- Format the code using rustfmtcargo test- Run the testscargo build- Build a debug build. The executable will be available in ./target/debug/unleash-edge once successfulcargo build --release- Build a release build. The executable will be available in ./target/release/unleash-edge once successful. - If you want to run loadtesting, you should really build in release mode. 10-20x faster than the debug buildcargo run -- edge --markdown-help -u http://localhost:4242 > CLI.md- Update the CLI.md file.cargo run -- edge -h- Start here to run edge mode locally.cargo run -- offline -h- Start here to run offline mode locally.
By default cargo test will run all the tests. If you want to exclude the expensive integration tests you can instead
run cargo test --bin unleash-edge.
In order for all tests to successfully build, you'll need Docker installed. We use testcontainers to spin up a redis container to test our redis feature. Testcontainers require docker to run