You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

248 lines
10 KiB

  1. # Contribution Guidelines
  2. ## Table of Contents
  3. - [Contribution Guidelines](#contribution-guidelines)
  4. - [Introduction](#introduction)
  5. - [Bug reports](#bug-reports)
  6. - [Discuss your design](#discuss-your-design)
  7. - [Testing redux](#testing-redux)
  8. - [Vendoring](#vendoring)
  9. - [Translation](#translation)
  10. - [Code review](#code-review)
  11. - [Styleguide](#styleguide)
  12. - [Sign your work](#sign-your-work)
  13. - [Release Cycle](#release-cycle)
  14. - [Maintainers](#maintainers)
  15. - [Owners](#owners)
  16. - [Versions](#versions)
  17. - [Copyright](#copyright)
  18. ## Introduction
  19. This document explains how to contribute changes to the Gitea project.
  20. It assumes you have followed the
  21. [installation instructions](https://docs.gitea.io/en-us/).
  22. Sensitive security-related issues should be reported to
  23. [security@gitea.io](mailto:security@gitea.io).
  24. For configuring IDE or code editor to develop Gitea see [IDE and code editor configuration](contrib/ide/)
  25. ## Bug reports
  26. Please search the issues on the issue tracker with a variety of keywords
  27. to ensure your bug is not already reported.
  28. If unique, [open an issue](https://github.com/go-gitea/gitea/issues/new)
  29. and answer the questions so we can understand and reproduce the
  30. problematic behavior.
  31. To show us that the issue you are having is in Gitea itself, please
  32. write clear, concise instructions so we can reproduce the behavior
  33. (even if it seems obvious). The more detailed and specific you are,
  34. the faster we can fix the issue. Check out [How to Report Bugs
  35. Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html).
  36. Please be kind, remember that Gitea comes at no cost to you, and you're
  37. getting free help.
  38. ## Discuss your design
  39. The project welcomes submissions but please let everyone know what
  40. you're working on if you want to change or add something to the Gitea
  41. repositories.
  42. Before starting to write something new for the Gitea project, please [file
  43. an issue](https://github.com/go-gitea/gitea/issues/new). Significant
  44. changes must go through the [change proposal
  45. process](https://github.com/go-gitea/proposals) before they can be
  46. accepted.
  47. This process gives everyone a chance to validate the design, helps
  48. prevent duplication of effort, and ensures that the idea fits inside
  49. the goals for the project and tools. It also checks that the design is
  50. sound before code is written; the code review tool is not the place for
  51. high-level discussions.
  52. ## Testing redux
  53. Before sending code out for review, run all the tests for the
  54. whole tree to make sure the changes don't break other usage
  55. and keep the compatibility on upgrade. To make sure you are
  56. running the test suite exactly like we do, you should install
  57. the CLI for [Drone CI](https://github.com/drone/drone), as
  58. we are using the server for continous testing, following [these
  59. instructions](http://readme.drone.io/usage/getting-started-cli). After
  60. that you can simply call `drone exec` within your working directory and
  61. it will try to run the test suite locally.
  62. ## Vendoring
  63. We keep a cached copy of dependencies within the `vendor/` directory,
  64. managing updates via [govendor](http://github.com/kardianos/govendor).
  65. Pull requests should only include `vendor/` updates if they are part of
  66. the same change, be it a bugfix or a feature addition.
  67. The `vendor/` update needs to be justified as part of the PR description,
  68. and must be verified by the reviewers and/or merger to always reference
  69. an existing upstream commit.
  70. ## Translation
  71. We do all translation work inside [Crowdin](https://crowdin.com/project/gitea).
  72. The only translation that is maintained in this git repository is
  73. [`en_US.ini`](https://github.com/go-gitea/gitea/blob/master/options/locale/locale_en-US.ini)
  74. and is synced regularily to Crowdin. Once a translation has reached
  75. A SATISFACTORY PERCENTAGE it will be synced back into this repo and
  76. included in the next released version.
  77. ## Code review
  78. Changes to Gitea must be reviewed before they are accepted, no matter who
  79. makes the change even if it is an owner or a maintainer. We use GitHub's
  80. pull request workflow to do that and we also use [LGTM](http://lgtm.co)
  81. to ensure every PR is reviewed by at least 2 maintainers.
  82. Please try to make your pull request easy to review for us.
  83. Please read the [How to get faster PR reviews](https://github.com/kubernetes/community/blob/master/contributors/devel/faster_reviews.md) guide,
  84. it has lots of useful tips for any project you may want to contribute.
  85. Some of the key points:
  86. * Make small pull requests. The smaller, the faster to review and the
  87. more likely it will be merged soon.
  88. * Don't make changes unrelated to your PR. Maybe there are typos on
  89. some comments, maybe refactoring would be welcome on a function... but
  90. if that is not related to your PR, please make *another* PR for that.
  91. * Split big pull requests into multiple small ones. An incremental change
  92. will be faster to review than a huge PR.
  93. ## Styleguide
  94. For imports you should use the following format (_without_ the comments)
  95. ```go
  96. import (
  97. // stdlib
  98. "encoding/json"
  99. "fmt"
  100. // local packages
  101. "code.gitea.io/gitea/models"
  102. "code.gitea.io/sdk/gitea"
  103. // external packages
  104. "github.com/foo/bar"
  105. "gopkg.io/baz.v1"
  106. )
  107. ```
  108. ## Sign your work
  109. The sign-off is a simple line at the end of the explanation for the
  110. patch. Your signature certifies that you wrote the patch or otherwise
  111. have the right to pass it on as an open-source patch. The rules are
  112. pretty simple: If you can certify [DCO](DCO), then you just add a line
  113. to every git commit message:
  114. ```
  115. Signed-off-by: Joe Smith <joe.smith@email.com>
  116. ```
  117. Please use your real name, we really dislike pseudonyms or anonymous
  118. contributions. We are in the open-source world without secrets. If you
  119. set your `user.name` and `user.email` git configs, you can sign your
  120. commit automatically with `git commit -s`.
  121. ## Release Cycle
  122. We adopted a release schedule to streamline the process of working
  123. on, finishing, and issuing releases. The overall goal is to make a
  124. minor release every two months, which breaks down into one month of
  125. general development followed by one month of testing and polishing
  126. known as the release freeze. All the feature pull requests should be
  127. merged in the first month of one release period and during the frozen
  128. period a corresponding release branch is open for fix backported from
  129. master. Release candidate are made along this period for user testing to
  130. obtain a final version that is maintained in this branch. A release is
  131. maintained by issuing patch releases to only correct critical problems
  132. such as crashes or security issues.
  133. The current release cycle is aligned to start on December 25 to February
  134. 24, next is February 25 to April 24, and etc. On this cycle, we also
  135. maybe publish the previous release minor version. For example, the
  136. current release version is v1.1, but we maybe also publish v1.0.2. When
  137. we publish v1.2, then we will stop publish v1.0.3.
  138. ## Maintainers
  139. To make sure every PR is checked, we have [team
  140. maintainers](MAINTAINERS). Every PR **MUST** be reviewed by at least
  141. two maintainers (or owners) before it can get merged. A maintainer
  142. should be a contributor of Gitea (or Gogs) and contributed at least
  143. 4 accepted PRs. A contributor should apply as a maintainer in the
  144. [Discord](https://discord.gg/NsatcWJ) #develop channel. The owners
  145. or the team maintainers may invite the contributor. A maintainer
  146. should spend some time on code reviews. If a maintainer has no
  147. time to do that, they should apply to leave the maintainers team
  148. and we will give them the honor of being a member of the [advisors
  149. team](https://github.com/orgs/go-gitea/teams/advisors). Of course, if
  150. an advisor has time to code review, we will gladly welcome them back
  151. to the maintainers team. If a maintainer is inactive for more than 3
  152. months and forgets to leave the maintainers team, the owners may move
  153. him or her from the maintainers team to the advisors team.
  154. ## Owners
  155. Since Gitea is a pure community organization without any company support,
  156. to keep the development healthy we will elect three owners every year. All
  157. contributors may vote to elect up to three candidates, one of which will
  158. be the main owner, and the other two the assistant owners. When the new
  159. owners have been elected, the old owners will give up ownership to the
  160. newly elected owners. If an owner is unable to do so, the other owners
  161. will assist in ceding ownership to the newly elected owners.
  162. After the election, the new owners should proactively agree
  163. with our [CONTRIBUTING](CONTRIBUTING.md) requirements in the
  164. [Discord](https://discord.gg/NsatcWJ) #general channel. Below are the
  165. words to speak:
  166. ```
  167. I'm honored to having been elected an owner of Gitea, I agree with
  168. [CONTRIBUTING](CONTRIBUTING.md). I will spend part of my time on Gitea
  169. and lead the development of Gitea.
  170. ```
  171. To honor the past owners, here's the history of the owners and the time
  172. they served:
  173. * 2016-11-04 ~ 2017-12-31
  174. * [Lunny Xiao](https://github.com/lunny) <xiaolunwen@gmail.com>
  175. * [Thomas Boerger](https://github.com/tboerger) <thomas@webhippie.de>
  176. * [Kim Carlbäcker](https://github.com/bkcsoft) <kim.carlbacker@gmail.com>
  177. ## Versions
  178. Gitea has the `master` branch as a tip branch and has version branches
  179. such as `release/v0.9`. `release/v0.9` is a release branch and we will
  180. tag `v0.9.0` for binary download. If `v0.9.0` has bugs, we will accept
  181. pull requests on the `release/v0.9` branch and publish a `v0.9.1` tag,
  182. after bringing the bug fix also to the master branch.
  183. Since the `master` branch is a tip version, if you wish to use Gitea
  184. in production, please download the latest release tag version. All the
  185. branches will be protected via GitHub, all the PRs to every branch must
  186. be reviewed by two maintainers and must pass the automatic tests.
  187. ## Copyright
  188. Code that you contribute should use the standard copyright header:
  189. ```
  190. // Copyright 2017 The Gitea Authors. All rights reserved.
  191. // Use of this source code is governed by a MIT-style
  192. // license that can be found in the LICENSE file.
  193. ```
  194. Files in the repository contain copyright from the year they are added
  195. to the year they are last changed. If the copyright author is changed,
  196. just paste the header below the old one.