Thanks for your interest in contributing covergates. Before you start, please read this document. It will help you set yourself up with a good development environment.
First, please read and sign the Electronic Covergates Contribution License Agreement. By signing a contributor license agreement, it is ensured that the community is free to use your contribution.
Please let everyone knows what you are working on by creating a issue. This process prevents duplication of effort, and ensure that the idea is discussed and fits the project goal.
To get starting, it assumes a certain level of comfort with Go
,
Vue
, typescript
and Docker
. To get some helps, you could refer to below links:
The project also uses google/wire for dependency injection. You may refer to Wire Tutorial for more detail.
Fork the repository so that you can make a pull request. Then clone your fork by:
git clone https://github.com/<<<your-github-account>>>/covergates.git
cd covergates
Create a new branch for your change. Manage any merge conflicts, commit them, and then push them to your fork. It is suggested to have one feature or bug-fix per branch.
Covergates requires to connect with SCM to work. Although you could connect it with GiHub, it is suggested setting a self-hosted SCM for testing. It's recommended to choose Gitea. You can refer to Installation with Docker for the detail. You can also setup Gitea by running our container for testing:
docker run -d -p 3000:3000 blueworrybear/gitea-docker
Visit http://localhost:3000 to see if it works. The admin user and password is gitea
and gitea
.
To test your changes, run:
# If using blueworrybear/gitea-docker container
export GATES_GITEA_CLIENT_ID="c8c6a2cc-f948-475c-8663-f420c8fc15ab"
export GATES_GITEA_CLIENT_SECRET="J8YYirhYOZY9a9RepaoORN-8EFcSO-sbwjSGvGo4NwE="
export GATES_GITEA_SERVER="http://localhost:3000"
export GATES_GITEA_SKIP_VERITY="true"
go run ./cmd/server
Visit http://localhost:8080 for the covergates
server.
If yor are using VS code
as your IDE, you could setup the launch.json
as blow and press F5
to debug:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/server",
"env": {
"DEBUG": "true",
"DEBUG_LOGIN": "gitea",
"DEBUG_EMAIL": "gitea@gmail.com",
"DEBUG_AVATAR": "http://localhost:3000/user/avatar/gitea/-1",
"DEBUG_GITEA_TOKEN": "1749a6106454f05f689051c331680c13d78d81b7",
"DEBUG_GITEA_LOGIN": "gitea",
"GATES_GITEA_CLIENT_ID": "c8c6a2cc-f948-475c-8663-f420c8fc15ab",
"GATES_GITEA_CLIENT_SECRET": "J8YYirhYOZY9a9RepaoORN-8EFcSO-sbwjSGvGo4NwE=",
"GATES_GITEA_SERVER": "http://localhost:3000",
"GATES_GITEA_SKIP_VERITY": "true"
},
"buildFlags": "-tags='debug'"
}
]
}
If you would like to change frontend, you may need to change backend server to run on different port by:
export DEBUG="true"
export DEBUG_LOGIN="gitea"
export DEBUG_EMAIL="gitea@gmail.com"
export DEBUG_AVATAR="http://localhost:3000/user/avatar/gitea/-1"
export DEBUG_GITEA_TOKEN="1749a6106454f05f689051c331680c13d78d81b7"
export DEBUG_GITEA_LOGIN="gitea"
export GATES_GITEA_CLIENT_ID="c8c6a2cc-f948-475c-8663-f420c8fc15ab"
export GATES_GITEA_CLIENT_SECRET="J8YYirhYOZY9a9RepaoORN-8EFcSO-sbwjSGvGo4NwE="
export GATES_GITEA_SERVER="http://localhost:5900"
export GATES_GITEA_SKIP_VERITY="true"
go run ./cmd/server
The DEBUG environment variables is required to keep you login to covergates.
And then run:
cd web
npm install
npm run server
It will start a server at http://localhost:8080.
You could also modify backend proxy by editing VUE_APP_PROXY
at web/.env.development
.
To test backend, simply run:
go test ./...
or testing with Gitea:
go test -tags="gitea" ./...
To test frontend, run:
cd web
npm run test:unit
To build backend, run:
go build -o covergates-server ./cmd/server
To build CLI, run:
go build -o covergates ./cmd/cli
To build frontend, you require installing togo
by running below command outside go module folder:
go get github.com/bradrydzewski/togo
And then run:
go generate ./web
Please make sure your code pass both golint
and eslint
by run:
golint ./...
cd web
npm run lint
You have to sign your commit before we can accept a pull request from you. Please refer to Signing commits for the detail. You could also refer to GitHub flow to learn how to properly create a pull request.
The project owners may recommend adjustment to your code. Don's get discourage! Any suggestion means that we care about your work! We just hope your work meets the project goal and could shine over decades.
At last, thank you for contributing to the covergates open source project!