|
| 1 | +# Contributing |
| 2 | + |
| 3 | +This project requires the following tools installed: |
| 4 | + |
| 5 | +- :simple-rust: [rust](https://rustup.rs/) |
| 6 | +- :simple-uv: [`uv` (Python Project management tool)](https://docs.astral.sh/uv/) |
| 7 | + |
| 8 | +## Getting started |
| 9 | + |
| 10 | +After checking out the repo locally, use |
| 11 | + |
| 12 | +```sh |
| 13 | +uv sync |
| 14 | +``` |
| 15 | + |
| 16 | +This creates a venv at ".venv/" in repo root (if it doesn't exist). |
| 17 | +It also installs dev dependencies like `pre-commit`, `nox`, `ruff`, and `mypy`. |
| 18 | + |
| 19 | +See [`uv sync` docs](https://docs.astral.sh/uv/reference/cli/#uv-sync) |
| 20 | +for more detailed usage. |
| 21 | + |
| 22 | +> [!TIP] |
| 23 | +> To register the pre-commit hooks, use: |
| 24 | +> |
| 25 | +> ```shell |
| 26 | +> uv run pre-commit install |
| 27 | +> ``` |
| 28 | +
|
| 29 | +## Running tests |
| 30 | +
|
| 31 | +First ensure that the following cargo-managed binaries are installed: |
| 32 | +
|
| 33 | +- [`cargo-llvm-cov`](https://github.com/taiki-e/cargo-llvm-cov) |
| 34 | +- [`cargo-nextest`](https://nexte.st/docs/installation/pre-built-binaries/) |
| 35 | +- [`llvm-cov-pretty`](https://crates.io/crates/llvm-cov-pretty) is used only for the optional `nox -s pretty-cov` task. Without this installed, `nox -s llvm-cov` will suffice. |
| 36 | +
|
| 37 | +Use nox to run tests: |
| 38 | +
|
| 39 | +```sh |
| 40 | +uv run nox -s test |
| 41 | +``` |
| 42 | +
|
| 43 | +Different test profiles are still defined in .config/nextest.toml. |
| 44 | +The above command uses the "default" profile, but to mimic the CI, use: |
| 45 | + |
| 46 | +```sh |
| 47 | +uv run nox -s test -- --profile ci |
| 48 | +``` |
| 49 | + |
| 50 | +To generate a coverage report: |
| 51 | + |
| 52 | +```sh |
| 53 | +uv run nox -s llvm-cov -- --open |
| 54 | +``` |
| 55 | + |
| 56 | +The `-- --open` part is optional. It opens the built coverage report in your default browser. |
| 57 | + |
| 58 | +The uploaded codecov report is generated with |
| 59 | + |
| 60 | +```sh |
| 61 | +uv run nox -s lcov |
| 62 | +``` |
| 63 | + |
| 64 | +## Generating docs |
| 65 | + |
| 66 | +To view the docs locally, use |
| 67 | + |
| 68 | +```sh |
| 69 | +uv run nox -s docs -- --open |
| 70 | +``` |
| 71 | + |
| 72 | +The `-- --open` part is optional. It opens the built docs in your default browser. |
| 73 | + |
| 74 | +In CI, docs are built using |
| 75 | + |
| 76 | +```sh |
| 77 | +uv run nox -s docs-build |
| 78 | +``` |
0 commit comments