-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
101 lines (67 loc) · 2 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
ifneq (,$(wildcard ./.env))
include .env
export
else
$(error You haven't setup your .env file. Please refer to the readme)
endif
VERSION=$(shell awk -F'"' '/"version":/ {print $$4}' version.json)
LAMBDA_GOOS=linux
LAMBDA_GOARCH=arm64
LAMBDA_GOCC?=go
LAMBDA_GOFLAGS=-tags=lambda.norpc -ldflags="-s -w -X github.com/storacha/indexing-service/pkg/build.version=$(VERSION)"
LAMBDA_CGO_ENABLED=0
LAMBDADIRS=build/getclaim build/getclaims build/getroot build/notifier build/postclaims build/providercache build/remotesync
LAMBDAS=$(foreach dir, $(LAMBDADIRS), $(dir)/bootstrap)
OTELCOL_CONFIG=otel-collector-config.yaml
indexer:
go build -o ./indexer ./cmd
.PHONY: clean-indexer
clean-indexer:
rm -f ./indexer
.PHONY: test
test:
go test -race -v ./...
.PHONY: test-nocache
test-nocache:
go clean -testcache && make test
ucangen:
go build -o ./ucangen cmd/ucangen/main.go
.PHONY: ucankey
ucankey: ucangen
./ucangen
.PHONY: clean-lambda
clean-lambda:
rm -rf build
.PHONY: clean-terraform
clean-terraform:
tofu -chdir=deploy/app destroy
.PHONY: clean
clean: clean-terraform clean-lambda clean-indexer
lambdas: $(LAMBDAS) otel-config
.PHONY: $(LAMBDAS)
$(LAMBDAS): build/%/bootstrap:
GOOS=$(LAMBDA_GOOS) GOARCH=$(LAMBDA_GOARCH) CGO_ENABLED=$(LAMBDA_CGO_ENABLED) $(LAMBDA_GOCC) build $(LAMBDA_GOFLAGS) -o $@ ./cmd/lambda/$*
otel-config: otel-collector-config.yaml
echo $(LAMBDADIRS) | xargs -n 1 cp $(OTELCOL_CONFIG)
deploy/app/.terraform:
tofu -chdir=deploy/app init
.tfworkspace:
tofu -chdir=deploy/app workspace new $(TF_WORKSPACE)
touch .tfworkspace
.PHONY: init
init: deploy/app/.terraform .tfworkspace
.PHONY: upgrade
upgrade:
tofu -chdir=deploy/app init -upgrade
.PHONY: validate
validate: deploy/app/.terraform .tfworkspace
tofu -chdir=deploy/app validate
.PHONY: plan
plan: deploy/app/.terraform .tfworkspace lambdas
tofu -chdir=deploy/app plan
.PHONY: apply
apply: deploy/app/.terraform .tfworkspace lambdas
tofu -chdir=deploy/app apply
.PHONY: mockery
mockery:
mockery --config=.mockery.yaml