-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
95 lines (71 loc) · 2.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.PHONY: deps
GO=$(shell which go)
ALL_FLAGS=
GO_FLAGS=-ldflags "-X 'github.com/Layr-Labs/sidecar/internal/version.Version=$(shell cat .release_version)' -X 'github.com/Layr-Labs/sidecar/internal/version.Commit=$(shell git rev-parse --short HEAD)'"
deps/dev:
${GO} install github.com/golangci/golangci-lint/cmd/[email protected]
${GO} install honnef.co/go/tools/cmd/staticcheck@latest
${GO} install github.com/google/yamlfmt/cmd/yamlfmt@latest
deps/go:
${GO} mod tidy
deps-system:
./scripts/installDeps.sh
deps: deps-system deps/go deps/dev
.PHONY: clean
clean:
rm -rf bin || true
.PHONY: build/cmd/sidecar
build/cmd/sidecar:
$(ALL_FLAGS) $(GO) build $(GO_FLAGS) -o bin/sidecar main.go
build/cmd/sidecar/darwin-arm64:
GOOS=darwin GOARCH=arm64 $(ALL_FLAGS) $(GO) build $(GO_FLAGS) -o release/darwin-arm64/sidecar main.go
build/cmd/sidecar/darwin-amd64:
GOOS=darwin GOARCH=amd64 $(ALL_FLAGS) $(GO) build $(GO_FLAGS) -o release/darwin-amd64/sidecar main.go
build/cmd/sidecar/linux-arm64:
GOOS=linux GOARCH=arm64 $(ALL_FLAGS) $(GO) build $(GO_FLAGS) -o release/linux-arm64/sidecar main.go
build/cmd/sidecar/linux-amd64:
GOOS=linux GOARCH=amd64 $(ALL_FLAGS) $(GO) build $(GO_FLAGS) -o release/linux-amd64/sidecar main.go
.PHONY: release
release:
$(MAKE) build/cmd/sidecar/darwin-arm64
$(MAKE) build/cmd/sidecar/darwin-amd64
$(MAKE) build/cmd/sidecar/linux-arm64
$(MAKE) build/cmd/sidecar/linux-amd64
.PHONY: build
build: build/cmd/sidecar
# Docker build steps
docker-buildx-self:
docker buildx build -t go-sidecar:latest -t go-sidecar:latest .
docker-buildx:
docker-buildx build --platform linux/amd64 --push -t 767397703211.dkr.ecr.us-east-1.amazonaws.com/go-sidecar:$(shell date +%s) -t 767397703211.dkr.ecr.us-east-1.amazonaws.com/go-sidecar:latest .
.PHONY: yamlfmt
yamlfmt:
yamlfmt -lint .github/workflows/*.yml .github/*.yml
.PHONY: fmt
fmt:
gofmt -l .
.PHONY: fmtcheck
fmtcheck:
@unformatted_files=$$(gofmt -l .); \
if [ -n "$$unformatted_files" ]; then \
echo "The following files are not properly formatted:"; \
echo "$$unformatted_files"; \
echo "Please run 'gofmt -w .' to format them."; \
exit 1; \
fi
.PHONY: vet
vet:
$(ALL_FLAGS) $(GO) vet ./...
.PHONY: lint
lint:
$(ALL_FLAGS) golangci-lint run
.PHONY: test
test:
./scripts/goTest.sh -v -p 1 -parallel 1 ./...
.PHONY: staticcheck
staticcheck:
staticcheck ./...
.PHONY: ci-test
ci-test: build test
test-rewards:
TEST_REWARDS=true TESTING=true ${GO} test ./pkg/rewards -v -p 1