forked from strangelove-ventures/horcrux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (40 loc) · 1.54 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
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
all: install
LD_FLAGS = -X github.com/strangelove-ventures/horcrux/cmd/horcrux/cmd.Version=$(VERSION) \
-X github.com/strangelove-ventures/horcrux/cmd/horcrux/cmd.Commit=$(COMMIT)
LD_FLAGS += $(LDFLAGS)
LD_FLAGS := $(strip $(LD_FLAGS))
BUILD_FLAGS := -ldflags '$(LD_FLAGS)'
build:
@go build -mod readonly $(BUILD_FLAGS) -o build/ ./cmd/horcrux/...
install:
@go install -mod readonly $(BUILD_FLAGS) ./cmd/horcrux/...
build-linux:
@GOOS=linux GOARCH=amd64 go build --mod readonly $(BUILD_FLAGS) -o ./build/horcrux ./cmd/horcrux
test:
@go test -race -timeout 30m -mod readonly -v ./...
test-short:
@go test -mod readonly -run TestDownedSigners2of3 -v ./...
test-signer-short:
@go test -mod readonly -run TestThresholdValidator2of3 -v ./...
clean:
rm -rf build
build-horcrux-docker:
docker build -t strangelove-ventures/horcrux:$(VERSION) -f ./docker/horcrux/Dockerfile .
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(dir $(mkfile_path))
signer-proto:
docker run \
--rm \
-u $(shell id -u ${USER}):$(shell id -g ${USER}) \
--mount type=bind,source=$(mkfile_dir)/signer/proto,target=/horcrux/signer/proto \
--entrypoint protoc \
namely/protoc-all \
--go_out=/horcrux \
--go_opt=paths=source_relative \
--go-grpc_out=/horcrux \
--go-grpc_opt=paths=source_relative \
--proto_path /horcrux \
$(shell find $(mkfile_dir) -name *.proto -printf "%P\n")
.PHONY: all lint test race msan tools clean build