-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
43 lines (32 loc) · 1.42 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
CURL ?= curl
DOCKER_COMPOSE = docker-compose
GOLANGCI_VERSION = v1.61.0
GOPATH = $(shell go env GOPATH)
all: lint test ## Run linting and testing
# Use `-run==` to support Windows where ^ is an escape sequence and no test can
# ever start with literal `=`.
bench: ## Run benchmarks only
go test ./... -bench=. -run== -v
compose: ## Start the docker-compose environment
$(DOCKER_COMPOSE) up -d
compose-down: ## Stop the docker-compose environment
$(DOCKER_COMPOSE) down
$(GOPATH)/bin/golangci-lint: ## Ensure golangci-lint is installed
$(CURL) -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_VERSION)
# This will grep the double comment marker (##) and map all targets to the
# comment which will just print the comment next to each target for documenting purposes.
help: ## Show this help text
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; \
{printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
hooks: ## Install tracked git hooks
script/install-hooks
lint: $(GOPATH)/bin/golangci-lint ## Lint the code
$(GOPATH)/bin/golangci-lint run ./...
test: compose ## Run all tests (with race detection)
go test ./... -race -v
coverage:
go test -coverprofile c.out ./...
@sed -i "s%github.com/0x4b53/amqp-rpc/v5/%amqp-rpc/%" c.out
.PHONY: all compose compose-down help hooks lint test