From 1099fdd351ac0c0eecaf4f2a558d26057e3682ae Mon Sep 17 00:00:00 2001 From: Anton Petruhin Date: Tue, 6 Feb 2024 18:56:39 +0300 Subject: [PATCH] contributing guide --- CONTRIBUTING.md | 36 ++++++++++++++++++++++++++++++++++++ Makefile | 29 +++++++++++++++++++++++++++++ README.md | 3 +++ 3 files changed, 68 insertions(+) create mode 100644 CONTRIBUTING.md create mode 100644 Makefile diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..06f3854 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,36 @@ +# Contributing + +Thank you for your interest in contributing to Coroot! +Below are some basic guidelines. + + +## Requirements +* Linux ≥v4.16 (amd64, arm64) +* Go v1.21 + + +## Running +```shell +sudo go run main.go +``` + +```shell +curl http://127.0.0.1:80/metrics +``` + +## Pull Request Checklist + +* Branch from the main branch and, if needed, rebase to the current main branch before submitting your pull request. If it doesn't merge cleanly with main you may be asked to rebase your changes. +* Commits should be as small as possible, while ensuring that each commit is correct independently (i.e., each commit should compile and pass tests). +* Add tests relevant to the fixed bug or new feature. +* Use `make lint` to run linters and ensure formatting is correct. +* Run the unit tests suite `make test`. + + +## eBPF + +If you are changing eBPF code, you need to generate the `ebpftracer/ebpf.go` file: +```shell +cd ebpftracer +make build +``` diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..13f279d --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +.PHONY: all +all: lint test + +.PHONY: test +test: go-test + +.PHONY: lint +lint: go-mod go-vet go-fmt go-imports + +.PHONY: go-mod +go-mod: + go mod tidy + +.PHONY: go-vet +go-vet: + go vet ./... + +.PHONY: go-fmt +go-fmt: + gofmt -w . + +.PHONY: go-imports +go-imports: + go install golang.org/x/tools/cmd/goimports@latest + goimports -w . + +.PHONY: go-test +go-test: + go test ./... diff --git a/README.md b/README.md index bdd9d4d..37012c8 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,9 @@ The best way to turn metrics to answers about app issues is to use [Coroot](http A live demo of Coroot is available at [community-demo.coroot.com](https://community-demo.coroot.com) +## Contributing +To start contributing, check out our [Contributing Guide](https://github.com/coroot/coroot-node-agent/blob/main/CONTRIBUTING.md). + ## License Coroot-node-agent is licensed under the [Apache License, Version 2.0](https://github.com/coroot/coroot-node-agent/blob/main/LICENSE).