-
Notifications
You must be signed in to change notification settings - Fork 176
/
Makefile
executable file
·195 lines (149 loc) · 7.24 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/usr/bin/env make
# This variable is used to set the environment variable UIDEBUG
# in sidebar-bindata. It is initialized with the value of UIDEBUG
# from the environment but is explicitly set to 1 when
# usernode-debug-ui is run.
UI_DEBUG := $(UIDEBUG)
# Allow for a test backend to be passed into the makefile, but make sure that we have
# a sensible default too
REACT_APP_TEST_BACKEND := $(if $(REACT_APP_TEST_BACKEND),$(REACT_APP_TEST_BACKEND),$("https://staging.kite.com"))
GITCOMMIT := $(shell git rev-parse HEAD)
.PHONY: run-standalone
default: install-standalone
#####################################
# Go build and verification tools #
#####################################
install-ci-deps:
# This target contains a minimal set of tools needed by CI.
# Do not add things here lightly!
go get -u golang.org/x/lint/golint
go get -u golang.org/x/tools/cmd/goimports
go get github.com/jteeuwen/go-bindata/...
go get gotest.tools/gotestsum
install-deps: install-ci-deps
# Protocol buffers
go get github.com/golang/protobuf/proto
go get github.com/golang/protobuf/protoc-gen-go
# Install some utilities
go install github.com/kiteco/kiteco/kite-go/cmds/printjson
go install github.com/kiteco/kiteco/kite-go/cmds/importchanged
datadeps-bindata:
go install github.com/kiteco/kiteco/kite-go/client/internal/kitelocal/cmds/datadeps-bindata
build-datadeps:
./scripts/build_datadeps.sh
generate:
go generate ./...
test:
# Run gotestsum with codecov reports for kite-go and kite-golib
gotestsum --raw-command scripts/go_test_coverage ./kite-go/... ./kite-golib/...
# Run gotestsum for checking build & test for local-pipelines (not part of codecov)
gotestsum ./local-pipelines/...
# Only run the data race checker on goroutine-heavy packages
go test -race \
./kite-go/sandbox \
./kite-go/client/internal/client \
./kite-go/client/internal/clientapp \
./kite-go/health/cmds/healthd \
./kite-go/core \
./kite-go/lang/python/pythonlocal
# Linux only, run tests with libtcmalloc overriding malloc, free, ...
test-tcmalloc:
LD_PRELOAD="${PWD}/linux/tcmalloc/libtcmalloc_minimal_debug.so" ${MAKE} test
build:
go build -v ./kite-go/... ./kite-golib/... ./local-pipelines/... ./kite-answers/...
vet:
# Run go-vet on all directories
go vet ./kite-go/... ./kite-golib/... ./local-pipelines/... ./kite-answers/...
lint:
true ./scripts/custom_lint.sh
# Run golint only on files that are not auto-generated
find kite-go kite-golib local-pipelines kite-answers -name "*.go" | grep -v ".pb.go" | grep -v "bindata.go" | grep -v "stackoverflow-xml.go" | grep -v "lsp/types/protocol.go" | xargs -I file golint file > /tmp/golint.test 2>&1
cat /tmp/golint.test
! test -s /tmp/golint.test
fmt:
find kite-go kite-golib local-pipelines kite-answers -name "*.go" | grep -v "bindata.go" | grep -v ".*.pb.go" | grep -v "/corpus/go/.*.go" | xargs -I file goimports -l=true file > /tmp/gofmt.test 2>/dev/null
cat /tmp/gofmt.test
! test -s /tmp/gofmt.test
check-client-fatal:
true git grep 'log.Fatal' ./kite-go/client/internal/ ':(exclude)*_test.go' ':(exclude)*/cmds/*' > /tmp/fatal.test 2>&1
cat /tmp/fatal.test
! test -s /tmp/fatal.test
bin-check:
! git status --porcelain --untracked-files=no | sed s/".* "// | xargs -I f file ../f | grep -E '(ELF|x86)'
verify: fmt lint vet bin-check build test
pull-frontend-docker:
docker pull kiteco/build-frontend
install-libtensorflow:
sudo rm -f /usr/local/lib/libtensorflow* || true
curl -L "https://s3-us-west-1.amazonaws.com/kite-data/tensorflow/libtensorflow-cpu-`go env GOOS`-x86_64-1.15.0.tar.gz" | sudo tar -C /usr/local -xz
install-libtensorflow-avx2:
sudo rm -f /usr/local/lib/libtensorflow* || true
curl -L "https://s3-us-west-1.amazonaws.com/kite-data/tensorflow/libtensorflow-cpu-`go env GOOS`-x86_64-avx2-1.15.0.tar.gz" | sudo tar -C /usr/local -xz
#######################################
# Webapp assets/bindata generation #
#######################################
# Ref for seemingly extravagant npm invocations: https://github.com/imagemin/pngquant-bin/issues/52#issuecomment-260247356
webapp-deps: pull-frontend-docker
docker run --rm -v "$(PWD)":/kiteco -w /kiteco/web/app\
-t kiteco/build-frontend\
/bin/bash -c "npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN); npm rebuild --quiet; npm uninstall --quiet; npm install --quiet"
webapp-tests: webapp-deps
# TODO(tarak): Use the right commands to run the tests here?
docker run --rm -v "$(PWD)":/kiteco -w /kiteco/web/app\
-t kiteco/build-frontend\
/bin/bash -c "npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN); npm run build-test"
docker run --rm -v "$(PWD)":/kiteco -w /kiteco/web/app -t kiteco/build-frontend npm test
webapp-build: webapp-deps
docker run --rm -v "$(PWD)":/kiteco -w /kiteco/web/app\
-t kiteco/build-frontend\
/bin/bash -c "npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN); npm run build"
webapp-build-dev: webapp-deps
docker run --rm -v "$(PWD)":/kiteco -w /kiteco/web/app\
-e "REACT_APP_ENV=development"\
-t kiteco/build-frontend\
/bin/bash -c "npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN); npm run build"
webapp-build-staging: webapp-deps
docker run --rm -v "$(PWD)":/kiteco -w /kiteco/web/app\
-e "REACT_APP_BACKEND=https://staging.kite.com" -e "REACT_APP_ENV=staging"\
-t kiteco/build-frontend\
/bin/bash -c "npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN); npm run build"
webapp-build-prod: webapp-deps
docker run --rm -v "$(PWD)":/kiteco -w /kiteco/web/app\
-e "REACT_APP_BACKEND=https://alpha.kite.com" -e "REACT_APP_ENV=production"\
-t kiteco/build-frontend\
/bin/bash -c "npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN); npm run build"
webapp-build-testing: webapp-deps
docker run --rm -v "$(PWD)":/kiteco -w /kiteco/web/app\
-e "REACT_APP_BACKEND=$(REACT_APP_TEST_BACKEND)" -e "REACT_APP_ENV=development"\
-t kiteco/build-frontend\
/bin/bash -c "npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN); npm run build"
#######################################
# kited.exe: windows #
#######################################
force:
kited.exe: force
go build -buildmode=exe \
-ldflags "-H windowsgui -X github.com/kiteco/kiteco/kite-go/client/internal/clientapp.gitCommit=$(GITCOMMIT)" \
github.com/kiteco/kiteco/kite-go/client/cmds/kited
WINDOWS_BUILD_VERSION ?= "9.9.9.9"
KiteSetup.exe: kited.exe kite-lsp.exe
mv kited.exe windows/
mv kite-lsp.exe windows/
mkdir -p windows/installer/current_build_bin/out
cd windows/installer && ./nant.bat -D:prevPatchVersion="${WINDOWS_PATCH_BASE}" -D:buildnumstring="${WINDOWS_BUILD_VERSION}" build
KiteUpdateInfo.xml: KiteSetup.exe
@cd windows/tools/kite_update_signer_cmd/bin/Debug && ./KiteUpdateSignerCmd.exe ${WINDOWS_PASS}
KitePatchUpdateInfo.xml: KiteSetup.exe
@[[ -n "${WINDOWS_PATCH_BASE}" ]] && cd windows/tools/kite_patch_update_signer_cmd/bin/Debug && ./KitePatchUpdateSignerCmd.exe ${WINDOWS_PASS}
kite-lsp.exe: force
go build \
-ldflags "-H windowsgui" \
github.com/kiteco/kiteco/kite-go/lsp/cmds/kite-lsp
kite-windows: KiteSetup.exe KiteUpdateInfo.xml KitePatchUpdateInfo.xml
#######################################
install-standalone:
./scripts/standalone.sh install
run-standalone:
./scripts/standalone.sh run
run-web-node:
go run github.com/kiteco/kiteco/kite-go/cmds/web-node/