Skip to content

Commit 5977f91

Browse files
author
Oliver Anyanwu
committed
Expand contributing guide with setup, testing and pre-PR checks
The external contributor section explained the fork and branch workflow but did not say how to actually build, test, or run the checks that CI enforces. Add short subsections covering environment setup and the Linux build dependencies, running the test suite, and running do_checks.sh before opening a pull request so contributors can reproduce the CI static checks locally.
1 parent 12b7670 commit 5977f91

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,51 @@ As an outside contributor, your first step will be to fork the repo and create y
1414

1515
As you make your changes, ensure the code is as clean as possible and well documented so that it's clear to us what you're up to when we review it and it is thoroughly tested. Make sure that the old tests still pass, as well as any tests you've added. We will only merge code with all the tests passing in CI.
1616

17+
### Setting up your environment
18+
19+
Once rust is installed, clone your fork and build the workspace:
20+
21+
```
22+
git clone https://github.com/<your-username>/mintlayer-core.git
23+
cd mintlayer-core
24+
cargo build
25+
```
26+
27+
On Linux you will also need a few system packages before the build succeeds, mainly for the hardware wallet support. On a Debian or Ubuntu based system these are:
28+
29+
```
30+
sudo apt-get install build-essential libdbus-1-dev libusb-1.0-0-dev
31+
```
32+
33+
The static checks described below run through a small helper script that uses Python, so make sure you have Python 3.11 or newer available as well.
34+
35+
### Running the tests
36+
37+
Most of the test suite runs with a normal cargo invocation. We run it in release mode in CI because some of the tests are slow in a debug build:
38+
39+
```
40+
cargo test --release --workspace
41+
```
42+
43+
Some of the heavier tests, such as the functional tests, are marked as ignored so they don't run by default. If your change touches an area covered by them, you can run them explicitly by passing `-- --ignored`. When you add new behaviour, please add tests for it, and when you fix a bug, a test that would have caught it is very welcome.
44+
45+
### Before you open a pull request
46+
47+
We keep the static checks in one place so you can run locally exactly what CI will run. From the root of the repository:
48+
49+
```
50+
./do_checks.sh
51+
```
52+
53+
This checks formatting with `cargo fmt`, runs `cargo clippy` with the lint configuration we use, and runs `cargo deny` and `cargo vet` over the dependency tree. The last two come from separate tools, so install them once with:
54+
55+
```
56+
cargo install cargo-deny --locked
57+
cargo install cargo-vet --locked
58+
```
59+
60+
If `do_checks.sh` passes locally, your pull request should get through the static checks in CI too, which makes the review quicker for everyone. A draft pull request is always welcome if you would like early feedback, just mark it as such.
61+
1762
## Internal contributors
1863

1964
By internal contributors, we mean people who are members of the Mintlayer organization. If you are not employed full-time to work on Mintlayer but have substantial contributions, drop us a message, and we'll see what can be done about adding you.

0 commit comments

Comments
 (0)