generated from Yandex-Practicum/go-musthave-metrics-tpl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
137 lines (105 loc) · 4.05 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
127
128
129
130
131
132
133
134
135
136
137
AGENT=cmd/agent/agent
SERVER=cmd/server/server
LINTER=cmd/staticlint/staticlint
PORT=16738
FSPATH=/tmp/temp.db
DB_ADDR=localhost
DB_USER=user
DB_PASS=password
DB=mydb
KEY=supersecret
GIT_VERSION=`git log --oneline | head -n1 | cut -f1 -d' '`
COMMIT_FLAG=github.com/w1nsec/collector/internal/app/agent.buildCommit=${GIT_VERSION}
DATE=`date -u '+%Y-%m-%d %H:%M:%S'`
DATE_FLAG=github.com/w1nsec/collector/internal/app/agent.buildDate=${DATE}
all: clean server agent
clean:
rm -rf ${SERVER} ${AGENT}
server:
go build -o ${SERVER} cmd/server/server_main.go
agent:
go build -o ${AGENT} -ldflags "-s -w -X \"${COMMIT_FLAG}\" -X \"${DATE_FLAG}\"" cmd/agent/agent_main.go
linter:
go build -o ${LINTER} cmd/staticlint/staticlint.go
# Checks
check1:
metricstest -test.v -test.run=^TestIteration1$$ -binary-path=${SERVER}
check2:
metricstest -test.v -test.run=^TestIteration2[AB]*$$ -source-path=. -agent-binary-path=cmd/agent/agent
check3:
metricstest -test.v -test.run=^TestIteration3$$ -binary-path=${SERVER} -agent-binary-path=${AGENT} -source-path=./ -server-port=${PORT}
check4:
metricstest -test.v -test.run=^TestIteration4$$ -binary-path=${SERVER} -agent-binary-path=${AGENT} -source-path=./ -server-port=${PORT}
check5:
metricstest -test.v -test.run=^TestIteration5$$ \
-binary-path=${SERVER} \
-agent-binary-path=${AGENT} \
-source-path=./ -server-port=${PORT}
check6:
metricstest -test.v -test.run=^TestIteration6$$ \
-agent-binary-path=${AGENT} \
-binary-path=${SERVER} \
-server-port=${PORT} \
-source-path=.
check7:
metricstest -test.v -test.run=^TestIteration7$$ \
-agent-binary-path=${AGENT} \
-binary-path=${SERVER} \
-server-port=${PORT} \
-source-path=.
check8:
metricstest -test.v -test.run=^TestIteration8$$ \
-agent-binary-path=${AGENT} \
-binary-path=${SERVER} \
-server-port=${PORT} \
-source-path=.
check9:
metricstest -test.v -test.run=^TestIteration9$$ \
-agent-binary-path=${AGENT} \
-binary-path=${SERVER} \
-server-port=${PORT} \
-file-storage-path=${FSPATH} \
-source-path=.
check10:
metricstest -test.v -test.run=^TestIteration10[AB]$$ \
-agent-binary-path=${AGENT} \
-binary-path=${SERVER} \
-server-port=${PORT} \
-file-storage-path=${FSPATH} \
-source-path=. \
-database-dsn="${DB_USER}:${DB_PASS}@${DB_ADDR}/${DB}"
check11:
metricstest -test.v -test.run=^TestIteration11$$ \
-agent-binary-path=${AGENT} \
-binary-path=${SERVER} \
-server-port=${PORT} \
-file-storage-path=${FSPATH} \
-source-path=. \
-database-dsn="postgres://${DB_USER}:${DB_PASS}@${DB_ADDR}/${DB}"
check12:
metricstest -test.v -test.run=^TestIteration12$$ \
-agent-binary-path=${AGENT} \
-binary-path=${SERVER} \
-server-port=${PORT} \
-file-storage-path=${FSPATH} \
-source-path=. \
-database-dsn="postgres://${DB_USER}:${DB_PASS}@${DB_ADDR}/${DB}"
check13:
metricstest -test.v -test.run=^TestIteration13$$ \
-agent-binary-path=${AGENT} \
-binary-path=${SERVER} \
-server-port=${PORT} \
-file-storage-path=${FSPATH} \
-source-path=. \
-database-dsn="postgres://${DB_USER}:${DB_PASS}@${DB_ADDR}/${DB}"
check14:
metricstest -test.v -test.run=^TestIteration14$$ \
-agent-binary-path=${AGENT} \
-binary-path=${SERVER} \
-server-port=${PORT} \
-file-storage-path=${FSPATH} \
-source-path=. \
-database-dsn="postgres://${DB_USER}:${DB_PASS}@${DB_ADDR}/${DB}" \
-key="${KEY}"
staticcheck:
cmd/staticlint ./...