-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (49 loc) · 1.58 KB
/
Makefile
File metadata and controls
68 lines (49 loc) · 1.58 KB
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
.PHONY: build docker release lint gci-format test coverage gen-migration-sql sqlc abigen
NAME=remora
build:
CGO_ENABLED=0 go build -ldflags "-s -w" -o "${NAME}_$(app)" ./cmd/$(app)
app?=api
tag?=latest
docker:
docker build \
--build-arg APP=$(app) \
-t $(NAME):$(tag) .
TAG := v$(shell date -u '+%Y.%m.%d.%H.%M.%S')
release:
git tag $(TAG)
git push origin $(TAG)
# Tools
lint:
@go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint run ./... -c ./.golangci.yml
lint-fix:
@go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint run ./... -c ./.golangci.yml --fix
gci-format:
@go run github.com/daixiang0/gci write --skip-generated -s standard -s default -s "Prefix(remora)" ./
test:
@go test ./... -race
coverage:
@go test -coverprofile=coverage.out ./internal/...
@go tool cover -func=coverage.out
# SQL
DATETIME=$(shell date -u '+%Y%m%d%H%M%S')
gen-migration-sql:
@( \
printf "Enter file name: "; read -r FILE_NAME; \
touch database/migrations/$(DATETIME)_$$FILE_NAME.up.sql; \
touch database/migrations/$(DATETIME)_$$FILE_NAME.down.sql; \
)
gen-seed-sql:
@( \
printf "Enter file name: "; read -r FILE_NAME; \
printf "Enter env: "; read -r ENV; \
mkdir -p database/seeds/$$ENV; \
touch database/seeds/$$ENV/$(DATETIME)_$$FILE_NAME.up.sql; \
touch database/seeds/$$ENV/$(DATETIME)_$$FILE_NAME.down.sql; \
)
sqlc:
sqlc generate -f ./database/sqlc.yml
sqlc-lint:
sqlc vet -f ./database/sqlc.yml
# Contracts
abigen:
@abigen --abi contracts/stateview/StateView.json --pkg contracts --type StateView --out internal/liquidity/repository/contracts/stateview.go