blob: 438e4f56c3cf56bc89ccc3d890377c5e55ebeaf4 [file] [log] [blame] [view]
Justin Woodc9bbb252020-03-03 10:03:58 -08001Contributing to CHIP
2========================
3
4Want to contribute? Great! First, read this page (including the small
5print at the end).
6By submitting a pull request, you represent that you have the right to license your contribution to Zigbee and the
7community, and agree by submitting the patch that your contributions are licensed under the
8[Apache 2.0 license](./LICENSE.md).
9
10Before submitting the pull request, please make sure you have tested your changes and that they follow the project
11[guidelines for contributing code](./docs/contribution_guidelines.md).
12
13
14## Bugs
15
16If you find a bug in the source code, you can help us by [submitting a GitHub Issue](https://github.com/project-chip/connectedhomeip/issues/new). The best bug reports provide a detailed description of the issue and step-by-step instructions for predictably reproducing the issue. Even better, you can [submit a Pull Request](#submitting-a-pull-request) with a fix.
17
18## New Features
19
20You can request a new feature by [submitting a GitHub Issue](https://github.com/project-chip/connectedhomeip/issues/new).
21
22If you would like to implement a new feature, please consider the scope of the new feature:
23
24* *Large feature*: first [submit a GitHub
25 Issue](https://github.com/project-chip/connectedhomeip/issues/new) and communicate
26 your proposal so that the community can review and provide feedback. Getting
27 early feedback will help ensure your implementation work is accepted by the
28 community. This will also allow us to better coordinate our efforts and
29 minimize duplicated effort.
30
31* *Small feature*: can be implemented and directly [submitted as a Pull
32 Request](#submitting-a-pull-request).
33
34## Contributing Code
35
36CHIP follows the "Fork-and-Pull" model for accepting contributions.
37
38### Initial Setup
39
40Setup your GitHub fork and continuous-integration services:
41
421. Fork the [CHIP
43 repository](https://github.com/project-chip/connectedhomeip) by clicking "Fork"
44 on the web UI.
45
462. All contributions must pass all checks and reviews to be accepted.
47
48Setup your local development environment:
49
50```bash
51# Clone your fork
52git clone git@github.com:<username>/connectedhomeip.git
53
54# Configure upstream alias
55git remote add upstream git@github.com:project-chip/connectedhomeip.git
56```
57
58### Submitting a Pull Request
59
60#### Branch
61
62For each new feature, create a working branch:
63
64```bash
65# Create a working branch for your new feature
66git branch --track <branch-name> origin/master
67
68# Checkout the branch
69git checkout <branch-name>
70```
71
72#### Create Commits
73
74```bash
75# Add each modified file you'd like to include in the commit
76git add <file1> <file2>
77
78# Create a commit
79git commit
80```
81
82This will open up a text editor where you can craft your commit message.
83
84#### Upstream Sync and Clean Up
85
86Prior to submitting your pull request, you might want to do a few things to
87clean up your branch and make it as simple as possible for the original
88repository's maintainer to test, accept, and merge your work.
89
90If any commits have been made to the upstream master branch, you should rebase
91your development branch so that merging it will be a simple fast-forward that
92won't require any conflict resolution work.
93
94```bash
95# Fetch upstream master and merge with your repository's master branch
96git checkout master
97git pull upstream master
98
99# If there were any new commits, rebase your development branch
100git checkout <branch-name>
101git rebase master
102```
103
104Now, it may be desirable to squash some of your smaller commits down into a
105small number of larger more cohesive commits. You can do this with an
106interactive rebase:
107
108```bash
109# Rebase all commits on your development branch
110git checkout
111git rebase -i master
112```
113
114This will open up a text editor where you can specify which commits to squash.
115
116
117#### Push and Test
118
119```bash
120# Checkout your branch
121git checkout <branch-name>
122
123# Push to your GitHub fork:
124git push origin <branch-name>
125```
126
127This will trigger the continuous-integration checks. You
128can view the results in the respective services. Note that the integration
129checks will report failures on occasion.
130
131#### Pull Request Requirements
132
133CHIP considers there to be a few different types of pull requests:
134- Trivial bug fix
135- - Decription 1
136- - Decription 2
137- Small Bug fix
138- - Decription 1
139- - Decription 2
140- Bug Fix
141- - Decription 1
142- - Decription 2
143- Significiant Change
144- - Decription 1
145- - Decription 2
146- Feature
147- - Decription 1
148- - Decription 2
149- Architecture Change
150- - Decription 1
151- - Decription 2
152
153### Prior to review, all changes require:
154- [GitHub Workflows](../.github/workflows) pass
155- [Certification Tests](tests/certification/README.md) pass
156- [Unit Tests](tests/unit/README.md) pass
157- [Fuzz Tests](tests/fuzz/README.md) pass
158- [Integration Tests](tests/integration/README.md) pass
159- Linting passes
160- Code style passes
161
162Each type of change has unique additional requirements, here's a table of those:
163| Type | Reviewer Requirements | New Unit Tests | New Certification Tests | New Fuzz Tests | New Integration Tests |
164|----|----|----|----|----|----|
165| Trivial bug fix | | | | | |
166| Small Bug fix | | | | | | |
167| Bug Fix | | | | | | |
168| Significiant Change | | | | | | |
169| Feature | | | | | | |
170| Architecture Change | | | | | | |
171
172
173
174#### Submit Pull Request
175
176Once you've validated the CI results, go to the page for
177your fork on GitHub, select your development branch, and click the pull request
178button. If you need to make any adjustments to your pull request, just push the
179updates to GitHub. Your pull request will automatically track the changes on
180your development branch and update.
181
182#### Code reviews
183
184All submissions, including submissions by project members, require review.
185
186### Documentation
187
188Documentation undergoes the same review process as code
189
190See the [Documentation Style Guide][doc-style] for more information on
191how to author and format documentation for contribution.
192