CONTRIBUTING.md 3.7 KB
Newer Older
T
tanggen 已提交
1
# Overview
E
Erik Johnston 已提交
2

T
tanggen 已提交
3
Ligase is a community driven open source project and we welcome any contributor!
E
Erik Johnston 已提交
4

T
tanggen 已提交
5
If you think something should be changed or added, please open an issue to discuss the change. You can open a PR if you want to be explicit about the change, but the change may need extensive discussion and possibly revision before it is accepted.
6

T
tanggen 已提交
7
Feedback is welcome, feel free to open issue for any problem
8

T
tanggen 已提交
9
# Development Environment
10

T
tanggen 已提交
11
[How to Write Go Code](http://golang.org/doc/code.html)
12

T
tanggen 已提交
13
Ligase use [`Go Modules`](https://github.com/golang/go/wiki/Modules) to manage dependencies
14

T
tanggen 已提交
15
The version of GO should be **1.13** or above
E
Erik Johnston 已提交
16

T
tanggen 已提交
17
# Style Guide
E
Erik Johnston 已提交
18

T
tanggen 已提交
19
Working with our source code involves some famous rules:
E
Erik Johnston 已提交
20

T
tanggen 已提交
21
[Effective GO](https://golang.org/doc/effective_go.html)
E
Erik Johnston 已提交
22

T
tanggen 已提交
23
[Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments)
E
Erik Johnston 已提交
24

T
tanggen 已提交
25
# Workflow
E
Erik Johnston 已提交
26

T
tanggen 已提交
27
## step 1: Fork in the cloud
E
Erik Johnston 已提交
28

T
tanggen 已提交
29 30
1. Visit https://github.com/finogeeks/ligase
2. On the top right of the page, click the `Fork` button (top right) to create a cloud-based fork of the repository.
E
Erik Johnston 已提交
31

T
tanggen 已提交
32
## step 2: Clone fork to local storage
E
Erik Johnston 已提交
33

T
tanggen 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
```sh
mkdir -p $working_dir
cd $working_dir
git clone https://github.com/$user/ligase.git
# or: git clone git@github.com:$user/ligase.git

cd $working_dir/ligase
git remote add upstream https://github.com/finogeeks/ligase.git
# or: git remote add upstream git@github.com:finogeeks/ligase.git

# Never push to the upstream master.
git remote set-url --push upstream no_push

# Confirm that your remotes make sense:
# It should look like:
# origin    git@github.com:$(user)/ligase.git (fetch)
# origin    git@github.com:$(user)/ligase.git (push)
# upstream  https://github.com/finogeeks/ligase (fetch)
# upstream  no_push (push)
git remote -v
```

## step 3: Branch

```sh
cd $working_dir/ligase
git fetch upstream

# Base your changes on the develop branch.
git checkout -b develop
git rebase upstream/develop
```

Branch from develop:

```sh
git checkout -b myfeature
```

## Step 4: Develop
### Edit the code

You can now edit the code on the `myfeature` branch.

### Build && Run Ligase
```sh
# start up the dependency services
docker-compose up -d

# build
./build.sh

# run the server
./run.sh

```
### Test

```sh

# build and run the unit test to make sure all tests are passed.
make test

# Check the checklist (gofmt -> golint)
make checklist

```

## Step 5: Keep your branch in sync

```sh
# While on your myfeature branch.
git fetch upstream
git rebase upstream/develop
```

Please don't use `git pull` instead of the above `fetch`/`rebase`. `git pull`
does a merge, which leaves merge commits. These make the commit history messy
and violate the principle that commits ought to be individually understandable
and useful (see below). You can also consider changing your `.git/config` file
via `git config branch.autoSetupRebase` always to change the behavior of `git pull`.

## Step 6: Commit

Commit your changes.

```sh
git commit
```

Likely you'll go back and edit/build/test further, and then `commit --amend` in a
few cycles.

## Step 7: Push

When the changes are ready to review (or you just to create an offsite backup
or your work), push your branch to your fork on `github.com`:

```sh
git push --set-upstream ${your_remote_name} myfeature
```

## Step 8: Create a pull request

1. Visit your fork at `https://github.com/$user/ligase`.
2. Click the `Compare & Pull Request` button next to your `myfeature` branch.
3. Fill in the required information in the PR template.

### Get a code review

If your pull request (PR) is opened, it will be assigned to one or more
reviewers. Those reviewers will do a thorough code review, looking at
correctness, bugs, opportunities for improvement, documentation and comments,
and style.

To address review comments, you should commit the changes to the same branch of
the PR on your fork