-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
106 lines (83 loc) · 2.26 KB
/
makefile
File metadata and controls
106 lines (83 loc) · 2.26 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
.PHONY: swagger
swagger:
swag init --dir cmd/api,internal/controller --output doc/openapi --outputTypes yaml,json
.PHONY: lint
lint:
go vet ./...
golangci-lint run
.PHONY: test
test:
docker compose up -d --wait mh-api-dbsrv01
go test -parallel 1 ./...
.PHONY: test-coverage
test-coverage:
go test ./... -coverprofile=coverage.out
.PHONY: generate
generate:
go generate ./...
# DATABASE_URL is expected to be set in the environment
ifndef DATABASE_URL
$(warning DATABASE_URL is not set. Using default local development settings)
DATABASE_URL ?= mh-api:P@ssw0rd@tcp(127.0.0.1:3306)/mh-api?charset=utf8&parseTime=True&loc=Local
export DATABASE_URL
endif
.PHONY: migrate-up
migrate-up:
$(eval MIGRATE_CMD := go run cmd/migration/main.go)
$(MIGRATE_CMD) -command up
.PHONY: migrate-down
migrate-down:
$(eval MIGRATE_CMD := go run cmd/migration/main.go)
$(MIGRATE_CMD) -command down
.PHONY: migrate-status
migrate-status:
$(eval MIGRATE_CMD := go run cmd/migration/main.go)
$(MIGRATE_CMD) -command status
.PHONY: migrate-new
migrate-new:
$(eval MIGRATE_CMD := go run cmd/migration/main.go)
$(MIGRATE_CMD) -command new -name $(name)
.PHONY: seed
seed:
$(eval MIGRATE_CMD := go run cmd/migration/main.go)
$(MIGRATE_CMD) -command seed
.PHONY: run
run:
go run cmd/api/main.go
.PHONY: build
build:
go build -o bin/api cmd/api/main.go
.PHONY: build-agent
build-agent:
go build -o bin/agent cmd/agent/main.go
.PHONY: run-agent
run-agent:
go run cmd/agent/main.go
.PHONY: docker-build-agent
docker-build-agent:
docker build -t monhun-agent --target deploy-agent .
.PHONY: compose-up
compose-up:
docker compose up -d --wait mh-api-dbsrv01
.PHONY: compose-down
compose-down:
docker compose down -v
.PHONY: compose-stop
compose-stop:
docker compose down
.PHONY: compose-build
compose-build:
docker compose up -d --build
.PHONY: compose-start
compose-start:
docker compose up -d
.PHONY: e2e-prod
e2e-prod:
scenarigo run --config e2e/config/scenarigo-prod.yaml
# Encode Image to Base64
.PHONY: encode-image
encode-image:
$(eval BASE64_IMAGE := $(shell base64 -w 0 $(IMAGE_PATH)))
$(eval export BASE64_IMAGE)
.PHONY: check
check: lint test test-coverage migrate-up migrate-status migrate-down seed run build compose-up compose-down compose-build compose-start encode-image compose-stop