Imported Upstream version 1.36.4
[platform/upstream/grpc.git] / CONTRIBUTING.md
1 # How to contribute
2
3 We definitely welcome your patches and contributions to gRPC! Please read the gRPC
4 organization's [governance rules](https://github.com/grpc/grpc-community/blob/master/governance.md)
5 and [contribution guidelines](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md) before proceeding.
6
7 If you are new to github, please start by reading [Pull Request
8 howto](https://help.github.com/articles/about-pull-requests/)
9
10 If you are looking for features to work on, please filter the issues list with the label ["disposition/help wanted"](https://github.com/grpc/grpc/issues?q=label%3A%22disposition%2Fhelp+wanted%22).
11 Please note that some of these feature requests might have been closed in the past as a result of them being marked as stale due to there being no activity, but these are still valid feature requests.
12
13 ## Legal requirements
14
15 In order to protect both you and ourselves, you will need to sign the
16 [Contributor License
17 Agreement](https://identity.linuxfoundation.org/projects/cncf).
18
19 ## Cloning the repository
20
21 Before starting any development work you will need a local copy of the gRPC repository.
22 Please follow the instructions in [Building gRPC C++: Clone the repository](BUILDING.md#clone-the-repository-including-submodules).
23
24 ## Building & Running tests
25
26 Different languages use different build systems. To hide the complexity
27 of needing to build with many different build systems, a portable python
28 script that unifies the experience of building and testing gRPC in different
29 languages and on different platforms is provided.
30
31 To build gRPC in the language of choice (e.g. `c++`, `csharp`, `php`, `python`, `ruby`, ...)
32 - Prepare your development environment based on language-specific instructions in `src/YOUR-LANGUAGE` directory.
33 - The language-specific instructions might involve installing C/C++ prerequisites listed in
34   [Building gRPC C++: Prerequisites](BUILDING.md#pre-requisites). This is because gRPC implementations
35   in this repository are using the native gRPC "core" library internally.
36 - Run
37   ```
38   python tools/run_tests/run_tests.py -l YOUR_LANGUAGE --build_only
39   ```
40 - To also run all the unit tests after building
41   ```
42   python tools/run_tests/run_tests.py -l YOUR_LANGUAGE
43   ```
44
45 You can also run `python tools/run_tests/run_tests.py --help` to discover useful command line flags supported. For more details,
46 see [tools/run_tests](tools/run_tests) where you will also find guidance on how to run various other test suites (e.g. interop tests, benchmarks).
47
48 ## Generated project files
49
50 To ease maintenance of language- and platform- specific build systems, many
51 projects files are generated using templates and should not be edited by hand.
52 Run `tools/buildgen/generate_projects.sh` to regenerate.  See
53 [templates](templates) for details.
54
55 As a rule of thumb, if you see the "sanity tests" failing you've most likely
56 edited generated files or you didn't regenerate the projects properly (or your
57 code formatting doesn't match our code style).
58
59 ## Guidelines for Pull Requests
60 How to get your contributions merged smoothly and quickly.
61  
62 - Create **small PRs** that are narrowly focused on **addressing a single
63   concern**.  We often times receive PRs that are trying to fix several things
64   at a time, but only one fix is considered acceptable, nothing gets merged and
65   both author's & review's time is wasted.  Create more PRs to address different
66   concerns and everyone will be happy.
67  
68 - For speculative changes, consider opening an issue and discussing it first.
69   If you are suggesting a behavioral or API change, consider starting with a
70   [gRFC proposal](https://github.com/grpc/proposal).
71  
72 - Provide a good **PR description** as a record of **what** change is being made
73   and **why** it was made.  Link to a GitHub issue if it exists.
74  
75 - Don't fix code style and formatting unless you are already changing that line
76   to address an issue.  PRs with irrelevant changes won't be merged.  If you do
77   want to fix formatting or style, do that in a separate PR.
78
79 - If you are adding a new file, make sure it has the copyright message template
80   at the top as a comment. You can copy over the message from an existing file
81   and update the year.
82  
83 - Unless your PR is trivial, you should expect there will be reviewer comments
84   that you'll need to address before merging.  We expect you to be reasonably
85   responsive to those comments, otherwise the PR will be closed after 2-3 weeks
86   of inactivity.
87
88 - If you have non-trivial contributions, please consider adding an entry to [the
89   AUTHORS file](https://github.com/grpc/grpc/blob/master/AUTHORS) listing the
90   copyright holder for the contribution (yourself, if you are signing the
91   individual CLA, or your company, for corporate CLAs) in the same PR as your
92   contribution.  This needs to be done only once, for each company, or
93   individual. Please keep this file in alphabetical order.
94  
95 - Maintain **clean commit history** and use **meaningful commit messages**.
96   PRs with messy commit history are difficult to review and won't be merged.
97   Use `rebase -i upstream/master` to curate your commit history and/or to
98   bring in latest changes from master (but avoid rebasing in the middle of
99   a code review).
100  
101 - Keep your PR up to date with upstream/master (if there are merge conflicts,
102   we can't really merge your change).
103  
104 - If you are regenerating the projects using
105   `tools/buildgen/generate_projects.sh`, make changes to generated files a
106   separate commit with commit message `regenerate projects`.  Mixing changes
107   to generated and hand-written files make your PR difficult to review.
108   Note that running this script requires the installation of Python packages
109   `pyyaml` and `mako` (typically installed using `pip`) as well as a recent
110   version of [`go`](https://golang.org/doc/install#install).
111  
112 - **All tests need to be passing** before your change can be merged.
113   We recommend you **run tests locally** before creating your PR to catch
114   breakages early on (see [tools/run_tests](tools/run_tests).  Ultimately, the
115   green signal will be provided by our testing infrastructure.  The reviewer
116   will help you if there are test failures that seem not related to the change
117   you are making.
118  
119 - Exceptions to the rules can be made if there's a compelling reason for doing
120   so.
121
122 ## Obtaining Commit Access
123 We grant Commit Access to contributors based on the following criteria:
124 * Sustained contribution to the gRPC project.
125 * Deep understanding of the areas contributed to, and good consideration of various reliability, usability and performance tradeoffs. 
126 * Contributions demonstrate that obtaining Commit Access will significantly reduce friction for the contributors or others. 
127
128 In addition to submitting PRs, a Contributor with Commit Access can:
129 * Review PRs and merge once other checks and criteria pass.
130 * Triage bugs and PRs and assign appropriate labels and reviewers. 
131
132 ### Obtaining Commit Access without Code Contributions 
133 The [gRPC organization](https://github.com/grpc) is comprised of multiple repositories and commit access is usually restricted to one or more of these repositories. Some repositories such as the [grpc.github.io](https://github.com/grpc/grpc.github.io/) do not have code, but the same principle of sustained, high quality contributions, with a good understanding of the fundamentals, apply. 
134