-
Notifications
You must be signed in to change notification settings - Fork 306
/
Tiltfile
44 lines (32 loc) · 1.58 KB
/
Tiltfile
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
allow_k8s_contexts('kind-kind')
username = str(local('whoami')).rstrip('\n')
experimental_analytics_report({'user.name': username})
analytics_settings(enable=True)
def get_all_go_files(path):
return str(local('cd %s && find . -type f -name "*.go"' % path)).split("\n")
def go(name, entrypoint, all_go_files, srv=""):
local_resource(name, "go build -o /tmp/%s %s" % (name, entrypoint), serve_cmd=srv, deps=all_go_files)
def go_test(all_go_files):
local_resource('go_test', "make shorttestsum", deps=all_go_files, allow_parallel=True)
def go_lint(all_go_files):
local_resource("go_lint", "make lint", deps=all_go_files, allow_parallel=True)
def get_all_ts_files(path):
res = str(local('cd %s && find . -type f -name "*.ts*" | grep -v node_modules | grep -v __snapshots__' % path)).rstrip().split("\n")
return res
def yarn_install():
local_resource("yarn_install", "cd web && yarn", deps=['web/package.json', 'web/yarn.lock'])
def jest(path):
local_resource("web_jest", serve_cmd="cd %s && yarn run test --notify " % path, resource_deps=["yarn_install"], allow_parallel=True)
def web_lint():
ts_deps = get_all_ts_files("web")
local_resource("web_lint", "cd web && yarn run check", deps=ts_deps, resource_deps=["yarn_install"], allow_parallel=True)
def go_vendor():
local_resource("go_vendor", "make vendor", deps=['go.sum', 'go.mod'])
all_go_files = get_all_go_files(".")
go("Tilt", "cmd/tilt/main.go", all_go_files, srv="cd /tmp/ && ./tilt up --legacy=false --web-mode=prod --port=9765")
go_test(all_go_files)
go_lint(all_go_files)
go_vendor()
yarn_install()
jest("web")
web_lint()