-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
71 lines (52 loc) · 2.18 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
TOOLS_DIR := tools
BUILDDIR ?= $(CURDIR)/build
ldflags := $(LDFLAGS)
build_tags := $(BUILD_TAGS)
build_args := $(BUILD_ARGS)
ifeq ($(VERBOSE),true)
build_args += -v
endif
ifeq ($(LINK_STATICALLY),true)
ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static" -v
endif
BUILD_TARGETS := build install
BUILD_FLAGS := --tags "$(build_tags)" --ldflags '$(ldflags)'
all: build install
build: BUILD_ARGS := $(build_args) -o $(BUILDDIR)
$(BUILD_TARGETS): go.sum $(BUILDDIR)/
go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./...
$(BUILDDIR)/:
mkdir -p $(BUILDDIR)/
.PHONY: build install tests
build-docker:
$(MAKE) BBN_PRIV_DEPLOY_KEY=${BBN_PRIV_DEPLOY_KEY} -C contrib/images staking-api-service
start-staking-api-service: build-docker stop-service
docker compose up -d
stop-service:
docker compose down
run-local:
./bin/local-startup.sh;
sleep 5;
go run cmd/staking-api-service/main.go \
--config config/config-local.yml \
--params config/global-params.json \
--finality-providers config/finality-providers.json
# We don't use config, params and finality providers, it's here due to dependency reason
run-unprocessed-events-replay-local:
./bin/local-startup.sh;
sleep 5;
go run cmd/staking-api-service/main.go \
--config config/config-local.yml \
--params config/global-params.json \
--finality-providers config/finality-providers.json \
--replay
generate-mock-interface:
cd internal/shared/db/client && mockery --name=DBClient --output=../../../../tests/mocks --outpkg=mocks --filename=mock_db_client.go
cd internal/v1/db/client && mockery --name=V1DBClient --output=../../../../tests/mocks --outpkg=mocks --filename=mock_v1_db_client.go
cd internal/v2/db/client && mockery --name=V2DBClient --output=../../../../tests/mocks --outpkg=mocks --filename=mock_v2_db_client.go
cd internal/shared/http/clients/ordinals && mockery --name=OrdinalsClient --output=../../../../../tests/mocks --outpkg=mocks --filename=mock_ordinal_client.go
test:
./bin/local-startup.sh;
go test -v -cover -p 1 ./... -count=1
build-swagger:
swag init --parseDependency --parseInternal -d cmd/staking-api-service,internal/shared/api,internal/shared/types,internal/v1/api/handlers,internal/v2/api/handlers