-
Notifications
You must be signed in to change notification settings - Fork 128
/
Makefile.include
78 lines (59 loc) · 2.85 KB
/
Makefile.include
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
74
75
76
77
78
# vim: ts=8:sw=8:ft=make:noai:noet
.PHONY: default init release gen test clean all
default: help
help: ## Display this help message
@echo "Please use \`make <target>\` where <target> is one of:"
@grep -h '^[a-zA-Z]' $(MAKEFILE_LIST) | \
awk -F ':.*?## ' 'NF==2 {printf " %-26s%s\n", $$1, $$2}'
@echo
@echo "To test DBaaS components with minikube:"
@echo "Start minikube: minikube start --cpus=2 --nodes=3 --kubernetes-version=v1.20.0"
@echo "ENABLE_DBAAS=1 NETWORK=minikube make env-up"
@echo "DBAAS_ALLOW_UNSUPPORTED_OPERATORS=1 DBAAS_PXC_OP_CHANNEL=fast-v1 ENABLE_DBAAS=1 NETWORK=minikube make env-up"
@echo Check the docker-compose.yml file to see which environment variables are available.
init: ## Install tools
rm -rf bin/*
cd tools && go generate -x -tags=tools
# Install golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin v1.55.2 # Version should match specified in CI
release: ## Build release versions of all components
make -C agent release
make -C admin release
make -C managed release
make -C qan-api2 release
gen: clean ## Generate files
make -C api gen
make -C api gen-alertmanager
make -C api clean-swagger
make -C agent gen
make -C admin gen
make -C managed gen
make gen-mocks ## Generate mocks
make format
make format ## TODO: One formatting run is not enough, figure out why.
go install -v ./...
clean: ## Remove generated files
make -C api clean
gen-mocks:
find . -name mock_*.go -delete
./bin/mockery --config .mockery.yaml
test-common: ## Run tests from API (and other shared) packages only (i.e it ignores directories that are explicitly listed)
go test $(shell go list ./... | grep -v -e admin -e agent -e managed -e api-tests -e qan-api2 -e update)
api-test: ## Run API tests on dev env. Use `PMM_KUBECONFIG=/path/to/kubeconfig.yaml make api-test` to run tests for DBaaS
go test -count=1 -race -p 1 -v ./api-tests/... -pmm.server-insecure-tls
check: ## Run required checkers and linters
LOG_LEVEL=error bin/golangci-lint run ; \
bin/go-sumtype ./... ; \
bin/go-consistent -pedantic ./...
check-license: ## Run license header checks against source files
bin/license-eye -c .licenserc.yaml header check
check-all: check-license check ## Run golangci linter to check for changes against main
bin/golangci-lint run -c=.golangci.yml --new-from-rev=main
FILES = $(shell find . -type f -name '*.go')
format: ## Format source code
make -C api format
bin/gofumpt -l -w $(FILES)
bin/goimports -local github.com/percona/pmm -l -w $(FILES)
bin/gci write --section Standard --section Default --section "Prefix(github.com/percona/pmm)" $(FILES)
serve: ## Serve API documentation with nginx
nginx -p . -c api/nginx/nginx.conf