2022-06-12 05:21:40 +00:00
# Contributing to Dragonfly DB
Thank you for your interest in Dragonfly DB.
Feel free to browse our [Discussions ](https://github.com/dragonflydb/dragonfly/discussions ) and [Issues ](https://github.com/dragonflydb/dragonfly/issues )
2022-10-31 15:45:48 +00:00
## Build from source
See [building from source ](./docs/build-from-source.md )
2023-10-04 11:11:10 +00:00
Please note that to build a development/debug version,
2022-10-31 15:45:48 +00:00
it's better to alter the configure and build steps above with:
```sh
./helio/blaze.sh # without '-release' flag. Creates build-dbg subfolder
cd build-dbg & & ninja dragonfly
2022-08-08 07:55:44 +00:00
```
2022-10-31 15:45:48 +00:00
## Before you make your changes
```sh
cd dragonfly # project root
2022-08-08 07:55:44 +00:00
2023-03-01 06:43:40 +00:00
# Make sure you have 'pre-commit' and 'clang-format' installed
2022-11-05 20:16:57 +00:00
pip install pre-commit clang-format
2022-08-08 07:55:44 +00:00
# IMPORTANT! Enable our pre-commit message hooks
# This will ensure your commits match our formatting requirements
2022-11-05 20:16:57 +00:00
pre-commit install
2022-08-08 07:55:44 +00:00
```
2022-11-05 20:16:57 +00:00
This step must be done on each machine you wish to develop and contribute from to activate the `commit-msg` and `commit` hooks client-side.
2022-08-08 07:55:44 +00:00
Once you have done these things, we look forward to adding your contributions and improvements to the Dragonfly DB project.
## Unit testing
2023-02-28 12:32:15 +00:00
2022-08-08 07:55:44 +00:00
```
2023-10-04 11:11:10 +00:00
# Build a specific test
2022-10-31 15:45:48 +00:00
cd build-dbg & & ninja [test_name]
# e.g cd build-dbg && ninja generic_family_test
2022-08-08 07:55:44 +00:00
# Run
./[test_name]
# e.g ./generic_family_test
```
2023-02-28 12:32:15 +00:00
## Rendering Helm golden files
A Golang golden test is included in the dragonfly helm chart. This test will render the chart and compare the output to a golden file. If the output has changed, the test will fail and the golden file will need to be updated. This can be done by running:
```bash
cd contrib/charts/dragonfly
go test -v ./... -update
```
2023-10-04 11:11:10 +00:00
This makes it easy to see the changes in the rendered output without having to manually run the `helm template` and diff the output.
2023-02-28 12:32:15 +00:00
2022-08-08 07:55:44 +00:00
## Signoff Commits
2023-02-28 12:32:15 +00:00
2022-06-12 05:21:40 +00:00
All community submissions must include a signoff.
```bash
git commit -s -m '...'
```
2022-08-08 07:55:44 +00:00
## Squash Commits
2023-02-28 12:32:15 +00:00
2022-06-12 05:21:40 +00:00
Please squash all commits for a change into a single commit (this can be done using "git rebase -i"). Do your best to have a well-formed commit message for the change.
2022-08-08 07:55:44 +00:00
## Use Conventional Commits
2022-06-12 05:21:40 +00:00
2023-02-28 12:32:15 +00:00
This repo uses [Conventional Commmits ](https://www.conventionalcommits.org/en/v1.0.0/ )
2022-06-12 05:21:40 +00:00
The Conventional Commits specification is a lightweight convention on top of commit messages.
It provides an easy set of rules for creating an explicit commit history;
which makes it easier to write automated tools on top of.
This convention dovetails with [SemVer ](http://semver.org ),
by describing the features, fixes, and breaking changes made in commit messages.
The commit message should be structured as follows:
---
```
< type > [optional scope]: < description >
[optional body]
[optional footer(s)]
```
2023-02-28 12:32:15 +00:00
2022-06-12 05:21:40 +00:00
---
2023-10-04 11:11:10 +00:00
This repo uses automated tools to standardize the formatting of code, text files, and commits.
2023-02-28 12:32:15 +00:00
- [Pre-commit hooks ](#pre-commit-hooks ) validate and automatically apply code
2022-06-12 05:21:40 +00:00
formatting rules.
2022-08-08 07:55:44 +00:00
## `pre-commit` hooks
2023-02-28 12:32:15 +00:00
2023-10-04 11:11:10 +00:00
The Dragonfly DB team has agreed to systematically use several pre-commit hooks to
normalize the formatting of code. You need to install and enable pre-commit to have these used
when you do your commits.
2022-06-12 05:21:40 +00:00
2023-06-25 09:37:12 +00:00
## Codebase guidelines
This repo conforms to the Google's C++ Style Guide. Keep in mind we use an older version of the
style guide which can be found [here ](https://github.com/google/styleguide/blob/505ba68c74eb97e6966f60907ce893001bedc706/cppguide.html ).
2023-10-04 11:11:10 +00:00
Any exceptions to the rules specified in the style guide will be documented here.
2023-06-25 09:37:12 +00:00
2022-06-12 05:21:40 +00:00
## License terms for contributions
2023-02-28 12:32:15 +00:00
2022-10-31 15:45:48 +00:00
Please see our [CLA agreement ](./CLA.txt )
2022-06-12 05:21:40 +00:00
2022-10-31 15:45:48 +00:00
## THANK YOU FOR YOUR CONTRIBUTIONS