-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
153 lines (111 loc) · 4.72 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
.PHONY: setup, test, unit-test, test-ci
project=colossus
compose=docker-compose -f docker/docker-compose.yml -p $(project)
compose-test=docker-compose -f docker/docker-tests.yml -p $(project) run --rm base-test
registry ?= hub.docker.com
TARGET ?= colossus
TAG ?= dev
setup:
go get github.com/Masterminds/glide
glide cc
glide install
go get -u github.com/jteeuwen/go-bindata/...
make build-bindata
test:
make TARGET=colossus test-target
make TARGET=colossusw test-target
make TARGET=colossuss test-target
test-target:
$(compose-test) internal-${TARGET}-integration-tests
$(compose-test) internal-${TARGET}-benchmark-tests
unit-test:
$(compose-test) internal-${TARGET}-tests
test-ci: unit-test
$(compose-test) internal-${TARGET}-integration-tests
$(compose-test) internal-${TARGET}-benchmark-tests
$(compose-test) internal-${TARGET}-perf-tests
.PHONY: build-bindata, build-schemas
build-bindata:
cd scripts && go-bindata --nocompress -pkg scripts ./../scripts/... && cd ../
build-schemas:
@rm -rf ./schemas/schema
flatc -g -o ./schemas/ ./schemas/*fbs
.PHONY: build, build-image, build-images, publish-images
build:
mkdir -p artifacts
CGO_ENABLED=0 go build -o bin/colossus github.com/SimonRichardson/colossus/colossus-http
tar -czf artifacts/colossus.tar.gz bin/colossus -C bin/ .
CGO_ENABLED=0 go build -o bin/colossusw github.com/SimonRichardson/colossus/colossus-walker
tar -czf artifacts/colossusw.tar.gz bin/colossusw -C bin/ .
CGO_ENABLED=0 go build -o bin/colossuss github.com/SimonRichardson/colossus/colossus-shim
tar -czf artifacts/colossuss.tar.gz bin/colossuss -C bin/ .
build-images: build-builder
docker run --rm $(registry)/colossus-builder:${TAG} internal-colossus-build | docker build -f colossus-http/Dockerfile -t $(registry)/colossus-http:${TAG} -
docker run --rm $(registry)/colossus-builder:${TAG} internal-colossusw-build | docker build -f colossus-walker/Dockerfile -t $(registry)/colossus-walker:${TAG} -
docker run --rm $(registry)/colossus-builder:${TAG} internal-colossuss-build | docker build -f colossus-shim/Dockerfile -t $(registry)/colossus-shim:${TAG} -
build-builder:
@docker build --build-arg GITHUB_TOKEN=${GITHUB_TOKEN} -f docker/Dockerfile.build --rm -t $(registry)/colossus-builder:${TAG} .
publish-releases:
docker push $(registry)/colossus-http:${TAG}
docker push $(registry)/colossus-walker:${TAG}
docker push $(registry)/colossus-shim:${TAG}
.PHONY: internal-colossus-build, internal-colossusw-build, internal-colossuss-build
internal-colossus-build:
@make setup -s
CGO_ENABLED=0 go build -o bin/colossus github.com/SimonRichardson/colossus/colossus-http
tar -czf - colossus-http/Dockerfile bin/colossus
internal-colossusw-build:
@make setup -s
CGO_ENABLED=0 go build -o bin/colossus github.com/SimonRichardson/colossus/colossus-walker
tar -czf - colossus-walker/Dockerfile bin/colossusw
internal-colossuss-build:
@make setup -s
CGO_ENABLED=0 go build -o bin/colossus github.com/SimonRichardson/colossus/colossus-shim
tar -czf - colossus-shim/Dockerfile bin/colossuss
.PHONY: internal-colossus-tests, internal-colossus-integration-tests, internal-colossus-benchmark-tests, internal-colossus-perf-tests
## colossus
internal-colossus-tests:
go test -v ./cluster/counter/... -stubs=true
go test -v ./cluster/counter/...
go test -v ./cluster/store/... -stubs=true
go test -v ./cluster/store/...
go test -v ./selectors/...
go test -v ./semaphore/...
internal-colossus-integration-tests:
go test -v ./colossus-http/...
internal-colossus-benchmark-tests:
go test -bench=. -run=BenchmarkRequest ./colossus-http/...
internal-colossus-perf-tests:
sh -c 'go run colossus-perf/*.go -ciserver=true -clusterserver=true'
.PHONY: internal-colossusw-tests, internal-colossusw-integration-tests, internal-colossusw-benchmark-tests, internal-colossusw-perf-tests
## Walker
internal-colossusw-tests:
# Do nothing!
internal-colossusw-integration-tests:
go test -v ./colossus-walker/...
internal-colossusw-benchmark-tests:
# Do nothing!
internal-colossusw-perf-tests:
# Do nothing!
.PHONY: internal-colossuss-tests, internal-colossuss-integration-tests, internal-colossuss-benchmark-tests, internal-colossuss-perf-tests
## Shim
internal-colossuss-tests:
# Do nothing!
internal-colossuss-integration-tests:
CGO_ENABLED=0 go build -o bin/colossus github.com/SimonRichardson/colossus/colossus-http
./bin/colossus &
sleep 4
go test -v ./colossus-shim/...
internal-colossuss-benchmark-tests:
# Do nothing!
internal-colossuss-perf-tests:
# Do nothing!
.PHONY: setup-env, teardown-env-dev, clean-env-dev
setup-env:
$(compose) up -d
teardown-env-dev:
$(compose) kill
$(compose) rm -f
clean-env-dev:
docker volume ls -qf "dangling=true" | xargs docker volume rm
docker images -qf "dangling=true" | xargs docker rmi