forked from Layr-Labs/eigenda
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
150 lines (129 loc) · 5.32 KB
/
Copy pathMakefile
File metadata and controls
150 lines (129 loc) · 5.32 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
.PHONY: compile-el compile-dl clean protoc mdbook-serve lint build unit-tests integration-tests integration-tests-churner integration-tests-indexer integration-tests-node-plugin integration-tests-eigenda-client integration-tests-inabox integration-tests-inabox-nochurner integration-tests-graph-indexer integration-tests-dataapi check-fmt
ifeq ($(wildcard .git/*),)
$(warning semver disabled - building from release zip)
GITCOMMIT := ""
GITSHA := ""
GITDATE := ""
BRANCH := ""
SEMVER := $(shell basename $(CURDIR))
else
GITCOMMIT := $(shell git rev-parse --short HEAD)
GITDATE := $(shell git log -1 --format=%cd --date=unix)
GITSHA := $(shell git rev-parse HEAD)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/[^[:alnum:]\.\_\-]/-/g')
SEMVER := $(shell docker run --rm --volume "$(PWD):/repo" gittools/gitversion:5.12.0 /repo -output json -showvariable SemVer)
ifeq ($(SEMVER), )
$(warning semver disabled - docker not installed)
SEMVER := "0.0.0"
endif
endif
RELEASE_TAG := $(or $(RELEASE_TAG),latest)
# Go's VCS stamping logic assumes .git is always a directory, but in worktrees it's a file.
# This causes "error obtaining VCS status" when building because Go can't parse the file format.
# See https://github.com/golang/go/issues/58218#issuecomment-1471302281
#
# So we detect if we're in a git worktree (where .git is a file, not a directory)
# and set GOFLAGS to disable VCS stamping to avoid build errors if so.
# This is a temporary workaround until Go's VCS handling is fixed.
ifeq ($(shell test -f .git && echo "true"),true)
export GOFLAGS := -buildvcs=false
$(warning Detected git worktree - disabling VCS stamping)
endif
build: protoc contract-bindings
$(MAKE) -C operators/churner build
$(MAKE) -C disperser build
$(MAKE) -C node build
$(MAKE) -C retriever build
$(MAKE) -C tools/kzgpad build
$(MAKE) -C relay build
$(MAKE) -C litt build
$(MAKE) -C api/proxy build
$(MAKE) -C ejector build
clean:
$(MAKE) -C api clean
$(MAKE) -C operators/churner clean
$(MAKE) -C disperser clean
$(MAKE) -C node clean
$(MAKE) -C retriever clean
$(MAKE) -C tools/kzgpad clean
$(MAKE) -C relay clean
$(MAKE) -C litt clean
$(MAKE) -C api/proxy clean
$(MAKE) -C ejector clean
$(MAKE) -C contracts clean
# Compiles the contracts and builds the golang bindings.
contract-bindings:
$(MAKE) -C contracts bindings
# Builds the protobuf files
protoc:
$(MAKE) -C api protoc
# Only lints the diff between current branch and master because of settings in .golangci.yml unless a different branch is specified in LINT_BASE_REV
lint:
golangci-lint run $(if $(LINT_BASE_REV),--new-from-rev=$(LINT_BASE_REV))
go mod tidy -diff
# TODO: this should also format github workflows, etc.
fmt:
$(MAKE) -C contracts fmt
go fmt ./...
# TODO: this should also check github workflows, etc.
fmt-check:
$(MAKE) -C contracts fmt-check
# go list template was generated by Claude. I didn't double check that it expands to the exact
# same files as `go fmt ./...`, but it should be equivalent.
output=$$(gofmt -l $$(go list -f '{{range .GoFiles}}{{$$.Dir}}/{{.}} {{end}}' ./...)); \
if [ -n "$$output" ]; then \
echo "Files not gofmt'd:"; \
echo "$$output"; \
exit 1; \
fi
# builds all services and loads them into dockerd (such that they are available via `docker images`).
# The images will be tagged with :dev, which is the default BUILD_TAG in docker-bake.hcl.
# This can be changed by running for example `BUILD_TAG=master make docker-build`.
docker-build:
docker buildx bake all --load
# builds all services and pushes them to the configured registry (ghcr by default).
docker-build-push:
docker buildx bake all --push
# Should only ever be used by the docker-publish-release CI workflow.
# We keep the node-group and proxy targets separate since we might want to release them separately in the future.
docker-release-build:
BUILD_TAG=${SEMVER} SEMVER=${SEMVER} GITDATE=${GITDATE} GIT_SHA=${GITSHA} GIT_SHORT_SHA=${GITCOMMIT} \
docker buildx bake node-group-release ${PUSH_FLAG}
BUILD_TAG=${SEMVER} SEMVER=${SEMVER} GITDATE=${GITDATE} GIT_SHA=${GITSHA} GIT_SHORT_SHA=${GITCOMMIT} \
docker buildx bake proxy-release ${PUSH_FLAG}
# Run all tests that don't have their own panel.
unit-tests:
go clean -testcache
./test/scripts/test-with-blacklist.sh . ./litt
# Run the unit tests in litt/ only.
litt-unit-tests:
go clean -testcache
./test/scripts/test-with-whitelist.sh . ./litt
fuzz-tests:
go test --fuzz=FuzzParseSignatureKMS -fuzztime=1m ./common
go test --fuzz=FuzzBlobConversion -fuzztime=1m ./api/clients/v2/coretypes
go test --fuzz=FuzzOnlySystematic -fuzztime=1m ./encoding/v2/kzg/prover
# Integration tests use mocks
integration-tests:
go test -v ./operators/churner/tests
go test -v ./core/indexer
go test -v ./node/plugin/tests
go test -v ./disperser/dataapi
# Tests that require a build because they start local inabox infra:
# either chain, subgraph, or localstack.
integration-tests-inabox: build
go test -v ./core/thegraph
cd inabox && make run-e2e-tests
# These are e2e tests that run against live environments (preprod and holesky currently).
live-tests:
go test -v ./test/v2/live -v -timeout 60m
live-tests-v1:
go test -v ./api/clients --live-test
semver:
echo "${SEMVER}"
##### Proxies to other local Makefiles #####
mdbook-serve:
$(MAKE) -C docs/spec serve
# Generates documentation for configuration files.
document-config:
cd common/config/doc_generator && go run .