github.com/grahambrereton-form3/tilt@v0.10.18/Makefile (about) 1 .PHONY: all proto install lint test test-go check-js test-js integration wire-check wire ensure check-go goimports proto-webview proto-webview-ts 2 3 check-go: lint errcheck verify_goimports wire-check test-go 4 all: check-go check-js test-js 5 6 # There are 2 Go bugs that cause problems on CI: 7 # 1) Linker memory usage blew up in Go 1.11 8 # 2) Go incorrectly detects the number of CPUs when running in containers, 9 # and sets the number of parallel jobs to the number of CPUs. 10 # This makes CI blow up frequently without out-of-memory errors. 11 # Manually setting the number of parallel jobs helps fix this. 12 # https://github.com/golang/go/issues/26186#issuecomment-435544512 13 GO_PARALLEL_JOBS := 4 14 15 SYNCLET_IMAGE := gcr.io/windmill-public-containers/tilt-synclet 16 SYNCLET_DEV_IMAGE_TAG_FILE := .synclet-dev-image-tag 17 18 CIRCLECI := $(if $(CIRCLECI),$(CIRCLECI),false) 19 20 GOIMPORTS_LOCAL_ARG := -local github.com/windmilleng/tilt 21 22 proto: 23 toast synclet-proto 24 toast proto-ts 25 26 # Build a binary that uses synclet:latest 27 install: 28 go install -ldflags "-X 'github.com/windmilleng/tilt/internal/cli.commitSHA=$$(git merge-base master HEAD)'" ./cmd/tilt/... 29 30 install-dev: 31 @if ! [[ -e "$(SYNCLET_DEV_IMAGE_TAG_FILE)" ]]; then echo "No dev synclet found. Run make synclet-dev."; exit 1; fi 32 go install -ldflags "-X 'github.com/windmilleng/tilt/internal/synclet/sidecar.SyncletTag=$$(<$(SYNCLET_DEV_IMAGE_TAG_FILE))'" ./... 33 34 # disable optimizations and inlining, to allow more complete information when attaching a debugger or capturing a profile 35 install-debug: 36 go install -gcflags "all=-N -l" ./... 37 38 define synclet-build-dev 39 echo $1 > $(SYNCLET_DEV_IMAGE_TAG_FILE) 40 docker tag $(SYNCLET_IMAGE):dirty $(SYNCLET_IMAGE):$1 41 docker push $(SYNCLET_IMAGE):$1 42 endef 43 44 synclet-dev: synclet-cache 45 docker build --build-arg baseImage=synclet-cache -t $(SYNCLET_IMAGE):dirty -f synclet/Dockerfile . 46 $(call synclet-build-dev,$(shell docker inspect $(SYNCLET_IMAGE):dirty -f '{{.Id}}' | sed -E 's/sha256:(.{20}).*/dirty-\1/')) 47 48 build-synclet-and-install: synclet-dev install-dev 49 50 lint: 51 go vet -all -printfuncs=Verbosef,Infof,Debugf,PrintColorf ./... 52 53 build: 54 go test -p $(GO_PARALLEL_JOBS) -timeout 60s ./... -run nonsenseregex 55 56 test-go: 57 ifneq ($(CIRCLECI),true) 58 go test -p $(GO_PARALLEL_JOBS) -timeout 80s ./... 59 else 60 mkdir -p test-results 61 gotestsum --format standard-quiet --junitfile test-results/unit-tests.xml -- ./... -p $(GO_PARALLEL_JOBS) -timeout 80s 62 endif 63 64 test: test-go test-js 65 66 # skip some tests that are slow and not always relevant 67 shorttest: 68 go test -p $(GO_PARALLEL_JOBS) -tags 'skipcontainertests' -timeout 60s ./... 69 70 integration: 71 ifneq ($(CIRCLECI),true) 72 go test -v -count 1 -p $(GO_PARALLEL_JOBS) -tags 'integration' -timeout 700s ./integration 73 else 74 mkdir -p test-results 75 gotestsum --format standard-quiet --junitfile test-results/unit-tests.xml -- ./integration -count 1 -v -p $(GO_PARALLEL_JOBS) -tags 'integration' -timeout 700s 76 endif 77 78 # Run the integration tests on kind 79 integration-kind: 80 kind create cluster --name=integration 81 KUBECONFIG="$(kind get kubeconfig-path --name="integration")" go test -p $(GO_PARALLEL_JOBS) -tags 'integration' -timeout 700s ./integration 82 kind delete cluster --name=integration 83 84 dev-js: 85 cd web && yarn install && yarn run start 86 87 check-js: 88 cd web && yarn install 89 cd web && yarn run check 90 91 build-js: 92 cd web && yarn install 93 cd web && yarn build 94 95 test-js: 96 cd web && yarn install 97 cd web && CI=true yarn test 98 99 ensure: 100 dep ensure 101 102 goimports: 103 goimports -w -l $(GOIMPORTS_LOCAL_ARG) $$(go list -f {{.Dir}} ./...) 104 105 verify_goimports: 106 # any files printed here need to be formatted by running `make goimports` 107 bash -c 'diff <(goimports -l $(GOIMPORTS_LOCAL_ARG) $$(go list -f {{.Dir}} ./...)) <(echo -n)' 108 109 benchmark: 110 go test -run=XXX -bench=. ./... 111 112 errcheck: 113 errcheck -ignoretests -ignoregenerated ./... 114 115 timing: install 116 ./scripts/timing.py 117 118 wire: 119 toast wire 120 121 wire-check: 122 wire check ./internal/engine 123 wire check ./internal/cli 124 wire check ./internal/synclet 125 126 ci-container: 127 docker build -t gcr.io/windmill-public-containers/tilt-ci -f .circleci/Dockerfile .circleci 128 docker push gcr.io/windmill-public-containers/tilt-ci 129 130 ci-integration-container: 131 docker build -t gcr.io/windmill-public-containers/tilt-integration-ci -f .circleci/Dockerfile.integration .circleci 132 docker push gcr.io/windmill-public-containers/tilt-integration-ci 133 134 clean: 135 go clean -cache -testcache -r -i ./... 136 docker rmi synclet-cache 137 138 synclet-cache: 139 if [ "$(shell docker images synclet-cache -q)" = "" ]; then \ 140 docker build -t synclet-cache -f synclet/Dockerfile --target=go-cache .; \ 141 fi; 142 143 synclet-release: 144 $(eval TAG := $(shell date +v%Y%m%d)) 145 docker build -t $(SYNCLET_IMAGE):$(TAG) -f synclet/Dockerfile . 146 docker push $(SYNCLET_IMAGE):$(TAG) 147 sed -i 's/var SyncletTag = ".*"/var SyncletTag = "$(TAG)"/' internal/synclet/sidecar/sidecar.go 148 149 custom-synclet-release: 150 $(eval TAG := $(if $(SYNCLET_TAG),$(SYNCLET_TAG),$(shell date +v%Y%m%d))) 151 docker build -t $(SYNCLET_IMAGE):$(TAG) -f synclet/Dockerfile . 152 docker push $(SYNCLET_IMAGE):$(TAG) 153 154 release: 155 goreleaser --rm-dist 156 157 prettier: 158 cd web && yarn install 159 cd web && yarn run prettier --write "src/**/*.ts*" 160 161 storybook: 162 cd web && yarn install 163 cd web && yarn storybook 164 165 tilt-toast-container: 166 docker build -t gcr.io/windmill-public-containers/tilt-toast -f Dockerfile.toast .circleci 167 docker push gcr.io/windmill-public-containers/tilt-toast