-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
98 lines (77 loc) · 2.64 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
.PHONY: help fmt test clean build build pg droppg createdb dropdb createtestdb \
droptestdb recreatedb recreatetestdb psql wpkh
## help: prints this help message
help:
@echo "Usage: \n"
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
## fmt: go format
fmt:
@echo "Gofmt..."
@gofmt -w -l .
## test: run tests
test:
@echo "Testing..."
@go test -v ./... -timeout 150s
## testpkg: run pkg tests
testpkg:
go test -v -count=1 -race -timeout 360s ./pkg/...
## teste2e: run e2e tests
teste2e:
go test -v -count=1 -race -timeout 60s ./test/e2e/...
## testpg: run pg tests
testpg:
go test -v -count=1 -race -timeout 60s ./test/pg/...
## testall: test all
testall: testpkg teste2e testpg
## clean: clean up
clean:
@echo "Cleaning..."
@rm -rf ./bin
## build-n: build neutrino cli
build-n:
@echo "Building neutrino cli..."
@go build -v -o bin/neutrino ./cmd/neutrino
## build neutrino daemon
build-nd:
@echo "Building neutrino daemon..."
@export GO111MODULE=on; \
env go build -tags netgo -ldflags="-s -w" -o bin/neutrinod ./cmd/neutrinod/main.go
## pg: starts postgres db inside docker container
pg:
docker run --name neutrino-elements-pg -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=secret -d postgres
## droppg: stop and remove postgres container
droppg:
docker stop neutrino-elements-pg
docker rm neutrino-elements-pg
## createdb: create db inside docker container
createdb:
docker exec neutrino-elements-pg createdb --username=root --owner=root neutrino-elements
## dropdb: drops db inside docker container
dropdb:
docker exec neutrino-elements-pg dropdb neutrino-elements
## createtestdb: create test db inside docker container
createtestdb:
docker exec neutrino-elements-pg createdb --username=root --owner=root neutrino-elements-test
## droptestdb: drops test db inside docker container
droptestdb:
docker exec neutrino-elements-pg dropdb neutrino-elements-test
## recreatedb: drop and create main and test db
recreatedb: dropdb createdb droptestdb createtestdb
## recreatetestdb: drop and create test db
recreatetestdb: droptestdb createtestdb
## pgcreatedb: starts docker container and creates dev and test db, used in CI
pgcreatedb:
chmod u+x ./script/create_db
./script/create_db
## psql: connects to postgres terminal running inside docker container
psql:
docker exec -it neutrino-elements-pg psql -U root -d neutrino-elements
## wpkh: creates el_wpkh wallet descriptor based on funded addresses pub_key
wpkh:
go run ./script/fund_wpkh.go
## dev: run neutrinod and postgres
dev:
export POSTGRES_USER=root; \
export POSTGRES_PASSWORD=secret; \
export POSTGRES_DB=neutrino-elements; \
docker-compose up -d --build