1
0

CONTRIBUTING.rst 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. Contributing code to Matrix
  2. ===========================
  3. Everyone is welcome to contribute code to Matrix
  4. (https://github.com/matrix-org), provided that they are willing to license
  5. their contributions under the same license as the project itself. We follow a
  6. simple 'inbound=outbound' model for contributions: the act of submitting an
  7. 'inbound' contribution means that the contributor agrees to license the code
  8. under the same terms as the project's overall 'outbound' license - in our
  9. case, this is almost always Apache Software License v2 (see LICENSE).
  10. How to contribute
  11. ~~~~~~~~~~~~~~~~~
  12. The preferred and easiest way to contribute changes to Matrix is to fork the
  13. relevant project on github, and then create a pull request to ask us to pull
  14. your changes into our repo
  15. (https://help.github.com/articles/using-pull-requests/)
  16. **The single biggest thing you need to know is: please base your changes on
  17. the develop branch - /not/ master.**
  18. We use the master branch to track the most recent release, so that folks who
  19. blindly clone the repo and automatically check out master get something that
  20. works. Develop is the unstable branch where all the development actually
  21. happens: the workflow is that contributors should fork the develop branch to
  22. make a 'feature' branch for a particular contribution, and then make a pull
  23. request to merge this back into the matrix.org 'official' develop branch. We
  24. use github's pull request workflow to review the contribution, and either ask
  25. you to make any refinements needed or merge it and make them ourselves. The
  26. changes will then land on master when we next do a release.
  27. We use `Buildkite <https://buildkite.com/matrix-dot-org/synapse>`_ for
  28. continuous integration. Buildkite builds need to be authorised by a
  29. maintainer. If your change breaks the build, this will be shown in GitHub, so
  30. please keep an eye on the pull request for feedback.
  31. To run unit tests in a local development environment, you can use:
  32. - ``tox -e py35`` (requires tox to be installed by ``pip install tox``)
  33. for SQLite-backed Synapse on Python 3.5.
  34. - ``tox -e py36`` for SQLite-backed Synapse on Python 3.6.
  35. - ``tox -e py36-postgres`` for PostgreSQL-backed Synapse on Python 3.6
  36. (requires a running local PostgreSQL with access to create databases).
  37. - ``./test_postgresql.sh`` for PostgreSQL-backed Synapse on Python 3.5
  38. (requires Docker). Entirely self-contained, recommended if you don't want to
  39. set up PostgreSQL yourself.
  40. Docker images are available for running the integration tests (SyTest) locally,
  41. see the `documentation in the SyTest repo
  42. <https://github.com/matrix-org/sytest/blob/develop/docker/README.md>`_ for more
  43. information.
  44. Code style
  45. ~~~~~~~~~~
  46. All Matrix projects have a well-defined code-style - and sometimes we've even
  47. got as far as documenting it... For instance, synapse's code style doc lives
  48. at https://github.com/matrix-org/synapse/tree/master/docs/code_style.rst.
  49. Please ensure your changes match the cosmetic style of the existing project,
  50. and **never** mix cosmetic and functional changes in the same commit, as it
  51. makes it horribly hard to review otherwise.
  52. Changelog
  53. ~~~~~~~~~
  54. All changes, even minor ones, need a corresponding changelog / newsfragment
  55. entry. These are managed by Towncrier
  56. (https://github.com/hawkowl/towncrier).
  57. To create a changelog entry, make a new file in the ``changelog.d`` file named
  58. in the format of ``PRnumber.type``. The type can be one of the following:
  59. * ``feature``.
  60. * ``bugfix``.
  61. * ``docker`` (for updates to the Docker image).
  62. * ``doc`` (for updates to the documentation).
  63. * ``removal`` (also used for deprecations).
  64. * ``misc`` (for internal-only changes).
  65. The content of the file is your changelog entry, which should be a short
  66. description of your change in the same style as the rest of our `changelog
  67. <https://github.com/matrix-org/synapse/blob/master/CHANGES.md>`_. The file can
  68. contain Markdown formatting, and should end with a full stop ('.') for
  69. consistency.
  70. Adding credits to the changelog is encouraged, we value your
  71. contributions and would like to have you shouted out in the release notes!
  72. For example, a fix in PR #1234 would have its changelog entry in
  73. ``changelog.d/1234.bugfix``, and contain content like "The security levels of
  74. Florbs are now validated when recieved over federation. Contributed by Jane
  75. Matrix.".
  76. Debian changelog
  77. ----------------
  78. Changes which affect the debian packaging files (in ``debian``) are an
  79. exception.
  80. In this case, you will need to add an entry to the debian changelog for the
  81. next release. For this, run the following command::
  82. dch
  83. This will make up a new version number (if there isn't already an unreleased
  84. version in flight), and open an editor where you can add a new changelog entry.
  85. (Our release process will ensure that the version number and maintainer name is
  86. corrected for the release.)
  87. If your change affects both the debian packaging *and* files outside the debian
  88. directory, you will need both a regular newsfragment *and* an entry in the
  89. debian changelog. (Though typically such changes should be submitted as two
  90. separate pull requests.)
  91. Attribution
  92. ~~~~~~~~~~~
  93. Everyone who contributes anything to Matrix is welcome to be listed in the
  94. AUTHORS.rst file for the project in question. Please feel free to include a
  95. change to AUTHORS.rst in your pull request to list yourself and a short
  96. description of the area(s) you've worked on. Also, we sometimes have swag to
  97. give away to contributors - if you feel that Matrix-branded apparel is missing
  98. from your life, please mail us your shipping address to matrix at matrix.org and
  99. we'll try to fix it :)
  100. Sign off
  101. ~~~~~~~~
  102. In order to have a concrete record that your contribution is intentional
  103. and you agree to license it under the same terms as the project's license, we've adopted the
  104. same lightweight approach that the Linux Kernel
  105. `submitting patches process <https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin>`_, Docker
  106. (https://github.com/docker/docker/blob/master/CONTRIBUTING.md), and many other
  107. projects use: the DCO (Developer Certificate of Origin:
  108. http://developercertificate.org/). This is a simple declaration that you wrote
  109. the contribution or otherwise have the right to contribute it to Matrix::
  110. Developer Certificate of Origin
  111. Version 1.1
  112. Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
  113. 660 York Street, Suite 102,
  114. San Francisco, CA 94110 USA
  115. Everyone is permitted to copy and distribute verbatim copies of this
  116. license document, but changing it is not allowed.
  117. Developer's Certificate of Origin 1.1
  118. By making a contribution to this project, I certify that:
  119. (a) The contribution was created in whole or in part by me and I
  120. have the right to submit it under the open source license
  121. indicated in the file; or
  122. (b) The contribution is based upon previous work that, to the best
  123. of my knowledge, is covered under an appropriate open source
  124. license and I have the right under that license to submit that
  125. work with modifications, whether created in whole or in part
  126. by me, under the same open source license (unless I am
  127. permitted to submit under a different license), as indicated
  128. in the file; or
  129. (c) The contribution was provided directly to me by some other
  130. person who certified (a), (b) or (c) and I have not modified
  131. it.
  132. (d) I understand and agree that this project and the contribution
  133. are public and that a record of the contribution (including all
  134. personal information I submit with it, including my sign-off) is
  135. maintained indefinitely and may be redistributed consistent with
  136. this project or the open source license(s) involved.
  137. If you agree to this for your contribution, then all that's needed is to
  138. include the line in your commit or pull request comment::
  139. Signed-off-by: Your Name <your@email.example.org>
  140. We accept contributions under a legally identifiable name, such as
  141. your name on government documentation or common-law names (names
  142. claimed by legitimate usage or repute). Unfortunately, we cannot
  143. accept anonymous contributions at this time.
  144. Git allows you to add this signoff automatically when using the ``-s``
  145. flag to ``git commit``, which uses the name and email set in your
  146. ``user.name`` and ``user.email`` git configs.
  147. Conclusion
  148. ~~~~~~~~~~
  149. That's it! Matrix is a very open and collaborative project as you might expect
  150. given our obsession with open communication. If we're going to successfully
  151. matrix together all the fragmented communication technologies out there we are
  152. reliant on contributions and collaboration from the community to do so. So
  153. please get involved - and we hope you have as much fun hacking on Matrix as we
  154. do!