This repository has been archived by the owner on May 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
195 lines (142 loc) · 4.91 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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
TEST_TIMEOUT:="70s"
TEST_ARGS ?= -args -logtostderr -v=3
TEST_PKG?=./grpc/...
VERSION=$(shell cat ./VERSION)
LEDGER_NAME:=FINDY_FILE_LEDGER
AUTH_BRANCH=$(shell scripts/branch.sh ../findy-agent-auth/)
GRPC_BRANCH=$(shell scripts/branch.sh ../findy-common-go/)
WRAP_BRANCH=$(shell scripts/branch.sh ../findy-wrapper-go/)
CURRENT_BRANCH=$(shell scripts/branch.sh .)
GO := go
# GO := go1.18beta2
GOBUILD_ARGS:=
COV_FILE:=coverage.txt
SCAN_SCRIPT_URL="https://raw.githubusercontent.com/findy-network/setup-go-action/master/scanner/cp_scan.sh"
scan:
@curl -s $(SCAN_SCRIPT_URL) | bash
scan_and_report:
@curl -s $(SCAN_SCRIPT_URL) | bash -s v > licenses.txt
drop_wrap:
$(GO) mod edit -dropreplace github.com/findy-network/findy-wrapper-go
drop_comm:
$(GO) mod edit -dropreplace github.com/findy-network/findy-common-go
drop_auth:
$(GO) mod edit -dropreplace github.com/findy-network/findy-agent-auth
drop_all: drop_auth drop_comm drop_wrap
repl_wrap:
$(GO) mod edit -replace github.com/findy-network/findy-wrapper-go=../findy-wrapper-go
repl_comm:
$(GO) mod edit -replace github.com/findy-network/findy-common-go=../findy-common-go
repl_auth:
$(GO) mod edit -replace github.com/findy-network/findy-agent-auth=../findy-agent-auth
repl_all: repl_auth repl_comm repl_wrap
modules: modules_comm modules_wrap modules_auth
modules_comm: drop_comm
@echo Syncing modules: findy-common-go/$(GRPC_BRANCH)
$(GO) get github.com/findy-network/findy-common-go@$(GRPC_BRANCH)
modules_wrap: drop_wrap
@echo Syncing modules: findy-wrapper-go/$(WRAP_BRANCH)
$(GO) get github.com/findy-network/findy-wrapper-go@$(WRAP_BRANCH)
modules_auth: drop_auth
@echo Syncing modules: findy-agent-auth/$(AUTH_BRANCH)
$(GO) get github.com/findy-network/findy-agent-auth@$(AUTH_BRANCH)
deps:
$(GO) get -t ./...
update-deps:
$(GO) get -u ./...
cli:
@echo "building new CLI by name: fa"
$(eval VERSION = $(shell cat ./VERSION) $(shell date))
@echo "Installing version $(VERSION)"
@$(GO) build \
-ldflags "-X 'github.com/findy-network/findy-agent/agent/utils.Version=$(VERSION)'" \
-o $(GOPATH)/bin/fa
build:
$(GO) build -v ./...
vet:
$(GO) vet ./...
shadow:
@echo Running govet
$(GO) vet -vettool=$(GOPATH)/bin/shadow ./...
@echo Govet success
check_fmt:
$(eval GOFILES = $(shell find . -name '*.go'))
@gofmt -s -l $(GOFILES)
lint_e:
@$(GOPATH)/bin/golint ./... | grep -v export | cat
lint:
@golangci-lint run
test:
$(GO) test -p 1 -failfast ./...
testr:
$(GO) test -timeout $(TEST_TIMEOUT) -p 1 -failfast -race ./... | tee ../testr.log
test_pkgv:
$(GO) test -v -timeout $(TEST_TIMEOUT) -p 1 -failfast $(TEST_PKG) $(TEST_ARGS) | tee ../testr.log
test_grpcv:
$(GO) test -v -timeout $(TEST_TIMEOUT) -p 1 -failfast ./grpc/... $(TEST_ARGS) | tee ../testr.log
test_grpc:
$(GO) test -timeout $(TEST_TIMEOUT) -p 1 -failfast ./grpc/... $(TEST_ARGS) | tee ../testr.log
test_grpc_rv:
$(GO) test -v -timeout $(TEST_TIMEOUT) -p 1 -failfast -race ./grpc/... $(TEST_ARGS) | tee ../testr.log
test_grpc_r:
$(GO) test -timeout $(TEST_TIMEOUT) -p 1 -failfast -race ./grpc/... $(TEST_ARGS) | tee ../testr.log
test_grpc_cov_out:
$(GO) test -p 1 -failfast -timeout $(TEST_TIMEOUT) \
-coverpkg=github.com/findy-network/findy-agent/... \
-coverprofile=$(COV_FILE) \
-covermode=atomic \
./grpc/...
test_grpcv_cov_out:
$(GO) test -v -p 1 -failfast -timeout $(TEST_TIMEOUT) \
-coverpkg=github.com/findy-network/findy-agent/... \
-coverprofile=$(COV_FILE) \
-covermode=atomic \
./grpc/... \
$(TEST_ARGS) | tee ../testr.log
testrv:
$(GO) test -v -timeout $(TEST_TIMEOUT) -p 1 -failfast -race ./... $(TEST_ARGS) | tee ../testr.log
testv:
$(GO) test -v -p 1 -failfast ./...
test_cov_out:
$(GO) test -p 1 -failfast -timeout=1200s \
-coverpkg=github.com/findy-network/findy-agent/... \
-coverprofile=$(COV_FILE) \
-covermode=atomic \
./...
test_cov: test_cov_out
$(GO) tool cover -html=$(COV_FILE) -o ./report.html
open ./report.html
misspell:
@$(GO) get github.com/client9/misspell
@find . -name '*.md' -o -name '*.go' -o -name '*.puml' | xargs misspell -error
e2e: install
./scripts/e2e/e2e-test.sh init_ledger
./scripts/e2e/e2e-test.sh e2e
./scripts/e2e/e2e-test.sh clean
e2e_ci: install
./scripts/e2e/e2e-test.sh e2e
check: check_fmt vet shadow
install:
$(eval VERSION = $(shell cat ./VERSION) $(shell date))
@echo "Installing version $(VERSION)"
$(GO) install \
${GOBUILD_ARGS} \
-ldflags "-X 'github.com/findy-network/findy-agent/agent/utils.Version=$(VERSION)'" \
./...
image:
$(eval VERSION = $(shell cat ./VERSION))
docker build \
-t findy-agent \
-f scripts/deploy/Dockerfile .
docker tag findy-agent:latest findy-agent:$(VERSION)
# **** scripts for local agency development:
# WARNING: this will erase all your local indy wallets
scratch:
./scripts/dev/dev.sh scratch $(LEDGER_NAME)
run:
./scripts/dev/dev.sh install_run $(LEDGER_NAME)
# ****
iop:
gh workflow run iop.yml --ref $(CURRENT_BRANCH)
release:
gh workflow run do-release.yml