github.com/pingcap/tidb-lightning@v5.0.0-rc.0.20210428090220-84b649866577+incompatible/CONTRIBUTING.md (about) 1 # How to contribute 2 3 This document outlines some of the conventions on development workflow, commit 4 message formatting, contact points and other resources to make it easier to get 5 your contribution accepted. 6 7 ## Getting started 8 9 - Fork the repository on GitHub. 10 - Read the README.md for build instructions. 11 - Play with the project, submit bugs, submit patches! 12 13 ## Building TiDB-Lightning 14 15 Developing TiDB-Lightning requires: 16 17 * [Go 1.13.5+](http://golang.org/doc/code.html) 18 * An internet connection to download the dependencies 19 20 Simply run `make` to build the program. 21 22 ```sh 23 make 24 ``` 25 26 ### Running tests 27 28 This project contains unit tests and integration tests with coverage collection. 29 See [tests/README.md](./tests/README.md) for how to execute and add tests. 30 31 ### Updating generated code 32 33 TiDB-Lightning contains some generated source code for parsing. To modify them, 34 you also need to install: 35 36 * [Ragel 6.10+](https://www.colm.net/open-source/ragel/) 37 * [protoc 3.6+](https://github.com/protocolbuffers/protobuf/releases) 38 * [protoc-gen-gogofaster 1.2+](https://github.com/gogo/protobuf#more-speed-and-more-generated-code) 39 40 Run `make data_parsers` to regenerate these source code. 41 42 ### Updating dependencies 43 44 TiDB-Lightning manages dependencies using [Go 1.11 module](https://github.com/golang/go/wiki/Modules). 45 To add or update a dependency, either 46 47 * Use the `go mod edit` command to change the dependency, or 48 * Edit `go.mod` and then run `make update` to update the checksum. 49 50 ## Contribution flow 51 52 This is a rough outline of what a contributor's workflow looks like: 53 54 - Create a topic branch from where you want to base your work. This is usually `master`. 55 - Make commits of logical units and add test case if the change fixes a bug or adds new functionality. 56 - Run tests and make sure all the tests are passed. 57 - Make sure your commit messages are in the proper format (see below). 58 - Push your changes to a topic branch in your fork of the repository. 59 - Submit a pull request. 60 - Your PR must receive LGTMs from two maintainers. 61 62 Thanks for your contributions! 63 64 ### Code style 65 66 The coding style suggested by the Golang community is used in TiDB-Lightning. 67 See the [style doc](https://github.com/golang/go/wiki/CodeReviewComments) for details. 68 69 Please follow this style to make TiDB-Lightning easy to review, maintain and develop. 70 71 ### Format of the Commit Message 72 73 We follow a rough convention for commit messages that is designed to answer two 74 questions: what changed and why. The subject line should feature the what and 75 the body of the commit should describe the why. 76 77 ``` 78 restore: add comment for variable declaration 79 80 Improve documentation. 81 ``` 82 83 The format can be described more formally as follows: 84 85 ``` 86 <subsystem>: <what changed> 87 <BLANK LINE> 88 <why this change was made> 89 <BLANK LINE> 90 <footer>(optional) 91 ``` 92 93 The first line is the subject and should be no longer than 70 characters, the 94 second line is always blank, and other lines should be wrapped at 80 characters. 95 This allows the message to be easier to read on GitHub as well as in various 96 git tools. 97 98 If the change affects more than one subsystem, you can use comma to separate them like `restore,mydump:`. 99 100 If the change affects many subsystems, you can use ```*``` instead, like ```*:```. 101 102 For the why part, if no specific reason for the change, 103 you can use one of some generic reasons like "Improve documentation.", 104 "Improve performance.", "Improve robustness.", "Improve test coverage." 105 106 ## Related projects 107 108 This repository is one of the many components forming the whole TiDB-Lightning 109 Toolset. 110 111 The source code of `tikv-importer` can be found in the TiKV project: 112 <https://github.com/tikv/tikv/tree/master/src/import/> 113 114 The SQL→KV encoder is part of the TiDB project: 115 <https://github.com/pingcap/tidb> 116 117 The gRPC interface between `tidb-lightning` and `tikv-importer` is found in the 118 `kvproto` repository: <https://github.com/pingcap/kvproto>