-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (37 loc) · 1 KB
/
Makefile
File metadata and controls
44 lines (37 loc) · 1 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
MIGRATIONS_PATH="db/migration"
DATABASE_URL=postgres://postgres:postgres@localhost:5432/bnb?sslmode=disable
###################
# Build #
###################
.PHONY: build
build:
CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o main ./cmd/api/main.go
###################
# Database #
###################
.PHONY: mig-up
mig-up: ## Runs the migrations up
migrate -path $(MIGRATIONS_PATH) -database "$(DATABASE_URL)" up
.PHONY: mig-down
mig-down: ## Runs the migrations down
migrate -path ${MIGRATIONS_PATH} -database "$(DATABASE_URL)" down
.PHONY: new-mig
new-mig:
migrate create -ext sql -dir ${MIGRATIONS_PATH} -seq $(NAME)
###################
# Testing #
###################
.PHONY: mock
mock:
mockery --output internal/reservation/mocks --dir internal/reservation --all
mockery --output test/mocks --dir pkg --all
.PHONY: test
test: mock
go test ./... -race
###################
# Linting #
###################
.PHONY: lint
lint:
go fmt ./...
golangci-lint run --fix ./...