-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (39 loc) · 1.55 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
SHELL := /bin/bash
export PROJECT = mat-api
.DEFAULT_GOAL := help
build: ## build admin executable file
go build -o bin/main ./cmd/mat-admin/
up: ## Builds, (re)creates, starts, and attaches to Docker containers for a service.
docker-compose up
down: ## Stops Docker containers and removes containers, networks, volumes, and images created by up.
docker-compose down
stop-all:
docker stop $(docker ps -aq)
remove-all: stop-all
docker rm $(docker ps -aq)
migrate: ## Migrate attempts to bring the schema for db up to date with the migrations defined.
go run ./cmd/mat-admin/ migrate
seed: migrate ## Seed runs the set of seed-data queries against db. The queries are ran in a transaction and rolled back if any fail.
go run ./cmd/mat-admin/ seed
keys: ## Generate private key file to private.pem file
go run ./cmd/mat-admin/ keygen private.pem
tidy:
go mod tidy
go mod vendor
lint: ## go code linter with revive
revive ./...
docs-swag: ## generate REST API documentation for swagger
swag i -d cmd/rest-api/ -o cmd/rest-api/docs
deps-upgrade:
# go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
go get -u -t -d -v ./...
test-restaurant:
go test -v -run TestRestaurants/"menu" ./cmd/rest-api/internal/restaurantapi/
test-user:
go test -v -run TestRestaurants/"menu" ./cmd/rest-api/internal/userapi/
test: test-restaurant test-user
deps-cleancache:
go clean -modcache
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'