forked from parca-dev/parca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
104 lines (83 loc) · 2.5 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
96
97
98
99
100
101
102
103
104
CMD_DOCKER ?= docker
CMD_GIT ?= git
SHELL := /bin/bash
ifeq ($(GITHUB_BRANCH_NAME),)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)-
else
BRANCH := $(GITHUB_BRANCH_NAME)-
endif
ifeq ($(GITHUB_SHA),)
COMMIT := $(shell git describe --no-match --dirty --always --abbrev=8)
else
COMMIT := $(shell echo $(GITHUB_SHA) | cut -c1-8)
endif
VERSION ?= $(if $(RELEASE_TAG),$(RELEASE_TAG),$(shell $(CMD_GIT) describe --tags 2>/dev/null || echo '$(BRANCH)$(COMMIT)'))
OUT_DOCKER ?= ghcr.io/parca-dev/parca
.PHONY: build
build: ui go/bin
.PHONY: clean
clean:
rm -rf bin
rm -rf ui/packages/app/web/dist
rm -rf ui/packages/app/web/.next
.PHONY: go/deps
go/deps:
go mod tidy
.PHONY: go/bin
go/bin: go/deps
mkdir -p ./bin
go build -o bin/ ./cmd/parca
.PHONY: format
format: go/fmt check-license
.PHONY: go/fmt
go/fmt:
go fmt `go list ./...`
go/lint:
golangci-lint run
.PHONY: check-license
check-license:
./scripts/check-license.sh
.PHONY: go/test
go/test:
go test -v `go list ./...`
UI_FILES ?= $(shell find ./ui -name "*" -not -path "./ui/lib/node_modules/*" -not -path "./ui/node_modules/*" -not -path "./ui/packages/app/web/node_modules/*" -not -path "./ui/packages/app/web/dist/*" -not -path "./ui/packages/app/web/.next/*")
ui/packages/app/web/dist: $(UI_FILES)
cd ui && yarn install && yarn workspace @parca/web build
ui: ui/packages/app/web/dist
.PHONY: proto/lint
proto/lint:
# docker run --volume ${PWD}:/workspace --workdir /workspace bufbuild/buf lint
buf lint
.PHONY: proto/generate
proto/generate:
yarn install
# Generate just the annotations and http protos.
buf generate buf.build/googleapis/googleapis --path google/api/annotations.proto --path google/api/http.proto
buf generate
.PHONY: proto/vendor
proto/vendor:
buf mod update
mkdir -p proto/google/pprof
curl https://raw.githubusercontent.com/google/pprof/master/proto/profile.proto > proto/google/pprof/profile.proto
.PHONY: container
container:
buildah build-using-dockerfile --timestamp 0 --layers --build-arg VERSION=$(VERSION) --build-arg COMMIT=$(COMMIT) -t $(OUT_DOCKER):$(VERSION) .
.PHONY: push-container
push-container:
buildah push $(OUT_DOCKER):$(VERSION)
.PHONY: push-quay-container
push-quay-container:
buildah push $(OUT_DOCKER):$(VERSION) quay.io/parca/parca:$(VERSION)
.PHONY: deploy/manifests
deploy/manifests:
cd deploy && make manifests
.PHONY: dev/setup
dev/setup:
./env.sh
./env-jsonnet.sh
.PHONY: dev/up
dev/up: deploy/manifests
source ./scripts/local-dev.sh && up
.PHONY: dev/down
dev/down:
source ./scripts/local-dev.sh && down