generated from flashbots/flashbots-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
57 lines (43 loc) · 1.44 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
GIT_VER := $(shell git describe --tags --always --dirty="-dev")
# ECR_URI := 223847889945.dkr.ecr.us-east-2.amazonaws.com/your-project-name
all: clean build
v:
@echo "Version: ${GIT_VER}"
clean:
rm -rf your-project build/
build:
go build -ldflags "-X main.version=${GIT_VER}" -v -o your-project main.go
test:
go test ./...
bench:
go test -benchmem -bench=. ./...
fuzz:
./scripts/fuzz.sh
lint:
gofmt -d -s .
gofumpt -d -extra .
go vet ./...
staticcheck ./...
golangci-lint run
cover:
go test -coverprofile=/tmp/go-sim-lb.cover.tmp ./...
go tool cover -func /tmp/go-sim-lb.cover.tmp
unlink /tmp/go-sim-lb.cover.tmp
cover-html:
go test -coverprofile=/tmp/go-sim-lb.cover.tmp ./...
go tool cover -html=/tmp/go-sim-lb.cover.tmp
unlink /tmp/go-sim-lb.cover.tmp
build-for-docker:
CGO_ENABLED=0 GOOS=linux go build -ldflags "-X main.version=${GIT_VER}" -v -o your-project main.go
docker-image:
DOCKER_BUILDKIT=1 docker build . -t your-project
docker tag your-project:latest ${ECR_URI}:${GIT_VER}
docker tag your-project:latest ${ECR_URI}:latest
docker-push:
docker push ${ECR_URI}:${GIT_VER}
docker push ${ECR_URI}:latest
k8s-deploy:
@echo "Checking if Docker image ${ECR_URI}:${GIT_VER} exists..."
@docker manifest inspect ${ECR_URI}:${GIT_VER} > /dev/null || (echo "Docker image not found" && exit 1)
kubectl set image deploy/deployment-your-project app-your-project=${ECR_URI}:${GIT_VER}
kubectl rollout status deploy/deployment-your-project