github.com/tilt-dev/tilt@v0.36.0/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 --output.junit-xml.path=test-results/lint.xml
   113  endif
   114  
   115  wire:
   116  	wire ./internal/engine ./internal/engine/buildcontrol ./internal/cli
   117  	goimports -w -l $(GOIMPORTS_LOCAL_ARG) internal/
   118  
   119  wire-check:
   120  	wire check ./internal/engine ./internal/engine/buildcontrol ./internal/cli
   121  
   122  release-container:
   123  	scripts/build-tilt-releaser.sh
   124  
   125  ci-container:
   126  	scripts/build-tilt-ci.sh
   127  
   128  ci-integration-container:
   129  	scripts/build-tilt-integration-ci.sh
   130  
   131  clean:
   132  	go clean -cache -testcache -r -i ./...
   133  
   134  prettier:
   135  	cd web && yarn install
   136  	cd web && yarn prettier
   137  
   138  storybook:
   139  	cd web && yarn install
   140  	cd web && yarn storybook
   141  
   142  ensure: vendor
   143  
   144  vendor:
   145  	go mod vendor
   146  	go mod tidy
   147  
   148  cli-docs:
   149  	rm -fR ../tilt.build/docs/cli
   150  	mkdir ../tilt.build/docs/cli
   151  	tilt dump cli-docs --dir=../tilt.build/docs/cli
   152  
   153  test_install_version_check: install
   154  	NO_INSTALL=1 PATH="~/go/bin:$$PATH" scripts/install.sh
   155  
   156  shellcheck:
   157  	find ./scripts -type f -name '*.sh' -exec docker run --rm -it -e SHELLCHECK_OPTS="-e SC2001" -v $$(pwd):/mnt nlknguyen/alpine-shellcheck {} \;
   158  
   159  update-codegen: update-codegen-go update-codegen-ts update-codegen-starlark
   160  
   161  update-codegen-go:
   162  	scripts/update-codegen.sh
   163  	goimports -w -l $(GOIMPORTS_LOCAL_ARG) pkg
   164  
   165  update-codegen-starlark:
   166  	go install github.com/tilt-dev/tilt-starlark-codegen@latest
   167  	tilt-starlark-codegen ./pkg/apis/core/v1alpha1 ./internal/tiltfile/v1alpha1
   168  	goimports -w -l $(GOIMPORTS_LOCAL_ARG) internal/
   169  
   170  update-codegen-ts:
   171  	./scripts/codegen-webview.sh
   172  
   173  release-build:
   174  	toast -f build.toast.yml