-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
107 lines (90 loc) · 3.31 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
BUILD_DIR=$(PWD)/bin
.PHONY: profile
profile:
echo "Building profile service"
mkdir -p ${BUILD_DIR} \
&& cd backend_services/profile \
&& GOOS=linux GOARCH=386 go build -o ${BUILD_DIR}/profile-service main.go
.PHONY: profile-test
profile-test:
echo "Running unit tests for profile service"
cd backend_services/profile && go test -short ./...
.PHONY: profile-test-integration
profile-test-integration:
echo "Running integration tests for profile service"
cd backend_services/profile \
&& docker build . -t profile-service \
&& mkdir -p test_data \
&& grep -v '^--*' ../../schema/players.sql >test_data/schema.sql \
&& go test --tags=integration ./...
.PHONY: matchmaking
matchmaking:
echo "Building matchmaking service"
mkdir -p ${BUILD_DIR} \
&& cd backend_services/matchmaking \
&& GOOS=linux GOARCH=386 go build -o ${BUILD_DIR}/matchmaking-service main.go
.PHONY: matchmaking-test
matchmaking-test:
echo "Running unit tests for matchmaking service"
cd backend_services/matchmaking && go test -short ./...
.PHONY: matchmaking-test-integration
matchmaking-test-integration:
echo "Running integration tests for matchmaking service"
cd backend_services/matchmaking \
&& docker build . -t matchmaking-service \
&& mkdir -p test_data \
&& grep -v '^--*' ../../schema/players.sql >test_data/schema.sql \
&& go test --tags=integration ./...
.PHONY: item
item:
echo "Building item service"
mkdir -p ${BUILD_DIR} \
&& cd backend_services/item \
&& GOOS=linux GOARCH=386 go build -o ${BUILD_DIR}/item-service main.go
.PHONY: item-test
item-test:
echo "Running unit tests for item service"
cd backend_services/item && go test ./...
.PHONY: item-test-integration
item-test-integration:
echo "Running integration tests for item service"
cd backend_services/item \
&& docker build . -t item-service \
&& mkdir -p test_data \
&& grep -v '^--*' ../../schema/players.sql >test_data/schema.sql \
&& echo ";" >> test_data/schema.sql \
&& grep -v '^--*' ../../schema/trading.sql >> test_data/schema.sql \
&& go test --tags=integration ./...
.PHONY: tradepost
tradepost:
echo "Building tradepost service"
mkdir -p ${BUILD_DIR} \
&& cd backend_services/tradepost \
&& GOOS=linux GOARCH=386 go build -o ${BUILD_DIR}/tradepost-service main.go
.PHONY: tradepost-test
tradepost-test:
echo "Running unit tests for tradepost service"
cd backend_services/tradepost && go test ./...
.PHONY: tradepost-test-integration
tradepost-test-integration:
echo "Running integration tests for tradepost service"
cd backend_services/tradepost \
&& mkdir -p test_data \
&& docker build . -t tradepost-service \
&& grep -v '^--*' ../../schema/players.sql >test_data/schema.sql \
&& echo ";" >> test_data/schema.sql \
&& grep -v '^--*' ../../schema/trading.sql >> test_data/schema.sql \
&& go test --tags=integration ./...
.PHONY: test-all-unit
test-all-unit: profile-test matchmaking-test item-test tradepost-test
.PHONY: test-all-integration
test-all-integration: profile-test-integration matchmaking-test-integration item-test-integration tradepost-test-integration
.PHONY: test-all
test-all: test-all-unit test-all-integration
.PHONY: build-all
build-all: profile matchmaking item tradepost
.PHONY: clean
clean:
echo "Running cleanup"
rm bin/*
docker rmi -f profile-service matchmaking-service item-service tradepost-service