Skip to content

Commit

Permalink
add CONTRIBUTING.md (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaoz authored Apr 10, 2022
1 parent c7bec8b commit 8a50a86
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 5 deletions.
70 changes: 70 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Contribution Guide

Welcome and thank you for considering contributing to Gorse!

Reading and following these guidelines will help us make the contribution process easy and effective for everyone involved. It also communicates that you agree to respect the time of the developers managing and developing these open source projects. In return, we will reciprocate that respect by addressing your issue, assessing changes, and helping you finalize your pull requests.

* [Getting Started](#getting-started)
* [Setup Develop Environment](#setup-develop-environment)
* [Run Unit Tests](#run-unit-tests)
* [Getting Help](#getting-help)

## Getting Started

### Setup Develop Environment

These following installations are required:

- **Go** (>= 1.18): Since Go features from 1.18 are used in Gorse, the version of the compiler must be greater than 1.18. GoLand or Visual Studio Code is highly recommended as the IDE to develop Gorse.

- **Docker Compose**: Multiple databases are required for unit tests. It's convenient to manage databases on Docker Compose.

```bash
cd misc/database_test

docker-compose up -d
```

### Run Unit Tests

Most logics in Gorse are covered by unit tests. Run unit tests by the following command:

```bash
go test -v ./...
```

The default database URLs are directed to these databases in `misc/database_test/docker-compose.yml`. Test databases could be overrode by setting following environment variables:

| Environment Value | Default Value |
|---|---|
| `MYSQL_URI` | `mysql://root:password@tcp(127.0.0.1:3306)/` |
| `POSTGRES_URI` | `postgres://gorse:[email protected]/` |
| `MONGO_URI` | `mongodb://root:[email protected]:27017/` |
| `CLICKHOUSE_URI` | `clickhouse://127.0.0.1:8123/` |
| `REDIS_URI` | `redis://127.0.0.1:6379/` |

For example, use TiDB as a test database by:

```bash
MYSQL_URI=mysql://root:password@tcp(127.0.0.1:4000)/ go test -v ./...
```

## Your First Contribution

You can start by finding an existing issue with the [help wanted](https://github.com/zhenghaoz/gorse/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) label in the Gorse repository. These issues are well suited for new contributors. Issues can be claimed by publishing an `/assign` comment.

### Contribution Workflow

To contribute to the Gorse code base, please follow the workflow as defined in this section.

- Fork the repository to your own Github account
- Make commits and add test case if the change fixes a bug or adds new functionality.
- Run tests and make sure all the tests are passed.
- Push your changes to a topic branch in your fork of the repository.
- Submit a pull request.

This is a rough outline of what a contributor's workflow looks like. Thanks for your contributions!

## Getting Help

Join us in the [Discord](https://discord.gg/x6gAtNNkAE) and post your question in the `#developers` channel.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ In addition, the administrator can perform system monitoring, data import and ex
<img src="https://contrib.rocks/image?repo=zhenghaoz/gorse" />
</a>

Any contribution is appreciated: report a bug, give advice or create a pull request. For new contributors:

- Issues labeled ["help wanted"](https://github.com/zhenghaoz/gorse/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) is friendly to new contributors (claim one by publishing an `/assign` comment).
- Setup develop environment based on [Chapter 4: Developer's Guide](https://docs.gorse.io/chapter_4.html).
- Discuss with other developers on [Discord](https://discord.gg/x6gAtNNkAE).
Any contribution is appreciated: report a bug, give advice or create a pull request. Read [CONTRIBUTING.md](CONTRIBUTING.md) for more information.

## Acknowledgments

Expand Down
8 changes: 8 additions & 0 deletions server/bench_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ case $CACHE_ARG in
mongodb)
export BENCH_CACHE_STORE='mongodb://root:[email protected]:27017/'
;;
*)
echo "Unknown database $1"
exit 1
;;
esac

case $DATA_ARG in
Expand All @@ -48,6 +52,10 @@ case $DATA_ARG in
mongodb)
export BENCH_DATA_STORE='mongodb://root:[email protected]:27017/'
;;
*)
echo "Unknown database $1"
exit 1
;;
esac

echo cache: "$CACHE_ARG"
Expand Down

0 comments on commit 8a50a86

Please sign in to comment.