-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
126 lines (99 loc) · 2.68 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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
ENV = prod staging local
.PHONY: build clean deploy the sql-manager platform
SHELL=/bin/bash
ifeq (${ENV}, prod)
include .prod.env
else
ifeq (${ENV}, staging)
include .staging.env
else
ifeq (${ENV}, dev)
include .dev.env
else
ifeq (${ENV}, int)
include .int.env
else
ifeq (${ENV}, local-dev)
include .local.dev.env
else
ifeq (${ENV}, local-staging)
include .local.staging.env
endif
endif
endif
endif
endif
endif
export
check-staging:
ifeq ($(ENV),staging)
@echo "STAGING ENV active"
else
$(error == env must be staging==)
endif
check-local-staging:
ifeq ($(ENV),local-staging)
@echo "STAGING ENV active"
else
$(error == env must be local-staging==)
endif
check-prod:
ifeq ($(ENV),prod)
@echo "PROD ENV active"
else
$(error == env must be PROD==)
endif
check-dev:
ifeq ($(ENV),dev)
else
$(error == env must be DEV==)
endif
check-int:
ifeq ($(ENV),int)
@echo "LOCAL ENV active"
else
$(error == env must be LOCAL DEV==)
endif
#######################
# SERVER
#######################
# DEV
run-server: check-dev
docker rm -f sqlm-server-dev || true && \
docker run --name sqlm-server-dev -d -p $${SQLM_SER_DB_PORT}:5432 -e POSTGRES_USER=$${SQLM_SER_DB_USER} -e POSTGRES_DB=$${SQLM_SER_DB_NAME} -e POSTGRES_PASSWORD=$${SQLM_SER_DB_PW} postgres:latest && \
sleep 2s && \
go run ./cmd/sqlmserver/main.go
# INT
test-server: check-int
docker rm -f sqlm-server-int || true && \
docker run --name sqlm-server-int -d -p $${SQLM_SER_DB_PORT}:5432 -e POSTGRES_USER=$${SQLM_SER_DB_USER} -e POSTGRES_DB=$${SQLM_SER_DB_NAME} -e POSTGRES_PASSWORD=$${SQLM_SER_DB_PW} postgres:latest && \
sleep 2s && \
go test -count=1 -v ./serverlib/integration -test.run=${args}
test-server-ga:
go test -count=1 ./serverlib/integration
# DB
test-db-dev: check-dev
docker rm -f test-db-dev || true && \
docker run --name test-db-dev -d -p $${TEST_DB_PORT}:5432 -e POSTGRES_USER=$${TEST_DB_USER} -e POSTGRES_DB=$${TEST_DB_NAME} -e POSTGRES_PASSWORD=$${TEST_DB_PW} postgres:latest && \
sleep 2s
test-db-prod: check-prod
docker rm -f test-db-prod || true && \
docker run --name test-db-prod -d -p $${TEST_DB_PORT}:5432 -e POSTGRES_USER=$${TEST_DB_USER} -e POSTGRES_DB=$${TEST_DB_NAME} -e POSTGRES_PASSWORD=$${TEST_DB_PW} postgres:latest && \
sleep 2s
#######################
# CLIENT
#######################
# BUILD
# DEV
run-client: check-dev
@go run ./cmd/sqlmclient/main.go ${args}
# TEST
test-client:
go test -count=1 -v ./clientlib/sql -run ${args}
#######################
# RELEASE
#######################
release:
git tag -a v${tag} -m "release v${tag}" && git push --follow-tags
run-release-local:
./dist/sql-manager-test_linux_amd64/sql-manager-auth