2020-07-09 15:35:15 +03:00
|
|
|
# Contribution Guide
|
|
|
|
|
|
2025-02-05 17:00:32 -05:00
|
|
|
- [Before you get started](#before-you-get-started)
|
|
|
|
|
- [Code of Conduct](#code-of-conduct)
|
|
|
|
|
- [Your First Contribution](#your-first-contribution)
|
|
|
|
|
- [Find a good first topic](#find-a-good-first-topic)
|
|
|
|
|
- [Setting up your development environment](#setting-up-your-development-environment)
|
|
|
|
|
- [Fork the project](#fork-the-project)
|
|
|
|
|
- [Clone the project](#clone-the-project)
|
|
|
|
|
- [New branch for a new code](#new-branch-for-a-new-code)
|
|
|
|
|
- [Test](#test)
|
|
|
|
|
- [Commit and push](#commit-and-push)
|
|
|
|
|
- [Create a Pull Request](#create-a-pull-request)
|
|
|
|
|
- [Sign the CLA](#sign-the-cla)
|
|
|
|
|
- [Get a code review](#get-a-code-review)
|
2020-07-09 15:35:15 +03:00
|
|
|
|
|
|
|
|
## Before you get started
|
|
|
|
|
|
|
|
|
|
### Code of Conduct
|
|
|
|
|
|
|
|
|
|
Please make sure to read and observe our [Code of Conduct](./CODE_OF_CONDUCT.md).
|
|
|
|
|
|
|
|
|
|
## Your First Contribution
|
|
|
|
|
|
|
|
|
|
### Find a good first topic
|
|
|
|
|
|
|
|
|
|
You can start by finding an existing issue with the
|
2025-12-10 17:11:18 -05:00
|
|
|
[good first issue](https://github.com/dgraph-io/badger/labels/good%20first%20issue) or
|
|
|
|
|
[help wanted](https://github.com/dgraph-io/badger/labels/help%20wanted) labels. These issues are
|
2025-02-05 17:00:32 -05:00
|
|
|
well suited for new contributors.
|
2020-07-09 15:35:15 +03:00
|
|
|
|
|
|
|
|
## Setting up your development environment
|
|
|
|
|
|
2025-12-16 15:02:15 -05:00
|
|
|
- [Install Go 1.25.0 or above](https://golang.org/doc/install).
|
|
|
|
|
- Install
|
|
|
|
|
[trunk](https://docs.trunk.io/code-quality/overview/getting-started/install#install-the-launcher).
|
|
|
|
|
Our CI uses trunk to lint and check code, having it installed locally will save you time.
|
2020-07-09 15:35:15 +03:00
|
|
|
|
|
|
|
|
### Fork the project
|
|
|
|
|
|
2025-12-10 17:11:18 -05:00
|
|
|
- Visit https://github.com/dgraph-io/badger
|
2020-07-09 15:35:15 +03:00
|
|
|
- Click the `Fork` button (top right) to create a fork of the repository
|
|
|
|
|
|
|
|
|
|
### Clone the project
|
|
|
|
|
|
|
|
|
|
```sh
|
2025-02-05 17:00:32 -05:00
|
|
|
git clone https://github.com/$GITHUB_USER/badger
|
|
|
|
|
cd badger
|
2025-12-10 17:11:18 -05:00
|
|
|
git remote add upstream git@github.com:dgraph-io/badger.git
|
2020-07-09 15:35:15 +03:00
|
|
|
|
|
|
|
|
# Never push to the upstream master
|
|
|
|
|
git remote set-url --push upstream no_push
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### New branch for a new code
|
|
|
|
|
|
|
|
|
|
Get your local master up to date:
|
|
|
|
|
|
|
|
|
|
```sh
|
2025-02-05 17:00:32 -05:00
|
|
|
git fetch upstream
|
|
|
|
|
git checkout master
|
|
|
|
|
git rebase upstream/master
|
2020-07-09 15:35:15 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Create a new branch from the master:
|
|
|
|
|
|
|
|
|
|
```sh
|
2025-02-05 17:00:32 -05:00
|
|
|
git checkout -b my_new_feature
|
2020-07-09 15:35:15 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
And now you can finally add your changes to project.
|
|
|
|
|
|
|
|
|
|
### Test
|
|
|
|
|
|
|
|
|
|
Build and run all tests:
|
|
|
|
|
|
|
|
|
|
```sh
|
2025-02-05 17:00:32 -05:00
|
|
|
./test.sh
|
2020-07-09 15:35:15 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Commit and push
|
|
|
|
|
|
|
|
|
|
Commit your changes:
|
|
|
|
|
|
|
|
|
|
```sh
|
2025-02-05 17:00:32 -05:00
|
|
|
git commit
|
2020-07-09 15:35:15 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
When the changes are ready to review:
|
|
|
|
|
|
|
|
|
|
```sh
|
2025-02-05 17:00:32 -05:00
|
|
|
git push origin my_new_feature
|
2020-07-09 15:35:15 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Create a Pull Request
|
|
|
|
|
|
2025-02-05 17:00:32 -05:00
|
|
|
Just open `https://github.com/$GITHUB_USER/badger/pull/new/my_new_feature` and fill the PR
|
|
|
|
|
description.
|
2020-07-09 15:35:15 +03:00
|
|
|
|
|
|
|
|
### Sign the CLA
|
|
|
|
|
|
2025-02-05 17:00:32 -05:00
|
|
|
Click the **Sign in with Github to agree** button to sign the CLA.
|
2025-12-10 17:11:18 -05:00
|
|
|
[An example](https://cla-assistant.io/dgraph-io/badger?pullRequest=1377).
|
2020-07-09 15:35:15 +03:00
|
|
|
|
|
|
|
|
### Get a code review
|
|
|
|
|
|
2025-02-05 17:00:32 -05:00
|
|
|
If your pull request (PR) is opened, it will be assigned to one or more reviewers. Those reviewers
|
|
|
|
|
will do a code review.
|
2020-07-09 15:35:15 +03:00
|
|
|
|
2025-02-05 17:00:32 -05:00
|
|
|
To address review comments, you should commit the changes to the same branch of the PR on your fork.
|