Skip to content

Commit 92e1d1f

Browse files
committed
doc: add CONTRIBUTING.md, add coverage task
1 parent 945986f commit 92e1d1f

File tree

2 files changed

+53
-8
lines changed

2 files changed

+53
-8
lines changed

.config/mise.toml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,20 @@ act -P ubuntu-24.04=ghcr.io/catthehacker/ubuntu:act-24.04 \
111111
tools = { "cargo:cargo-nextest" = "latest" }
112112
description = "Run tests for a specific package or all packages"
113113
usage = """
114-
flag "--rust-log <rust_log>" env="RUST_LOG"
115-
arg "[rest]" double_dash = "required" default="" help="Passed directly to `cargo nextest`. Use `mise test -- help` for nextest help."
114+
arg "[rest]" default="r --workspace" help="Passed directly to `cargo nextest`"
116115
"""
117116
run = """
118-
if [ $usage_rust_log ]; then RUST_LOG=$usage_rust_log; fi
119-
if [ -n "${usage_rest?}" ]; then
120-
cargo nextest ${usage_rest?}
121-
else
122-
cargo nextest run --workspace
123-
fi
117+
cargo nextest ${usage_rest}
118+
"""
119+
120+
[tasks.coverage]
121+
tools = { "cargo:cargo-llvm-cov" = "latest", "cargo:cargo-nextest" = "latest" }
122+
description = "Get test coverage report."
123+
usage = """
124+
arg "[rest]" default="--html --open"
125+
"""
126+
run = """
127+
RUSTFLAGS=-Zcodegen-backend=llvm cargo llvm-cov nextest --html --open
124128
"""
125129

126130
# LOCAL #######################################################################

CONTRIBUTING.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# How to work on this project
2+
3+
Thanks for your interest!
4+
5+
You should have a few prerequisite tools installed. Most importantly, you'll
6+
need [mise](https://mise.jdx.dev/), an environment manager and task runner.
7+
8+
Once you install mise, run `mise install` and `mise run` to get all the
9+
necessary tools and view the available actions.
10+
11+
## Testing
12+
13+
Tests are handled
14+
with [cargo-nextest](https://github.com/nextest-rs/nextest). Test coverage is
15+
generated with [cargo-llvm-cov.](https://github.com/taiki-e/cargo-llvm-cov)
16+
Generally, tests should be built out using
17+
[q_test_harness.](./crates/test_harness) Read that documentation to learn
18+
common testing patterns.
19+
20+
You can test CI locally by running `mise ci`. You can change which workflow and
21+
which matrix parameters are set by using this sort of pattern:
22+
23+
```mise ci -W ./.github/workflows/ci.yml --matrix target:x86_64-unknown-linux-gnu```
24+
25+
## PRs and Commit Messages
26+
27+
PRs, when accepted, should be squashed into a single commit using [git
28+
convention](https://www.conventionalcommits.org/en/v1.0.0/) for the message.
29+
This is used to automatically generate changelogs when we publish.
30+
31+
PRs are expected to follow best practices. If you author a PR using an LLM,
32+
please disclose that you have done so. All CI checks should pass.
33+
34+
35+
## Publishing
36+
37+
Crates are published using
38+
[cargo-smart-release.](https://github.com/crate-ci/cargo-release) Contributors
39+
generally shouldn't be running this, so this documentation is mostly for me :p
40+
Crates should have at least 80% test coverage before release. Currently there
41+
are hooks to enforce this, so use your best judgement.

0 commit comments

Comments
 (0)