forked from hashicorp-forge/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (62 loc) · 1.7 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.PHONY: default
default: help
.PHONY: build-ui
build-ui:
cd web; \
yarn install; \
rm -rf dist/; \
yarn build;
.PHONY: build
build: build-ui
rm -f ./hermes
CGO_ENABLED=0 go build -o ./hermes ./cmd/hermes
.PHONY: bin
bin:
CGO_ENABLED=0 go build -o ./hermes ./cmd/hermes
.PHONY: bin/linux
bin/linux: # bin creates hermes binary for linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./hermes ./cmd/hermes
.PHONY: dev
dev: ## One command to start a dev environment
dev: docker/postgres/start
$(MAKE) bin && ($(MAKE) run &) && $(MAKE) web/run && fg
.PHONY: docker/postgres/clear
docker/postgres/clear: ## Stop and clear data for PostgreSQL in Docker
docker-compose down -v
.PHONY: docker/postgres/start
docker/postgres/start: ## Start PostgreSQL in Docker
docker-compose up -d && sleep 1
.PHONY: docker/postgres/stop
docker/postgres/stop: ## Stop PostgreSQL in Docker
docker-compose down
.PHONY: go/build
go/build:
CGO_ENABLED=0 go build -o ./hermes ./cmd/hermes
.PHONY: go/test
go/test:
go test ./...
.PHONY: go/test/with-docker-postgres
go/test/with-docker-postgres: docker/postgres/start
HERMES_TEST_POSTGRESQL_DSN="host=localhost user=postgres password=postgres port=5432" \
go test -count=1 -v ./...
.PHONY: help
help: ## Print this help
@echo "Usage: make <target>"
@echo
@echo "Targets:"
@egrep '^(.+)\:\ ##\ (.+)' $(MAKEFILE_LIST) | column -t -c 2 -s ':#'
.PHONY: run
run:
./hermes server -config=config.hcl
.PHONY: test
test:
go test ./...
.PHONY: web/install-deps
web/install-deps: ## Install web application dependencies
cd web \
&& yarn install
.PHONY: web/run
web/run: ## Run web application while proxying backend requests
web/run: web/install-deps
cd web \
&& yarn start:with-proxy