generated from dzungtran/echo-rest-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (37 loc) · 1008 Bytes
/
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
ifneq (,$(wildcard ./.env))
include .env
export
endif
migration-create:
migrate create -ext sql -dir migrations/sql $(name)
migration-up:
migrate -path migrations/sql -verbose -database "${DATABASE_URL}" up
migration-down:
migrate -path migrations/sql -verbose -database "${DATABASE_URL}" down
run-db:
docker compose up postgres redis
run-api:
go run ./cmd/api/
build-api:
go build -v -o ./bin/ ./cmd/api
test:
go test -v -cover -benchmem ./...
mock:
mockery --all
setup:
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
go install github.com/swaggo/swag/cmd/swag@latest
docs:
swag i --dir ./cmd/api/,\
./modules/,\
./pkg/wrapper,\
./pkg/contexts
git-hooks:
echo "Installing hooks..." && \
rm -rf .git/hooks/pre-commit && \
ln -s ../../tools/scripts/pre-commit.sh .git/hooks/pre-commit && \
chmod +x .git/hooks/pre-commit && \
echo "Done!"
routes:
go run ./tools/routes/
.PHONY: routes run-api run-db build-api migration-create docs