-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
executable file
·95 lines (76 loc) · 2.66 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
.PHONY: build clean cov help intergrationtest lint run run-neutrino run-neutrino-mutinynet test vet
define setup_env
$(eval include $(1))
$(eval export)
endef
## build: build for all platforms
build:
@echo "Building arkd binary..."
@bash ./scripts/build
## clean: cleans the binary
clean:
@echo "Cleaning..."
@go clean
## cov: generates coverage report
cov:
@echo "Coverage..."
@go test -cover ./...
## help: prints this help message
help:
@echo "Usage: \n"
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
## intergrationtest: runs integration tests
integrationtest:
@echo "Running integration tests..."
@go test -v -count 1 -timeout 500s github.com/ark-network/ark/server/test/e2e/covenant
@go test -v -count 1 -timeout 500s github.com/ark-network/ark/server/test/e2e/covenantless
## lint: lint codebase
lint:
@echo "Linting code..."
@golangci-lint run --fix
## run: run in regtest mode with bitcoind
run: clean
@echo "Running arkd with Bitcoin Core in regtest mode ..."
$(call setup_env, envs/bitcoind.regtest.env)
go run ./cmd/arkd
## run-neutrino: run in regtest mode with neutrino
run-neutrino: clean
@echo "Running arkd with Neutrino in regtest mode ..."
$(call setup_env, envs/neutrino.regtest.env)
go run ./cmd/arkd
## run-neutrino-mutinynet: run in signet mode
run-neutrino-mutinynet: clean
@echo "Running arkd with Neutrino in signet mode ..."
$(call setup_env, envs/neutrino.signet.env)
go run ./cmd/arkd
## test: runs unit and component tests
test:
@echo "Running unit tests..."
@go test -v -count=1 -race ./internal/...
@find ./pkg -name go.mod -execdir go test -v -count=1 -race ./... \;
## vet: code analysis
vet:
@echo "Running code analysis..."
@go vet ./...
## mig_file: creates pg migration file(eg. make FILE=init mig_file)
mig_file:
@migrate create -ext sql -dir ./internal/infrastructure/db/sqlite/migration/ $(FILE)
## mig_up: creates db schema for provided db path
mig_up:
@echo "creating db schema..."
@migrate -database "sqlite://$(DB_PATH)/sqlite.db" -path ./internal/infrastructure/db/sqlite/migration/ up
## mig_down: apply down migration
mig_down:
@echo "migration down..."
@migrate -database "sqlite://$(DB_PATH)/sqlite.db" -path ./internal/infrastructure/db/sqlite/migration/ down
## mig_down_yes: apply down migration without prompt
mig_down_yes:
@echo "migration down..."
@"yes" | migrate -database "sqlite://path/to/database" -path ./internal/infrastructure/db/sqlite/migration/ down
## vet_db: check if mig_up and mig_down are ok
vet_db: recreatedb mig_up mig_down_yes
@echo "vet db migration scripts..."
## sqlc: gen sql
sqlc:
@echo "gen sql..."
cd ./internal/infrastructure/db/sqlite; sqlc generate