xref: /aosp_15_r20/external/webrtc/docs/native-code/development/contributing.md (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1# Contributing to the WebRTC project
2
3## License Agreement
4
5WebRTC welcomes patches for features and bug fixes!
6
7For contributors external to Google, follow the instructions given in the
8[Google Individual Contributor License Agreement][Google individual CLA].
9In all cases, contributors must sign a contributor license agreement before
10a contribution can be accepted. Please complete the agreement for an
11[individual][individual] or a [corporation][corporation] as appropriate.
12
13[Google Individual CLA]: https://cla.developers.google.com/about/google-individual.
14[individual]: https://developers.google.com/open-source/cla/individual
15[corporation]: https://developers.google.com/open-source/cla/corporate
16
17
18## Instructions
19
20### Contributing your First Patch
21You must do some preparation in order to upload your first CL:
22
23* [Check out and build the code][check out and build the code]
24* Fill in the Contributor agreement (see above)
25* If you’ve never submitted code before, you must add your
26  (or your organization’s in the case the contributor agreement is signed by
27  your organization) name and contact info to the
28 [AUTHORS][AUTHORS] file
29* Go to [https://webrtc.googlesource.com/new-password](new-password)
30  and login with your email account. This should be the same account as
31  returned by `git config user.email`
32* Then, run: `git cl creds-check`. If you get any errors, ask for help on
33 [discuss-webrtc][discuss-webrtc]
34
35You will not have to repeat the above. After all that, you’re ready to upload:
36
37[Check out and the build code]: https://webrtc.googlesource.com/src/+/refs/heads/main/docs/native-code/development/index.md
38[AUTHORS]: https://webrtc.googlesource.com/src/+/refs/heads/main/AUTHORS
39[new-password]: https://webrtc.googlesource.com/new-password
40[discuss-webrtc]: https://groups.google.com/forum/#!forum/discuss-webrtc
41
42### Uploading your First Patch
43Now that you have your account set up, you can do the actual upload:
44
45*  Do this:
46    * Assuming you're on the main branch:
47        * `git checkout -b my-work-branch`
48    * Make changes, build locally, run tests locally
49        * `git commit -am "Changed x, and it is working"`
50        * `git cl upload`
51
52      This will open a text editor showing all local commit messages, allowing you
53      to modify it before it becomes the CL description.
54
55      Fill out the bug entry properly. Please specify the issue tracker prefix and
56      the issue number, separated by a colon, e.g. `webrtc:123` or `chromium:12345`.
57      If you do not have an issue tracker prefix and an issue number just add `None`.
58
59      Save and close the file to proceed with the upload to the WebRTC
60      [code review server](https://webrtc-review.googlesource.com/q/status:open).
61
62      The command will print a link like
63      [https://webrtc-review.googlesource.com/c/src/+/53121][example CL link].
64      if everything goes well.
65
66*  Click this CL Link
67*  If you’re not signed in, click the Sign In button in the top right and sign
68   in with your email
69*  Click Start Review and add a reviewer. You can find reviewers in OWNERS files
70   around the repository (take the one closest to your changes)
71*  Address any reviewer feedback:
72    * Make changes, build locally, run tests locally
73        * `git commit -am "Fixed X and Y"`
74        * `git cl upload`
75*  Once the reviewer LGTMs (approves) the patch, ask them to put it into the
76   commit queue
77
78NOTICE: On Windows, you’ll need to run the above in a Git bash shell in order
79for gclient to find the `.gitcookies` file.
80
81[example CL link]: https://webrtc-review.googlesource.com/c/src/+/53121
82
83### Trybots
84
85If you're working a lot in WebRTC, you can apply for *try rights*. This means you
86can run the *trybots*, which run all the tests on all platforms. To do this,
87file a bug using this [template][template-access] and the WebRTC EngProd team
88will review your request.
89
90To run a tryjob, upload a CL as described above and click either CQ dry run or
91Choose Trybots in the Gerrit UI. You need to have try rights for this. Otherwise,
92ask your reviewer to kick off the bots for you.
93
94If you encounter any issues with the bots (flakiness, failing unrelated to your change etc),
95please file a bug using this [template][template-issue].
96
97[template-access]: https://bugs.chromium.org/p/webrtc/issues/entry?template=Get+tryjob+access
98[template-issue]: https://bugs.chromium.org/p/webrtc/issues/entry?template=trybot+issue
99
100