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.

166 lines
7.5 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. # Contributing
  2. Thank you for considering making contributions to Tendermint and related repositories! Start by taking a look at the [coding repo](https://github.com/tendermint/coding) for overall information on repository workflow and standards.
  3. Please follow standard github best practices: fork the repo, branch from the tip of develop, make some commits, and submit a pull request to develop. See the [open issues](https://github.com/tendermint/tendermint/issues) for things we need help with!
  4. Before making a pull request, please open an issue describing the
  5. change you would like to make. If an issue for your change already exists,
  6. please comment on it that you will submit a pull request. Be sure to reference the issue in the opening
  7. comment of your pull request. If your change is substantial, you will be asked
  8. to write a more detailed design document in the form of an
  9. Architectural Decision Record (ie. see [here](./docs/architecture/)) before submitting code
  10. changes.
  11. Please make sure to use `gofmt` before every commit - the easiest way to do this is have your editor run it for you upon saving a file.
  12. ## Forking
  13. Please note that Go requires code to live under absolute paths, which complicates forking.
  14. While my fork lives at `https://github.com/ebuchman/tendermint`,
  15. the code should never exist at `$GOPATH/src/github.com/ebuchman/tendermint`.
  16. Instead, we use `git remote` to add the fork as a new remote for the original repo,
  17. `$GOPATH/src/github.com/tendermint/tendermint `, and do all the work there.
  18. For instance, to create a fork and work on a branch of it, I would:
  19. * Create the fork on github, using the fork button.
  20. * Go to the original repo checked out locally (i.e. `$GOPATH/src/github.com/tendermint/tendermint`)
  21. * `git remote rename origin upstream`
  22. * `git remote add origin git@github.com:ebuchman/basecoin.git`
  23. Now `origin` refers to my fork and `upstream` refers to the tendermint version.
  24. So I can `git push -u origin master` to update my fork, and make pull requests to tendermint from there.
  25. Of course, replace `ebuchman` with your git handle.
  26. To pull in updates from the origin repo, run
  27. * `git fetch upstream`
  28. * `git rebase upstream/master` (or whatever branch you want)
  29. Please don't make Pull Requests to `master`.
  30. ## Dependencies
  31. We use [go modules](https://github.com/golang/go/wiki/Modules) to manage dependencies.
  32. That said, the master branch of every Tendermint repository should just build
  33. with `go get`, which means they should be kept up-to-date with their
  34. dependencies so we can get away with telling people they can just `go get` our
  35. software.
  36. Since some dependencies are not under our control, a third party may break our
  37. build, in which case we can fall back on `go mod tidy`. Even for dependencies under our control, go helps us to
  38. keep multiple repos in sync as they evolve. Anything with an executable, such
  39. as apps, tools, and the core, should use dep.
  40. Run `go list -u -m all` to get a list of dependencies that may not be
  41. up-to-date.
  42. When updating dependencies, please only update the particular dependencies you
  43. need. Instead of running `go get -u=patch`, which will update anything,
  44. specify exactly the dependency you want to update, eg.
  45. `GO111MODULE=on go get -u github.com/tendermint/go-amino@master`.
  46. ## Vagrant
  47. If you are a [Vagrant](https://www.vagrantup.com/) user, you can get started
  48. hacking Tendermint with the commands below.
  49. NOTE: In case you installed Vagrant in 2017, you might need to run
  50. `vagrant box update` to upgrade to the latest `ubuntu/xenial64`.
  51. ```
  52. vagrant up
  53. vagrant ssh
  54. make test
  55. ```
  56. ## Changelog
  57. Every fix, improvement, feature, or breaking change should be made in a
  58. pull-request that includes an update to the `CHANGELOG_PENDING.md` file.
  59. Changelog entries should be formatted as follows:
  60. ```
  61. - [module] \#xxx Some description about the change (@contributor)
  62. ```
  63. Here, `module` is the part of the code that changed (typically a
  64. top-level Go package), `xxx` is the pull-request number, and `contributor`
  65. is the author/s of the change.
  66. It's also acceptable for `xxx` to refer to the relevent issue number, but pull-request
  67. numbers are preferred.
  68. Note this means pull-requests should be opened first so the changelog can then
  69. be updated with the pull-request's number.
  70. There is no need to include the full link, as this will be added
  71. automatically during release. But please include the backslash and pound, eg. `\#2313`.
  72. Changelog entries should be ordered alphabetically according to the
  73. `module`, and numerically according to the pull-request number.
  74. Changes with multiple classifications should be doubly included (eg. a bug fix
  75. that is also a breaking change should be recorded under both).
  76. Breaking changes are further subdivided according to the APIs/users they impact.
  77. Any change that effects multiple APIs/users should be recorded multiply - for
  78. instance, a change to the `Blockchain Protocol` that removes a field from the
  79. header should also be recorded under `CLI/RPC/Config` since the field will be
  80. removed from the header in rpc responses as well.
  81. ## Branching Model and Release
  82. We follow a variant of [git flow](http://nvie.com/posts/a-successful-git-branching-model/).
  83. This means that all pull-requests should be made against develop. Any merge to
  84. master constitutes a tagged release.
  85. Note all pull requests should be squash merged except for merging to master and
  86. merging master back to develop. This keeps the commit history clean and makes it
  87. easy to reference the pull request where a change was introduced.
  88. ### Development Procedure:
  89. - the latest state of development is on `develop`
  90. - `develop` must never fail `make test`
  91. - never --force onto `develop` (except when reverting a broken commit, which should seldom happen)
  92. - create a development branch either on github.com/tendermint/tendermint, or your fork (using `git remote add origin`)
  93. - make changes and update the `CHANGELOG_PENDING.md` to record your change
  94. - before submitting a pull request, run `git rebase` on top of the latest `develop`
  95. ### Pull Merge Procedure:
  96. - ensure pull branch is based on a recent develop
  97. - run `make test` to ensure that all tests pass
  98. - squash merge pull request
  99. - the `unstable` branch may be used to aggregate pull merges before fixing tests
  100. ### Release Procedure:
  101. - start on `develop`
  102. - run integration tests (see `test_integrations` in Makefile)
  103. - prepare release in a pull request against develop (to be squash merged):
  104. - copy `CHANGELOG_PENDING.md` to top of `CHANGELOG.md`
  105. - run `python ./scripts/linkify_changelog.py CHANGELOG.md` to add links for
  106. all issues
  107. - run `bash ./scripts/authors.sh` to get a list of authors since the latest
  108. release, and add the github aliases of external contributors to the top of
  109. the changelog. To lookup an alias from an email, try `bash
  110. ./scripts/authors.sh <email>`
  111. - reset the `CHANGELOG_PENDING.md`
  112. - bump versions
  113. - push latest develop with prepared release details to release/vX.X.X to run the extended integration tests on the CI
  114. - if necessary, make pull requests against release/vX.X.X and squash merge them
  115. - merge to master (don't squash merge!)
  116. - merge master back to develop (don't squash merge!)
  117. ### Hotfix Procedure:
  118. - follow the normal development and release procedure without any differences
  119. ## Testing
  120. All repos should be hooked up to [CircleCI](https://circleci.com/).
  121. If they have `.go` files in the root directory, they will be automatically
  122. tested by circle using `go test -v -race ./...`. If not, they will need a
  123. `circle.yml`. Ideally, every repo has a `Makefile` that defines `make test` and
  124. includes its continuous integration status using a badge in the `README.md`.