-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
46 lines (36 loc) · 1.57 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
NO_COLOR=\033[0m
OK_COLOR=\033[32;01m
ERROR_COLOR=\033[31;01m
WARN_COLOR=\033[33;01m
SERVICE_NAME=watchops
.PHONY: all test build
all: test build
setup: migrate kinesis
build: private-repo
@echo "$(OK_COLOR)==> Building $(SERVICE_NAME)... $(NO_COLOR)"
@CGO_ENABLED=0 go build -ldflags "-s -w" -ldflags "-X main.version=${VERSION}" -o "dist/$(SERVICE_NAME)" github.com/italolelis/$(SERVICE_NAME)/cmd/publisher
test: private-repo
@echo "$(OK_COLOR)==> Running tests$(NO_COLOR)"
@go test -v -failfast -cover ./...
migrate: tools.migrate
@./bin/migrate.linux-amd64 -path="configs/migrations/postgres" -database="postgres://watchops:qwerty123@localhost:5432/watchops-db?sslmode=disable" up
compose:
@echo "$(OK_COLOR)==> Bringing containers up for $(SERVICE_NAME)... $(NO_COLOR)"
@docker-compose up -d
kinesis:
@echo "$(OK_COLOR)==> Creating Kinesis streams... $(NO_COLOR)"
@aws --endpoint-url http://127.0.0.1:4566 kinesis create-stream --stream-name watchops_all --shard-count 1
@aws --endpoint-url http://127.0.0.1:4566 kinesis create-stream --stream-name watchops_github --shard-count 1
@aws --endpoint-url http://127.0.0.1:4566 kinesis create-stream --stream-name watchops_opsgenie --shard-count 1
#---------------
#-- tools
#---------------
.PHONY: tools tools.migrate
tools: tools.migrate
tools.migrate:
@command -v ./bin/migrate.linux-amd64 >/dev/null ; if [ $$? -ne 0 ]; then \
echo "--> installing migrate"; \
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.4.0/migrate.linux-amd64.tar.gz | tar xvz; \
mkdir -p bin; \
mv migrate.linux-amd64 ./bin; \
fi