generated from Improwised/golang-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
36 lines (30 loc) · 1.19 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
.PHONY: create-migration build test swagger-genrate start migrate-up migrate-down start-dev
create-migration:
ifneq (, $(@shell ./migrate -version))
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.11.0/migrate.linux-amd64.tar.gz | tar xvz
mv migrate.linux-amd64 migrate
chmod +x migrate
endif
./migrate create -ext sql -dir database/migrations $(file_name)
build:
go build -o=$(app_name) .
test:
@go test -coverprofile coverage.out ./...
@echo "=========================================================================================="
@echo " TEST COVERAGE "
@echo "=========================================================================================="
@go tool cover -func coverage.out
swagger-genrate:
ifneq (, $(@shell ./swagger version))
curl -L https://github.com/go-swagger/go-swagger/releases/download/v0.26.1/swagger_linux_amd64 --output swagger
chmod +x swagger
endif
./swagger generate spec -o ./assets/swagger.json
start:
go run app.go api
migration-up:
go run app.go migrate up
migration-down:
go run app.go migrate down
start-dev:
@nodemon --exec go run app.go api --signal SIGTERM