Skip to content

Commit 9eb629b

Browse files
committed
Adds contribution notes about CI tests and PRs
1 parent 2c2f00a commit 9eb629b

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

CONTRIBUTING.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
# Contributing
3+
4+
All contributors are expected to follow our [Code of Conduct](CODE_OF_CONDUCT.md).
5+
6+
## Pull requests
7+
8+
Before opening large pull requests, it is prefered that the change be discussed in a github issue first. This helps keep everyone on the same page, and facilitates a smoother code review process.
9+
10+
## Testing
11+
12+
The CI system conducts a few different tests for various releases of rust. In addition to the normal cargo tests, code formatting is checked with [fmt](https://github.com/rust-lang-nursery/rustfmt), and linting is checked with [clippy](https://github.com/rust-lang-nursery/rust-clippy). Whereas cargo tests are run for all rust release channels, `fmt` and `clippy` are only run on the stable channel.
13+
14+
| Channel | fmt | clippy | test |
15+
|---------|-----|--------|------|
16+
| stable | x | x | x |
17+
| beta | | | x |
18+
| nightly | | | x |
19+
20+
Too avoid any surprises by CI while merging, it's recommended you run these locally after making changes. Setup and testing only takes a couple minutes at most.
21+
22+
### Setup
23+
24+
Rust does not have `fmt` or `clippy` installed by default, so you will have to add them manually. The installation process is unlikely to change, but if it does, specific installation instructions can be found on the READMEs for [fmt](https://github.com/rust-lang-nursery/rustfmt#quick-start) and [clippy](https://github.com/rust-lang-nursery/rust-clippy#step-2-install-clippy).
25+
26+
```
27+
rustup component add rustfmt-preview clippy-preview
28+
```
29+
30+
If you want install to a different toolchain (if for instance your default is set to nightly, but you need to test stable), you can provide the 'toolchain' argument:
31+
32+
```
33+
rustup component add rustfmt-preview clippy-preview --toolchain stable
34+
```
35+
36+
### Running
37+
38+
Verify you are using the stable channel (output of `rustc --version` does not contain "nightly" or "beta"). Then run fmt, clippy, and test as they are invoked in the `.travis.yml` file.
39+
40+
If you are on the stable channel, then you can run fmt, clippy, and test as they are invoked in the `.travis.yml` file.
41+
42+
```
43+
cargo fmt --all -- --check
44+
cargo clippy
45+
cargo test --all
46+
```
47+
48+
If your default channel is something other than stable, you can force the use of stable by providing the channel option:
49+
50+
```
51+
cargo +stable fmt --all -- --check
52+
cargo +stable clippy
53+
cargo +stable test --all
54+
```

0 commit comments

Comments
 (0)