This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
56 lines (42 loc) · 2.6 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
DOCKER_DEV_IMAGE = percona-platform-dbaas-prototool:dev
DOCKER_PACKAGE = docker.pkg.github.com/percona-platform/dbaas-api/dbaas-prototool:latest
DOCKER_CONTAINER = ghcr.io/percona-platform/dbaas-prototool:latest
DOCKER_RUN_IMAGE ?= $(DOCKER_CONTAINER)
DOCKER_RUN_CMD = docker run --rm --mount='type=bind,src=$(PWD),dst=/work' $(DOCKER_RUN_IMAGE)
default: help
help: ## Display this help message
@echo "Please use \`make <target>\` where <target> is one of:"
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
awk -F ':.*?## ' 'NF==2 {printf " %-26s%s\n", $$1, $$2}'
init: ## Install development tools
go build -modfile=tools/go.mod -o bin/goimports golang.org/x/tools/cmd/goimports
go build -modfile=tools/go.mod -o bin/stringer golang.org/x/tools/cmd/stringer
go build -modfile=tools/go.mod -o bin/go-consistent github.com/quasilyte/go-consistent
go build -modfile=tools/go.mod -o bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
go build -modfile=tools/go.mod -o bin/reviewdog github.com/reviewdog/reviewdog/cmd/reviewdog
ci-init: ## Initialize CI environment
# nothing there yet
gen: ## Format, check, and generate code using prototool Docker image
# $(DOCKER_RUN_CMD) prototool break check api/controller -f api/controller/descriptor.bin
rm -rf gen
$(DOCKER_RUN_CMD) prototool all api
$(DOCKER_RUN_CMD) gofmt -w -s .
$(DOCKER_RUN_CMD) goimports -local github.com/percona-platform/dbaas-api -w .
gen-dev: docker-build ## Same as `gen` but with DEV prototool Docker image
env DOCKER_RUN_IMAGE=$(DOCKER_DEV_IMAGE) make gen
gen-code: ## Generate code
go generate ./...
go install ./...
descriptors: ## Update files used for breaking changes detection
$(DOCKER_RUN_CMD) prototool break descriptor-set api/controller -o api/controller/descriptor.bin
docker-build: ## Build prototool Docker dev image
docker build --pull --squash --tag $(DOCKER_DEV_IMAGE) -f Dockerfile .
docker-push: ## Tag and push prototool Docker images
docker tag $(DOCKER_DEV_IMAGE) $(DOCKER_PACKAGE)
docker tag $(DOCKER_DEV_IMAGE) $(DOCKER_CONTAINER)
docker push $(DOCKER_PACKAGE)
docker push $(DOCKER_CONTAINER)
run-dev: ## Run bash in prototool Docker dev image
# the same as DOCKER_RUN_CMD but with `-it` and dev image
docker run -it --rm --mount='type=bind,src=$(PWD),dst=/work' $(DOCKER_DEV_IMAGE) /bin/bash
.PHONY: gen