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.

117 lines
4.9 KiB

  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. 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.
  5. ## Forking
  6. Please note that Go requires code to live under absolute paths, which complicates forking.
  7. While my fork lives at `https://github.com/ebuchman/tendermint`,
  8. the code should never exist at `$GOPATH/src/github.com/ebuchman/tendermint`.
  9. Instead, we use `git remote` to add the fork as a new remote for the original repo,
  10. `$GOPATH/src/github.com/tendermint/tendermint `, and do all the work there.
  11. For instance, to create a fork and work on a branch of it, I would:
  12. * Create the fork on github, using the fork button.
  13. * Go to the original repo checked out locally (ie. `$GOPATH/src/github.com/tendermint/tendermint`)
  14. * `git remote rename origin upstream`
  15. * `git remote add origin git@github.com:ebuchman/basecoin.git`
  16. Now `origin` refers to my fork and `upstream` refers to the tendermint version.
  17. So I can `git push -u origin master` to update my fork, and make pull requests to tendermint from there.
  18. Of course, replace `ebuchman` with your git handle.
  19. To pull in updates from the origin repo, run
  20. * `git fetch upstream`
  21. * `git rebase upstream/master` (or whatever branch you want)
  22. Please don't make Pull Requests to `master`.
  23. ## Dependencies
  24. We use [dep](https://github.com/golang/dep) to manage dependencies.
  25. That said, the master branch of every Tendermint repository should just build
  26. with `go get`, which means they should be kept up-to-date with their
  27. dependencies so we can get away with telling people they can just `go get` our
  28. software.
  29. Since some dependencies are not under our control, a third party may break our
  30. build, in which case we can fall back on `dep ensure` (or `make
  31. get_vendor_deps`). Even for dependencies under our control, dep helps us to
  32. keep multiple repos in sync as they evolve. Anything with an executable, such
  33. as apps, tools, and the core, should use dep.
  34. Run `dep status` to get a list of vendored dependencies that may not be
  35. up-to-date.
  36. ## Vagrant
  37. If you are a [Vagrant](https://www.vagrantup.com/) user, you can get started
  38. hacking Tendermint with the commands below.
  39. NOTE: In case you installed Vagrant in 2017, you might need to run
  40. `vagrant box update` to upgrade to the latest `ubuntu/xenial64`.
  41. ```
  42. vagrant up
  43. vagrant ssh
  44. make test
  45. ```
  46. ## Testing
  47. All repos should be hooked up to [CircleCI](https://circleci.com/).
  48. If they have `.go` files in the root directory, they will be automatically
  49. tested by circle using `go test -v -race ./...`. If not, they will need a
  50. `circle.yml`. Ideally, every repo has a `Makefile` that defines `make test` and
  51. includes its continuous integration status using a badge in the `README.md`.
  52. ## Branching Model and Release
  53. User-facing repos should adhere to the branching model: http://nvie.com/posts/a-successful-git-branching-model/.
  54. That is, these repos should be well versioned, and any merge to master requires a version bump and tagged release.
  55. Libraries need not follow the model strictly, but would be wise to,
  56. especially `go-p2p` and `go-rpc`, as their versions are referenced in tendermint core.
  57. ### Development Procedure:
  58. - the latest state of development is on `develop`
  59. - `develop` must never fail `make test`
  60. - no --force onto `develop` (except when reverting a broken commit, which should seldom happen)
  61. - create a development branch either on github.com/tendermint/tendermint, or your fork (using `git add origin`)
  62. - before submitting a pull request, begin `git rebase` on top of `develop`
  63. ### Pull Merge Procedure:
  64. - ensure pull branch is rebased on develop
  65. - run `make test` to ensure that all tests pass
  66. - merge pull request
  67. - the `unstable` branch may be used to aggregate pull merges before testing once
  68. - push master may request that pull requests be rebased on top of `unstable`
  69. ### Release Procedure:
  70. - start on `develop`
  71. - run integration tests (see `test_integrations` in Makefile)
  72. - prepare changelog/release issue
  73. - bump versions
  74. - push to release-vX.X.X to run the extended integration tests on the CI
  75. - merge to master
  76. - merge master back to develop
  77. ### Hotfix Procedure:
  78. - start on `master`
  79. - checkout a new branch named hotfix-vX.X.X
  80. - make the required changes
  81. - these changes should be small and an absolute necessity
  82. - add a note to CHANGELOG.md
  83. - bumb versions
  84. - push to hotfix-vX.X.X to run the extended integration tests on the CI
  85. - merge hotfix-vX.X.X to master
  86. - merge hotfix-vX.X.X to develop
  87. - delete the hotfix-vX.X.X branch