Skip to content

Commit 1d1cac7

Browse files
authored
docs: add CONTRIBUTING.md (#18)
Signed-off-by: David Bernard <david.bernard.31@gmail.com>
1 parent 802b657 commit 1d1cac7

File tree

3 files changed

+143
-1
lines changed

3 files changed

+143
-1
lines changed

.mise.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ MISE_CARGO_BINSTALL = "true"
66

77
[tools]
88
rust = "1.75"
9+
cargo-binstall = 'latest'
910
make = "latest"
1011
# # experimental
11-
"cargo:cargo-binstall" = "latest"
1212
"cargo:cargo-nextest" = "0.9"
1313
# "cargo:cargo-hack" = "latest"
1414
"cargo:cargo-deny" = "0.14"
1515
# "cargo:git-cliff" = "latest"
1616
"cargo:dprint" = "0.45"
17+
18+
[plugins]
19+
cargo-binstall = "https://github.com/davidB/asdf-cargo-binstall"
20+
21+
[settings]
22+
experimental = true

CONTRIBUTING.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
2+
# Contributing
3+
4+
🚀 Thank you for contributing to cdevents! 🚀
5+
6+
## Architecture
7+
8+
The workspace is composed of:
9+
10+
- `cdevents-sdk`: the published rust crate
11+
- `cdevents-specs`: the different version of cdevent's specifications used to generate and validate part of `cdevents-sdk`
12+
- `generator`: the code generator, used to generate a part of `cdevents-sdk` from `cdevents-specs`
13+
14+
Few design's rules:
15+
16+
- The generated code is commited, so users of `cdevents-sdk` don't to generate it at each build.
17+
- TO COMPLETE
18+
19+
## Setting up a development environment
20+
21+
### Setup a GitHub account accessible via SSH
22+
23+
GitHub is used for project Source Code Management (SCM) using the SSH protocol for authentication.
24+
25+
1. Create [a GitHub account](https://github.com/join) if you do not already have one.
26+
1. Setup
27+
[GitHub access via SSH](https://help.github.com/articles/connecting-to-github-with-ssh/)
28+
29+
### Install tools
30+
31+
You must install these tools:
32+
33+
1. [`git`](https://help.github.com/articles/set-up-git/): For source control
34+
35+
2. If you use [mise](https://mise.jdx.dev/): `mise install` (after git clone)
36+
Else look into the mise configuration file [`.mise.toml`](https://github.com/cdevents/sdk-rust/blob/main/.mise.toml) to have the list of tools to install
37+
38+
### Setup a fork
39+
40+
The sdk-rust project requires that you develop (commit) code changes to branches that belong to a fork of the `cdevents/sdk-rust` repository in your GitHub account before submitting them as Pull Requests (PRs) to the actual project repository.
41+
42+
1. [Create a fork](https://help.github.com/articles/fork-a-repo/) of the `cdevents/sdk-rust` repository in your GitHub account.
43+
44+
1. Create a clone of your fork on your local machine:
45+
46+
```shell
47+
git clone git@github.com:${YOUR_GITHUB_USERNAME}/sdk-rust.git
48+
```
49+
50+
1. Configure `git` remote repositories
51+
52+
Adding `cdevents/sdk-rust` as the `upstream` and your fork as the `origin` remote repositories to your `.git/config` sets you up nicely for regularly [syncing your fork](https://help.github.com/articles/syncing-a-fork/) and submitting pull requests.
53+
54+
1. Change into the project directory
55+
56+
```shell
57+
cd sdk-rust
58+
```
59+
60+
2. Retrieve submodules
61+
62+
```shell
63+
git submodule init
64+
git submodule update --init --recursive
65+
```
66+
67+
3. Configure sdk-rust as the `upstream` repository
68+
69+
```shell
70+
git remote add upstream git@github.com:cdevents/sdk-rust.git
71+
72+
# Optional: Prevent accidental pushing of commits by changing the upstream URL to `no_push`
73+
git remote set-url --push upstream no_push
74+
```
75+
76+
4. Configure your fork as the `origin` repository
77+
78+
```shell
79+
git remote add origin git@github.com:${YOUR_GITHUB_USERNAME}/sdk-rust.git
80+
```
81+
82+
## Development
83+
84+
### Work into a branch
85+
86+
```shell
87+
git switch -c feat_foo
88+
```
89+
90+
### Building and testing
91+
92+
To format the rust code and imports:
93+
94+
```shell
95+
make fmt
96+
```
97+
98+
To run the go linter:
99+
100+
```shell
101+
make lint
102+
```
103+
104+
To run unit tests:
105+
106+
```shell
107+
make test
108+
```
109+
110+
### Commit & push
111+
112+
Commit's message should follow the [conventional commit] convention:
113+
e.g.
114+
115+
```txt
116+
feat: my super feature
117+
118+
...
119+
```
120+
121+
```txt
122+
fix: bug blablabla
123+
124+
FIX #99
125+
```
126+
127+
### Review & merge
128+
129+
Create a PR (pull request) and ask for review.
130+
The last reviewer, will "Squash & merge" when ready.
131+
The message of the squashed commit follows the [conventional commit], and aggregate/summaries commits of the branch.
132+
133+
[conventional commit]: https://www.conventionalcommits.org/en/v1.0.0/#summary

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ build_release_%:
1111
build_%:
1212
cargo build --package $*
1313

14+
fmt:
15+
cargo fmt --all
16+
1417
check:
1518
cargo hack check --each-feature
1619

0 commit comments

Comments
 (0)