-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (59 loc) · 1.88 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
GOTEST_MIN = go test -v -timeout 30s
GOTEST = $(GOTEST_MIN) -race
GOTEST_WITH_COVERAGE = $(GOTEST) -coverprofile=coverage.txt -covermode=atomic
.DEFAULT_GOAL := help
.PHONY: help
help: ## List of available commands
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: build-service
build-services: ## Build services Docker images
$(info Make: Building...)
docker-compose build
.PHONY: up-services
up-services: ## Run service containers and print logs in stdout
$(info Make: Starting containers...)
docker-compose up -d
@make -s logs
.PHONY: up-env
up-env: ## Run env containers
$(info Make: Starting containers...)
docker-compose -f docker-compose-env/docker-compose.yml up -d
.PHONY: down-services
down-services: ## Stop services containers
$(info Make: Stopping containers...)
docker-compose down
.PHONY: down-env
down-env: ## Stop env containers
$(info Make: Stopping containers...)
docker-compose -f docker-compose-env/docker-compose.yml down --remove-orphans
.PHONY: logs
logs: ## Print services logs in stdout
docker-compose logs -f keygen links redirects
.PHONY: test-with-coverage
test-with-coverage: ## Run tests with coverage
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
(cd "$${dir}" && \
$(GOTEST_WITH_COVERAGE) ./... && \
go tool cover -html=coverage.txt -o coverage.html); \
done
.PHONY: test
test: ## Run tests
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
(cd "$${dir}" && \
$(GOTEST) ./...); \
done
.PHONY: lint
lint: ## Run linter
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
(cd "$${dir}" && \
golangci-lint run -E goimports); \
done
.PHONY: tidy
tidy: ## Run tidy
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
(cd "$${dir}" && \
go mod tidy); \
done
.PHONY: ci
ci: test lint tidy