Semaphore/CONTRIBUTING.md

72 lines
2.2 KiB
Markdown
Raw Normal View History

2016-04-29 15:58:17 +02:00
# Pull Requests
When creating a pull-request you should:
- __Open an issue first:__ Confirm that the change or feature will be accepted
- __gofmt and vet the code:__ Use `gofmt`, `golint`, `govet` and `goimports` to clean up your code.
2018-03-11 15:22:50 +01:00
- __vendor dependencies with dep:__ Use `dep ensure --update` if you have added to or updated dependencies, so that they get added to the dependency manifest.
- __Update api documentation:__ If your pull-request adding/modifying an API request, make sure you update the swagger documentation (`api-docs.yml`)
2016-04-29 15:58:17 +02:00
# Installation in a development environment
2017-05-20 16:32:03 +02:00
- Check out the `develop` branch
2018-03-14 20:26:52 +01:00
- [Install Go](https://golang.org/doc/install). Go must be >= v1.10 for all the tools we use to work
- Install MySQL / MariaDB
- Install node.js
2016-04-29 15:58:17 +02:00
1) Set up GOPATH, GOBIN and Workspace.
```
2017-03-08 16:28:55 +01:00
cd {WORKING_DIRECTORY}
# Exports only needed pre Go 1.8 or for custom GOPATH location
2017-03-08 16:28:55 +01:00
export GOPATH=`pwd`
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
mkdir -p $GOPATH/src/github.com/ansible-semaphore && cd $GOPATH/src/github.com/ansible-semaphore
```
2) Clone semaphore (with submodules)
```
git clone --recursive git@github.com:ansible-semaphore/semaphore.git && cd semaphore
```
2016-04-30 09:52:33 +02:00
3) Install dev dependencies
```
go get ./...
go get -u github.com/go-task/task/cmd/task
task deps
2016-04-29 15:58:17 +02:00
```
4) Set up config, database & run migrations
2016-04-29 15:58:17 +02:00
```
cat <<EOT >> config.json
{
"mysql": {
"host": "127.0.0.1:3306",
"user": "root",
"pass": "",
"name": "semaphore"
},
"port": ":3000"
}
EOT
echo "create database semaphore;" | mysql -uroot -p
task compile
go run cli/main.go -config ./config.json -migrate
```
Now it's ready to start.. Run `task watch`
- Watches js files in `public/js/*` and compiles into a bundle
- Watches css files in `public/css/*` and compiles into css code
- Watches pug files in `public/html/*` and compiles them into html
- Watches go files and recompiles the binary
- Open [localhost:3000](http://localhost:3000)
Note: for Windows, you may need [Cygwin](https://www.cygwin.com/) to run certain commands because the [reflex](github.com/cespare/reflex) package probably doesn't work on Windows.
You may encounter issues when running `task watch`, but running `task build` etc... will still be OK.