github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/Tiltfile (about) 1 allow_k8s_contexts('kind-kind') 2 username = str(local('whoami')).rstrip('\n') 3 experimental_analytics_report({'user.name': username}) 4 analytics_settings(enable=True) 5 6 def get_all_go_files(path): 7 return str(local('cd %s && find . -type f -name "*.go"' % path)).split("\n") 8 9 def go(name, entrypoint, all_go_files, srv=""): 10 local_resource(name, "go build -o /tmp/%s %s" % (name, entrypoint), serve_cmd=srv, deps=all_go_files) 11 12 def go_test(all_go_files): 13 local_resource('go_test', "make shorttestsum", deps=all_go_files, allow_parallel=True) 14 15 def go_lint(all_go_files): 16 local_resource("go_lint", "make lint", deps=all_go_files, allow_parallel=True) 17 18 def get_all_ts_files(path): 19 res = str(local('cd %s && find . -type f -name "*.ts*" | grep -v node_modules | grep -v __snapshots__' % path)).rstrip().split("\n") 20 return res 21 22 def yarn_install(): 23 local_resource("yarn_install", "cd web && yarn", deps=['web/package.json', 'web/yarn.lock']) 24 25 def jest(path): 26 local_resource("web_jest", serve_cmd="cd %s && yarn run test --notify " % path, resource_deps=["yarn_install"], allow_parallel=True) 27 28 def web_lint(): 29 ts_deps = get_all_ts_files("web") 30 local_resource("web_lint", "cd web && yarn run check", deps=ts_deps, resource_deps=["yarn_install"], allow_parallel=True) 31 32 def go_vendor(): 33 local_resource("go_vendor", "make vendor", deps=['go.sum', 'go.mod']) 34 35 all_go_files = get_all_go_files(".") 36 37 go("Tilt", "cmd/tilt/main.go", all_go_files, srv="cd /tmp/ && ./tilt up --legacy=false --web-mode=prod --port=9765") 38 go_test(all_go_files) 39 go_lint(all_go_files) 40 go_vendor() 41 42 yarn_install() 43 jest("web") 44 web_lint()