-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
173 lines (140 loc) · 4.69 KB
/
Copy pathMakefile
File metadata and controls
173 lines (140 loc) · 4.69 KB
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
export GO15VENDOREXPERIMENT=1
PACKAGES=$(shell govendor list -no-status +local)
NOVENDOR=$(shell find . -path -prune -o -path ./vendor -prune -o -name '*.go' -print)
LINE_LENGTH_EXCLUDE=./api/pb/pb.pb.go \
./cloud/amazon/client/mocks/% \
./cloud/cfg/template.go \
./cloud/digitalocean/client/mocks/% \
./cloud/google/client/mocks/% \
./cloud/machine/amazon.go \
./cloud/machine/google.go \
./minion/network/link_test.go \
./minion/ovsdb/mock_transact_test.go \
./minion/ovsdb/mocks/Client.go \
./minion/pb/pb.pb.go \
./node_modules/% \
./integration-tester/tests/zookeeper/vendor/%
JS_LINT_COMMAND = node_modules/eslint/bin/eslint.js \
examples/ \
blueprint/ \
integration-tester/ \
cli/command/init/ \
util/
REPO = quilt
DOCKER = docker
SHELL := /bin/bash
all:
cd -P . && go build .
install:
cd -P . && go install .
gocheck:
govendor test $$(govendor list -no-status +local | \
grep -vE github.com/kelda/kelda/"integration-tester|scripts")
jscheck:
npm test
check: gocheck jscheck
clean:
govendor clean -x +local
rm -f *.cov.coverprofile cloud/*.cov.coverprofile minion/*.cov.coverprofile
rm -f *.cov.html cloud/*.cov.html minion/*.cov.html
rm quilt_linux quilt_darwin
linux:
cd -P . && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o quilt_linux .
darwin:
cd -P . && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o quilt_darwin .
release: linux darwin
COV_SKIP= /api/client/mocks \
/api/pb \
/cloud/amazon/client/mocks \
/cloud/digitalocean/client/mocks \
/cloud/google/client/mocks \
/cloud/provider/mocks \
/constants \
/minion/network/mocks \
/minion/nl \
/minion/nl/nlmock \
/minion/ovsdb/mocks \
/minion/pb \
/minion/pprofile \
/minion/supervisor/images \
/integration-tester/% \
/cli/ssh/mocks \
/cli/testutils \
/scripts \
/scripts/blueprints-tester \
/scripts/blueprints-tester/tests \
/scripts/format \
/version
go-coverage:
echo "" > coverage.txt
for package in $(filter-out $(COV_SKIP), $(subst github.com/kelda/kelda,,$(PACKAGES))) ; do \
go test -coverprofile=.$$package.cov .$$package && \
go tool cover -html=.$$package.cov -o .$$package.html ; \
cat .$$package.cov >> coverage.txt ; \
done
js-coverage:
./node_modules/.bin/nyc npm test
./node_modules/.bin/nyc report --reporter=text-lcov > coverage.lcov
coverage: go-coverage js-coverage
format:
gofmt -w -s $(NOVENDOR)
$(JS_LINT_COMMAND) --fix
scripts/format/format: scripts/format/format.go
cd scripts/format && go build format.go
build-blueprints-tester: scripts/blueprints-tester/*
cd scripts/blueprints-tester && go build .
check-blueprints: build-blueprints-tester
scripts/blueprints-tester/blueprints-tester
# lint checks the format of all of our code. This command should not make any
# changes to fix incorrect format; it should only check it. Code to update the
# format should go under the format target.
lint: golint jslint misspell
misspell:
find . \( -path ./vendor -or -path '*/node_modules/*' -or -path ./docs/build \) -prune -or -name '*' -type f -print | xargs misspell -error
jslint:
$(JS_LINT_COMMAND)
golint: scripts/format/format
cd -P . && govendor vet +local
ineffassign .
# Run golint
LINT_CODE=0; \
for package in $(PACKAGES) ; do \
if [[ $$package != *minion/pb* && $$package != *api/pb* ]] ; then \
golint -min_confidence .25 -set_exit_status $$package || LINT_CODE=1; \
fi \
done ; \
exit $$LINT_CODE
# Run gofmt
RESULT=`gofmt -s -l $(NOVENDOR)` ; \
if [[ -n "$$RESULT" ]] ; then \
echo $$RESULT ; \
exit 1 ; \
fi
# Do some additional checks of the go code (e.g., for line length)
scripts/format/format $(filter-out $(LINE_LENGTH_EXCLUDE),$(NOVENDOR))
generate:
govendor generate +local
providers:
python3 scripts/gce-descriptions > cloud/machine/google.go
# This is what's strictly required for `make check lint` to run.
get-build-tools:
go get -v -u \
github.com/client9/misspell/cmd/misspell \
github.com/golang/lint/golint \
github.com/gordonklaus/ineffassign \
github.com/kardianos/govendor
npm install .
# This additionally contains the tools needed for `go generate` to work.
go-get: get-build-tools
go get -v -u \
github.com/golang/protobuf/{proto,protoc-gen-go} \
github.com/vektra/mockery/.../
docker-build-quilt: linux
cd -P . && git show --pretty=medium --no-patch > buildinfo \
&& ${DOCKER} build -t ${REPO}/quilt .
docker-push-quilt:
${DOCKER} push ${REPO}/quilt
docker-build-ovs:
cd -P ovs && docker build -t ${REPO}/ovs .
# Include all .mk files so you can have your own local configurations
include $(wildcard *.mk)