Contributions to Milvus are welcome from everyone. We strive to make the contribution process simple and straightforward. Up-to-date information can be found at milvus.io.
The following are a set of guidelines for contributing to Milvus. Following these guidelines makes contributing to this project easy and transparent. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
As for everything else in the project, the contributions to Milvus are governed by our Code of Conduct.
Contributions to Milvus fall into the following categories.
- To report a bug or a problem with documentation, please file an issue providing the details of the problem. If you believe that the issue needs priority attention, please comment on the issue to notify the team.
- To propose a new feature, please file a new feature request issue. Describe the intended feature and discuss the design and implementation with the team and community. Once the team agrees on the plan, you can follow the Contributing code to implement it.
- To implement a feature or bug-fix for an existing outstanding issue, follow the Contributing code. If you need more context on a particular issue, comment on the issue to let people know.
If you have improvements to Milvus, send us your pull requests! For those just getting started, see GitHub workflow. Make sure to refer to the related issue in the ccomment of your pull request and update CHANGELOG.md.
All submissions will be reviewed as quickly as possible. Once it is accepted, the status of the project to which it is associated will be changed to Reviewer approved. This means we are working on submitting your pull request to the internal repository. After the change has been submitted internally, your pull request will be merged automatically on GitHub.
Generally, we follow the "fork-and-pull" Git workflow.
- Fork the repository on GitHub.
- Clone your fork to your local machine with
git clone git@github.com:<yourname>/milvus.git
. - Create a branch with
git checkout -b my-topic-branch
. - Commit changes to your own branch, then push to to GitHub with
git push --set-upstream origin my-topic-branch
. You must record your changes in CHANGELOG.md with issue numbers and descriptions. - Submit a pull request so that we can review your changes.
Remember to sync your forked repository before submitting proposed changes upstream. If you have an existing local repository, please update it before you start, to minimize the chance of merge conflicts.
git remote add upstream git@github.com:milvus-io/milvus.git
git checkout master
git pull upstream master
git checkout -b my-topic-branch
Before submitting your pull requests for review, make sure that your changes are consistent with the coding style, and run unit tests to check your code coverage rate.
- Include unit tests when you contribute new features, as they help to prove that your code works correctly, and also guard against future breaking changes to lower the maintenance cost.
- Bug fixes also require unit tests, because the presence of bugs usually indicates insufficient test coverage.
- Keep API compatibility in mind when you change code in Milvus. Reviewers of your pull request will comment on any API compatibility issues.
- When you contribute a new feature to Milvus, the maintenance burden is (by default) transferred to the Milvus team. This means that the benefit of the contribution must be compared against the cost of maintaining the feature.
All contributions to this project must be accompanied by acknowledgment of, and agreement to, the Developer Certificate of Origin. Acknowledgment of and agreement to the Developer Certificate of Origin must be included in the comment section of each contribution and must take the form of Signed-off-by: {{Full Name}} <{{email address}}>
(without the {}
). Contributions without this acknowledgment will be required to add it before being accepted. If contributors are unable or unwilling to agree to the Developer Certificate of Origin, their contribution will not be included.
Contributors sign-off that they adhere to DCO by adding the following Signed-off-by line to commit messages:
This is my commit message
Signed-off-by: Random J Developer <random@developer.example.org>
Git also has a -s
command line option to append this automatically to your commit message:
$ git commit -s -m 'This is my commit message'
The coding style used in Milvus generally follow Google C++ Style Guide. And we made the following changes based on the guide:
- 4 spaces for indentation
- Adopt .cpp file extension instead of .cc extension
- 120-character line length
- Camel-Cased file names
Install clang-format
$ sudo apt-get install clang-format
$ rm cmake_build/CMakeCache.txt
Check code style
$ ./build.sh -l
To format the code
$ cd cmake_build
$ make clang-format
Before submitting your Pull Request, make sure you have run unit test, and your code coverage rate is >= 90%.
Install lcov
$ sudo apt-get install lcov
Run unit test and generate code for code coverage check
$ ./build.sh -u -c
Run MySQL docker
docker pull mysql:latest
docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:latest
Run code coverage
$ ./coverage.sh -u root -p 123456 -t 127.0.0.1
Or start your own MySQL server, and then run code coverage
$ ./coverage.sh -u ${MYSQL_USERNAME} -p ${MYSQL_PASSWORD} -t ${MYSQL_SERVER_IP}