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.

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