github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/Makefile (about) 1 .PHONY: all install lint test test-go check-js test-js test-storybook integration wire-check wire ensure goimports vendor shellcheck release-container update-codegen update-codegen-go update-codegen-starlark update-codegen-ts 2 3 all: check-js test-js test-storybook 4 5 # There are 2 Go bugs that cause problems on CI: 6 # 1) Linker memory usage blew up in Go 1.11 7 # 2) Go incorrectly detects the number of CPUs when running in containers, 8 # and sets the number of parallel jobs to the number of CPUs. 9 # This makes CI blow up frequently without out-of-memory errors. 10 # Manually setting the number of parallel jobs helps fix this. 11 # https://github.com/golang/go/issues/26186#issuecomment-435544512 12 GO_PARALLEL_JOBS := 4 13 14 CIRCLECI := $(if $(CIRCLECI),$(CIRCLECI),false) 15 16 GOIMPORTS_LOCAL_ARG := -local github.com/tilt-dev 17 18 # Build a binary the current commit SHA 19 install: 20 go install -mod vendor -ldflags "-X 'github.com/tilt-dev/tilt/internal/cli.commitSHA=$$(git merge-base master HEAD)'" ./cmd/tilt/... 21 22 # disable optimizations and inlining, to allow more complete information when attaching a debugger or capturing a profile 23 install-debug: 24 go install -mod vendor -gcflags "all=-N -l" ./... 25 26 lint: golangci-lint 27 28 lintfix: 29 LINT_FLAGS=--fix make golangci-lint 30 31 build: 32 go test -mod vendor -p $(GO_PARALLEL_JOBS) -timeout 60s ./... -run nonsenseregex 33 34 test-go: 35 ifneq ($(CIRCLECI),true) 36 gotestsum -- -mod vendor -p $(GO_PARALLEL_JOBS) -timeout 100s ./... 37 else 38 mkdir -p test-results 39 gotestsum --format standard-quiet --junitfile test-results/unit-tests.xml -- ./... -mod vendor -p $(GO_PARALLEL_JOBS) -timeout 100s 40 endif 41 42 test: test-go test-js 43 44 # skip some tests that are slow and not always relevant 45 # TODO(matt) skiplargetiltfiletests only skips the tiltfile DC+Helm tests at the moment 46 # we might also want to skip the ones in engine 47 shorttest: 48 go test -mod vendor -p $(GO_PARALLEL_JOBS) -short -tags skipcontainertests,skiplargetiltfiletests -timeout 100s ./... 49 50 shorttestsum: 51 ifneq ($(CIRCLECI),true) 52 gotestsum -- -mod vendor -p $(GO_PARALLEL_JOBS) -short -tags skipcontainertests,skiplargetiltfiletests -timeout 100s ./... 53 else 54 mkdir -p test-results 55 gotestsum --format standard-quiet --junitfile test-results/unit-tests.xml --rerun-fails=2 --rerun-fails-max-failures=10 --packages="./..." -- -mod vendor -count 1 -p $(GO_PARALLEL_JOBS) -short -tags skipcontainertests,skiplargetiltfiletests -timeout 100s 56 endif 57 58 integration: 59 ifneq ($(CIRCLECI),true) 60 go test -mod vendor -v -count 1 -p $(GO_PARALLEL_JOBS) -tags 'integration' -timeout 30m ./integration 61 else 62 mkdir -p test-results 63 gotestsum --format dots --junitfile test-results/unit-tests.xml -- ./integration -mod vendor -count 1 -p $(GO_PARALLEL_JOBS) -tags 'integration' -timeout 1000s 64 endif 65 66 # Run the integration tests on kind 67 integration-kind: 68 KIND_CLUSTER_NAME=integration ./integration/kind-with-registry.sh 69 KUBECONFIG="$(kind get kubeconfig-path --name="integration")" go test -mod vendor -p $(GO_PARALLEL_JOBS) -tags 'integration' -timeout 30m ./integration -count 1 70 kind delete cluster --name=integration 71 72 # Run the extension integration tests against the current kubecontext 73 test-extensions: 74 scripts/test-extensions.sh 75 76 dev-js: 77 cd web && yarn install && yarn run start 78 79 check-js: 80 cd web && yarn install --immutable 81 # make sure there are no compilation errors or lint warnings 82 cd web && CI=true yarn build 83 cd web && yarn run check 84 85 build-js: 86 cd web && yarn install --immutable 87 cd web && yarn build 88 cp -r web/build/* pkg/assets/build 89 90 test-js: 91 cd web && yarn install --immutable 92 ifneq ($(CIRCLECI),true) 93 cd web && CI=true yarn test 94 else 95 cd web && CI=true yarn ci 96 endif 97 98 test-storybook: 99 cd web && yarn start-storybook --ci --smoke-test 100 101 goimports: 102 goimports -w -l $(GOIMPORTS_LOCAL_ARG) cmd/ integration/ internal/ pkg/ 103 104 benchmark: 105 go test -mod vendor -run=XXX -bench=. ./... 106 107 golangci-lint: 108 ifneq ($(CIRCLECI),true) 109 GOFLAGS="-mod=vendor" golangci-lint run $(LINT_FLAGS) -v --timeout 300s 110 else 111 mkdir -p test-results 112 GOFLAGS="-mod=vendor" golangci-lint run -v --timeout 300s --out-format junit-xml > test-results/lint.xml 113 endif 114 115 wire: 116 # run wire in a container, which will then invoke `make wire-dev` 117 toast wire 118 119 wire-dev: 120 # run wire directly, both used by Toast job and useful for faster iteration 121 # if you have wire installed (but don't forget to run `make wire` before 122 # committing to generate the authoritative versions!) 123 wire ./internal/engine ./internal/engine/buildcontrol ./internal/cli 124 125 wire-check: 126 wire check ./internal/engine ./internal/engine/buildcontrol ./internal/cli 127 128 release-container: 129 scripts/build-tilt-releaser.sh 130 131 ci-container: 132 docker buildx build --push --pull --platform linux/amd64 -t docker/tilt-ci -f .circleci/Dockerfile .circleci 133 134 ci-integration-container: 135 docker buildx build --push --pull --platform linux/amd64 -t docker/tilt-integration-ci -f .circleci/Dockerfile.integration .circleci 136 137 clean: 138 go clean -cache -testcache -r -i ./... 139 140 prettier: 141 cd web && yarn install 142 cd web && yarn prettier 143 144 storybook: 145 cd web && yarn install 146 cd web && yarn storybook 147 148 tilt-toast-container: 149 docker build --platform linux/amd64 -t docker/tilt-toast -f Dockerfile.toast .circleci 150 docker push docker/tilt-toast 151 152 ensure: vendor 153 154 vendor: 155 go mod vendor 156 go mod tidy 157 158 cli-docs: 159 rm -fR ../tilt.build/docs/cli 160 mkdir ../tilt.build/docs/cli 161 tilt dump cli-docs --dir=../tilt.build/docs/cli 162 163 test_install_version_check: install 164 NO_INSTALL=1 PATH="~/go/bin:$$PATH" scripts/install.sh 165 166 shellcheck: 167 find ./scripts -type f -name '*.sh' -exec docker run --rm -it -e SHELLCHECK_OPTS="-e SC2001" -v $$(pwd):/mnt nlknguyen/alpine-shellcheck {} \; 168 169 update-codegen: update-codegen-go update-codegen-ts update-codegen-starlark 170 171 update-codegen-go: 172 scripts/update-codegen.sh 173 goimports -w -l $(GOIMPORTS_LOCAL_ARG) pkg 174 175 update-codegen-starlark: 176 go install github.com/tilt-dev/tilt-starlark-codegen@latest 177 tilt-starlark-codegen ./pkg/apis/core/v1alpha1 ./internal/tiltfile/v1alpha1 178 goimports -w -l $(GOIMPORTS_LOCAL_ARG) internal/ 179 180 update-codegen-ts: 181 toast proto-ts 182 183 release-build: 184 toast -f build.toast.yml