forked from NYDIG-OSS/lndsigner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (58 loc) · 2.3 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
.PHONY: cover docker docker-itest docker-test docker-test-all docker-check docker-shell itest test test-all
IMG_NAME := lndsigner-builder
CPLATFORM := $(shell uname -m)
GOCOVERDIR := /tmp/lndsigner-icover-$(shell date +%s)
ifeq ($(CPLATFORM), x86_64)
GOPLATFORM := amd64
endif
ifeq ($(CPLATFORM), aarch64)
GOPLATFORM := arm64
endif
ifeq ($(CPLATFORM), arm64)
GOPLATFORM := arm64
CPLATFORM := aarch64
endif
GOVER := 1.20.3
LND := v0.17.3-beta
BITCOIND := 26.0
VAULT := 1.15.4
# docker builds a builder image for the host platform if one isn't cached.
docker:
docker build -t $(IMG_NAME):latest --build-arg cplatform=$(CPLATFORM) \
--build-arg goplatform=$(GOPLATFORM) --build-arg gover=$(GOVER) \
--build-arg lnd=$(LND) --build-arg bitcoind=$(BITCOIND) \
--build-arg vault=$(VAULT) -f Dockerfile.dev .
# docker-itest runs itests in a docker container, then removes the container.
docker-itest: docker
docker run -t --rm \
--mount type=bind,source=$(CURDIR),target=/app $(IMG_NAME):latest \
make itest
# docker-test runs unit tests in a docker container, then removes the container.
docker-test: docker
docker run -t --rm \
--mount type=bind,source=$(CURDIR),target=/app $(IMG_NAME):latest \
make test
# docker-test-all runs unit and integration tests in a docker container, then
# removes the container.
docker-test-all: docker
docker run -t --rm \
--mount type=bind,source=$(CURDIR),target=/app $(IMG_NAME):latest \
make test-all
# docker-shell opens a shell to a dockerized environment with all dependencies
# and also dlv installed for easy debugging, then removes the container.
docker-shell: docker
docker run -it --rm \
--mount type=bind,source=$(CURDIR),target=/app $(IMG_NAME):latest \
bash -l
cover:
mkdir $(GOCOVERDIR) && mkdir $(GOCOVERDIR)/lndsignerd && \
mkdir $(GOCOVERDIR)/plugin && mkdir $(GOCOVERDIR)/combined
itest: cover
go install -race -cover -buildvcs=false ./cmd/... && \
GOCOVERDIR=$(GOCOVERDIR) go test -v -count=1 -race -tags=itest ./itest && \
go tool covdata merge -pcombine -i=$(GOCOVERDIR)/lndsignerd,$(GOCOVERDIR)/plugin -o=$(GOCOVERDIR)/combined && \
go tool covdata textfmt -i=$(GOCOVERDIR)/combined -o icover.out && \
rm -rf $(GOCOVERDIR)
test:
go test -v -count=1 -race -coverprofile cover.out ./...
test-all: test itest