Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 1 | # Contributing to Project Connected Home over IP |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 2 | |
Justin Wood | 0a9545e | 2020-04-20 18:15:21 -0700 | [diff] [blame] | 3 | Want to contribute? Great! First, read this page (including the small print at |
| 4 | the end). By submitting a pull request, you represent that you have the right to |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 5 | license your contribution to the Zigbee Alliance and the community, and agree by |
| 6 | submitting the patch that your contributions are licensed under the |
| 7 | [Apache 2.0 license](./LICENSE). Before submitting the pull request, please make |
| 8 | sure you have tested your changes and that they follow the project guidelines |
| 9 | for contributing code. |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 10 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 11 | # Contributing as an Open Source Contributor |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 12 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 13 | As an open source contributor you can report bugs and request features in the |
| 14 | [Issue Tracker](https://github.com/project-chip/connectedhomeip/issues), as well |
| 15 | as contribute bug fixes and features that do not impact the Project CHIP |
| 16 | specification as a pull request. For example: ports of Project CHIP to add APIs |
| 17 | to alternative programming languages (e.g. Java, JS), hardware ports, or an |
| 18 | optimized implementation of existing functionality. For features that impact the |
| 19 | specification, please join Project CHIP work group within the Zigbee Alliance. |
| 20 | The requirements to become an open source contributor of the |
| 21 | [Project CHIP Repository](https://github.com/project-chip/connectedhomeip) are: |
Justin Wood | 2eb7487 | 2020-03-03 15:36:27 -0800 | [diff] [blame] | 22 | |
Justin Wood | 0a9545e | 2020-04-20 18:15:21 -0700 | [diff] [blame] | 23 | - Agree to the [Code of Conduct](./CODE_OF_CONDUCT.md) |
| 24 | - Agree to the [License](./LICENSE) |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 25 | - Have signed the |
| 26 | [Zigbee Project CHIP Working Group CLA](https://gist.github.com/clapre/65aa9fc63981da765039e0bb7e8701be) |
| 27 | |
| 28 | # Contributing as a Zigbee Alliance Project CHIP Working Group Member |
| 29 | |
| 30 | As a participant of the Zigbee Alliance Project CHIP working group, you can |
| 31 | attend working group meetings, propose changes to the Project CHIP |
| 32 | specification, and contribute code for approved updates to the specification. |
| 33 | The requirements to become a member of the |
| 34 | [Project CHIP Repository](https://github.com/project-chip/connectedhomeip) are: |
| 35 | |
| 36 | - Must be a [Participant member](http://www.zigbeealliance.org/join) or higher |
| 37 | of the Zigbee Alliance |
| 38 | - Must be a Project CHIP Working Group member |
| 39 | - Have signed the Zigbee Project CHIP Work Group CLA |
Justin Wood | 0a9545e | 2020-04-20 18:15:21 -0700 | [diff] [blame] | 40 | - Have approval from your company's official approver |
Justin Wood | 2eb7487 | 2020-03-03 15:36:27 -0800 | [diff] [blame] | 41 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 42 | # Bugs |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 43 | |
Justin Wood | 0a9545e | 2020-04-20 18:15:21 -0700 | [diff] [blame] | 44 | If you find a bug in the source code, you can help us by |
| 45 | [submitting a GitHub Issue](https://github.com/project-chip/connectedhomeip/issues/new). |
| 46 | The best bug reports provide a detailed description of the issue and |
| 47 | step-by-step instructions for predictably reproducing the issue. Even better, |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 48 | you can |
| 49 | [submit a Pull Request](https://github.com/project-chip/connectedhomeip/blob/master/CONTRIBUTING.md#submitting-a-pull-request) |
| 50 | with a fix. |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 51 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 52 | # New Features |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 53 | |
Justin Wood | 0a9545e | 2020-04-20 18:15:21 -0700 | [diff] [blame] | 54 | You can request a new feature by |
| 55 | [submitting a GitHub Issue](https://github.com/project-chip/connectedhomeip/issues/new). |
Justin Wood | 0a9545e | 2020-04-20 18:15:21 -0700 | [diff] [blame] | 56 | If you would like to implement a new feature, please consider the scope of the |
| 57 | new feature: |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 58 | |
Justin Wood | 0a9545e | 2020-04-20 18:15:21 -0700 | [diff] [blame] | 59 | - _Large feature_: first |
| 60 | [submit a GitHub Issue](https://github.com/project-chip/connectedhomeip/issues/new) |
| 61 | and communicate your proposal so that the community can review and provide |
| 62 | feedback. Getting early feedback will help ensure your implementation work |
| 63 | is accepted by the community. This will also allow us to better coordinate |
| 64 | our efforts and minimize duplicated effort. |
Justin Wood | 0a9545e | 2020-04-20 18:15:21 -0700 | [diff] [blame] | 65 | - _Small feature_: can be implemented and directly |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 66 | [submitted as a Pull Request](https://github.com/project-chip/connectedhomeip/blob/master/CONTRIBUTING.md#submitting-a-pull-request). |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 67 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 68 | # Contributing Code |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 69 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 70 | Project CHIP follows the "Fork-and-Pull" model for accepting contributions. |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 71 | |
| 72 | ### Initial Setup |
| 73 | |
| 74 | Setup your GitHub fork and continuous-integration services: |
| 75 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 76 | 1. Fork the |
| 77 | [Project CHIP repository](https://github.com/project-chip/connectedhomeip) by |
| 78 | clicking "Fork" on the web UI. |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 79 | |
| 80 | 2. All contributions must pass all checks and reviews to be accepted. |
| 81 | |
| 82 | Setup your local development environment: |
| 83 | |
| 84 | ```bash |
| 85 | # Clone your fork |
| 86 | git clone git@github.com:<username>/connectedhomeip.git |
| 87 | |
| 88 | # Configure upstream alias |
| 89 | git remote add upstream git@github.com:project-chip/connectedhomeip.git |
| 90 | ``` |
| 91 | |
| 92 | ### Submitting a Pull Request |
| 93 | |
| 94 | #### Branch |
| 95 | |
| 96 | For each new feature, create a working branch: |
| 97 | |
| 98 | ```bash |
| 99 | # Create a working branch for your new feature |
| 100 | git branch --track <branch-name> origin/master |
| 101 | |
| 102 | # Checkout the branch |
| 103 | git checkout <branch-name> |
| 104 | ``` |
| 105 | |
| 106 | #### Create Commits |
| 107 | |
| 108 | ```bash |
| 109 | # Add each modified file you'd like to include in the commit |
| 110 | git add <file1> <file2> |
| 111 | |
| 112 | # Create a commit |
| 113 | git commit |
| 114 | ``` |
| 115 | |
| 116 | This will open up a text editor where you can craft your commit message. |
| 117 | |
| 118 | #### Upstream Sync and Clean Up |
| 119 | |
| 120 | Prior to submitting your pull request, you might want to do a few things to |
| 121 | clean up your branch and make it as simple as possible for the original |
| 122 | repository's maintainer to test, accept, and merge your work. |
| 123 | |
| 124 | If any commits have been made to the upstream master branch, you should rebase |
| 125 | your development branch so that merging it will be a simple fast-forward that |
| 126 | won't require any conflict resolution work. |
| 127 | |
| 128 | ```bash |
| 129 | # Fetch upstream master and merge with your repository's master branch |
| 130 | git checkout master |
| 131 | git pull upstream master |
| 132 | |
| 133 | # If there were any new commits, rebase your development branch |
| 134 | git checkout <branch-name> |
| 135 | git rebase master |
| 136 | ``` |
| 137 | |
| 138 | Now, it may be desirable to squash some of your smaller commits down into a |
| 139 | small number of larger more cohesive commits. You can do this with an |
| 140 | interactive rebase: |
| 141 | |
| 142 | ```bash |
| 143 | # Rebase all commits on your development branch |
| 144 | git checkout |
| 145 | git rebase -i master |
| 146 | ``` |
| 147 | |
| 148 | This will open up a text editor where you can specify which commits to squash. |
| 149 | |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 150 | #### Push and Test |
| 151 | |
| 152 | ```bash |
| 153 | # Checkout your branch |
| 154 | git checkout <branch-name> |
| 155 | |
| 156 | # Push to your GitHub fork: |
| 157 | git push origin <branch-name> |
| 158 | ``` |
| 159 | |
Justin Wood | 0a9545e | 2020-04-20 18:15:21 -0700 | [diff] [blame] | 160 | This will trigger the continuous-integration checks. You can view the results in |
| 161 | the respective services. Note that the integration checks will report failures |
| 162 | on occasion. |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 163 | |
Justin Wood | 7b11651 | 2020-03-03 16:13:59 -0800 | [diff] [blame] | 164 | ### Review Requirements |
Justin Wood | 0a9545e | 2020-04-20 18:15:21 -0700 | [diff] [blame] | 165 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 166 | #### Documentation Best Practices |
Justin Wood | 7b11651 | 2020-03-03 16:13:59 -0800 | [diff] [blame] | 167 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 168 | Project CHIP uses Doxygen to markup (or markdown) all C, C++, Objective C, |
| 169 | Objective C++, Perl, Python, and Java code. Read our |
| 170 | [Doxygen Best Practices, Conventions, and Style](https://github.com/project-chip/connectedhomeip/blob/master/docs/style/DOXYGEN.adoc) |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 171 | |
| 172 | #### Submit Pull Request |
| 173 | |
Justin Wood | 0a9545e | 2020-04-20 18:15:21 -0700 | [diff] [blame] | 174 | Once you've validated the CI results, go to the page for your fork on GitHub, |
| 175 | select your development branch, and click the pull request button. If you need |
| 176 | to make any adjustments to your pull request, just push the updates to GitHub. |
| 177 | Your pull request will automatically track the changes on your development |
| 178 | branch and update. |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 179 | |
Justin Wood | 95174b4 | 2020-03-03 15:58:18 -0800 | [diff] [blame] | 180 | #### Merge Requirements |
| 181 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 182 | - Github Workflows pass |
| 183 | - Builds pass |
| 184 | - Tests pass |
Justin Wood | 0a9545e | 2020-04-20 18:15:21 -0700 | [diff] [blame] | 185 | - Linting passes |
| 186 | - Code style passes |
Justin Wood | 95174b4 | 2020-03-03 15:58:18 -0800 | [diff] [blame] | 187 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 188 | When can I merge? After these have been satisfied, a reviewer will merge the PR |
| 189 | into master |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 190 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 191 | #### Documentation |
Justin Wood | c9bbb25 | 2020-03-03 10:03:58 -0800 | [diff] [blame] | 192 | |
Justin Wood | d4a0615 | 2020-07-01 08:58:02 -0700 | [diff] [blame^] | 193 | Documentation undergoes the same review process as code See the |
| 194 | [Documentation Style Guide](https://github.com/project-chip/connectedhomeip/blob/master/docs/STYLE_GUIDE.md) |
| 195 | for more information on how to author and format documentation for contribution. |