diff --git a/Makefile b/Makefile index cc2ed07..3c5e74f 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,39 @@ DOCKER := $(shell which docker) DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf:1.28.1 +PROJECTNAME=$(shell basename "$(PWD)") -## proto-gen-docker: Generate protobuf files. Requires docker. +## help: Get more info on make commands. +help: Makefile + @echo " Choose a command run in "$(PROJECTNAME)":" + @sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /' +.PHONY: help + +## proto-gen: Generate protobuf files. Requires docker. proto-gen: @echo "--> Generating Protobuf files" $(DOCKER_BUF) generate .PHONY: proto-gen-docker -## proto-lint-docker: Lint protobuf files. Requires docker. +## proto-lint: Lint protobuf files. Requires docker. proto-lint: @echo "--> Linting Protobuf files" @$(DOCKER_BUF) lint .PHONY: proto-lint + +## lint: Lint Go files. Requires golangci-lint. +lint: + @echo "--> Lint source code using golangci-lint" + @golangci-lint run +.PHONY: lint + +## test: Run unit tests. +test: + @echo "--> Run unit tests" + @go test -mod=readonly ./... +.PHONY: test + +## benchmark: Run tests in benchmark mode. +benchmark: + @echo "--> Perform benchmark" + @go test -mod=readonly -bench=. ./... +.PHONY: benchmark diff --git a/README.md b/README.md index f200223..265c369 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,26 @@ Pull requests are welcome. For major changes, please open an issue first to disc This repo attempts to conform to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) so PR titles should ideally start with `fix:`, `feat:`, `build:`, `chore:`, `ci:`, `docs:`, `style:`, `refactor:`, `perf:`, or `test:` because this helps with semantic versioning and changelog generation. It is especially important to include an `!` (e.g. `feat!:`) if the PR includes a breaking change. +### Tools + 1. Install [Go](https://golang.org/doc/install) 1.21.5 +1. Install [golangci-lint](https://golangci-lint.run/usage/install/) 1. Fork this repo 1. Make your changes 1. Submit a pull request + +### Helpful Commands + +```sh +# Display all available make commands +make help + +# Run tests +make test + +# Run linter +make lint + +# Perform benchmarking +make bench +``` \ No newline at end of file