-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathMakefile
43 lines (32 loc) · 1.68 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
.PHONY: run debug bootstrap bootstrap-destinations build-docker buildx-deploy lint test test-cover-pkg help
S=silverton
REGISTRY:=us-east1-docker.pkg.dev/silverton-io/docker
VERSION:=$(shell cat .VERSION)
BUZ_DIR="./cmd/buz/"
TEST_PROFILE=testprofile.out
build:
go build -ldflags="-X main.VERSION=$(VERSION)" -o buz $(BUZ_DIR)
run: ## Run buz locally
go run -ldflags="-X 'main.VERSION=x.x.dev'" $(BUZ_DIR)
debug: ## Run buz locally with debug
DEBUG=1 go run -ldflags="-X 'main.VERSION=x.x.dev'" $(BUZ_DIR)
bootstrap: ## Bootstrap development environment
test -f config.yml || cp ./examples/devel/buz/simple.conf.yml config.yml;
make debug
bootstrap-destinations: ## Bootstrap various containerized database/stream systems
docker-compose -f examples/devel/docker-compose.yml up -d
build-docker: ## Build local buz image
docker build -f deploy/Dockerfile -t buz:$(VERSION) .
buildx-deploy: ## Build multi-platform buz image and push it to edge repo
docker buildx create --name $(S) || true;
docker buildx use $(S)
docker buildx build --platform linux/arm64,linux/amd64 -f deploy/Dockerfile -t $(REGISTRY)/buz:$(VERSION)-edge . --push
lint: ## Lint go code
@golangci-lint run --config .golangci.yml
test: ## Run tests against pkg
@go test ./pkg/...
test-cover-pkg: ## Run tests against pkg, output test profile, and open profile in browser
go test ./pkg/... -v -coverprofile=$(TEST_PROFILE) || true
go tool cover -html=$(TEST_PROFILE) || true
help: ## Display makefile help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)