forked from tilt-dev/tilt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
162 lines (123 loc) · 4.93 KB
/
Makefile
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
.PHONY: all proto install lint test test-go check-js test-js integration wire-check wire ensure check-go
check-go: lint errcheck verify_gofmt wire-check test-go
all: check-go check-js test-js
# There are 2 Go bugs that cause problems on CI:
# 1) Linker memory usage blew up in Go 1.11
# 2) Go incorrectly detects the number of CPUs when running in containers,
# and sets the number of parallel jobs to the number of CPUs.
# This makes CI blow up frequently without out-of-memory errors.
# Manually setting the number of parallel jobs helps fix this.
# https://github.com/golang/go/issues/26186#issuecomment-435544512
GO_PARALLEL_JOBS := 4
SYNCLET_IMAGE := gcr.io/windmill-public-containers/tilt-synclet
SYNCLET_DEV_IMAGE_TAG_FILE := .synclet-dev-image-tag
CIRCLECI := $(if $(CIRCLECI),$(CIRCLECI),false)
scripts/protocc/protocc.py: scripts/protocc
git submodule init
git submodule update
proto: scripts/protocc/protocc.py
python3 scripts/protocc/protocc.py --out go
# Build a binary that uses synclet:latest
# TODO(nick): We should have a release build that bakes in a particular
# SYNCLET_IMAGE tag.
install:
go install ./cmd/tilt/...
install-dev:
@if ! [[ -e "$(SYNCLET_DEV_IMAGE_TAG_FILE)" ]]; then echo "No dev synclet found. Run make synclet-dev."; exit 1; fi
go install -ldflags "-X 'github.com/windmilleng/tilt/internal/synclet/sidecar.SyncletTag=$$(<$(SYNCLET_DEV_IMAGE_TAG_FILE))'" ./...
# disable optimizations and inlining, to allow more complete information when attaching a debugger or capturing a profile
install-debug:
go install -gcflags "all=-N -l" ./...
install-sail:
go install ./cmd/sail/...
define synclet-build-dev
echo $1 > $(SYNCLET_DEV_IMAGE_TAG_FILE)
docker tag $(SYNCLET_IMAGE):dirty $(SYNCLET_IMAGE):$1
docker push $(SYNCLET_IMAGE):$1
endef
synclet-dev: synclet-cache
docker build --build-arg baseImage=synclet-cache -t $(SYNCLET_IMAGE):dirty -f synclet/Dockerfile .
$(call synclet-build-dev,$(shell docker inspect $(SYNCLET_IMAGE):dirty -f '{{.Id}}' | sed -E 's/sha256:(.{20}).*/dirty-\1/'))
build-synclet-and-install: synclet-dev install-dev
lint:
go vet -all -printfuncs=Verbosef,Infof,Debugf,PrintColorf ./...
build:
go test -p $(GO_PARALLEL_JOBS) -timeout 60s ./... -run nonsenseregex
test-go:
ifneq ($(CIRCLECI),true)
go test -p $(GO_PARALLEL_JOBS) -timeout 80s ./...
else
mkdir -p test-results
gotestsum --format standard-quiet --junitfile test-results/unit-tests.xml -- ./... -p $(GO_PARALLEL_JOBS) -timeout 80s
endif
test: test-go test-js
# skip some tests that are slow and not always relevant
shorttest:
go test -p $(GO_PARALLEL_JOBS) -tags 'skipcontainertests' -timeout 60s ./...
integration:
ifneq ($(CIRCLECI),true)
go test -p $(GO_PARALLEL_JOBS) -tags 'integration' -timeout 500s ./integration
else
mkdir -p test-results
gotestsum --format standard-quiet --junitfile test-results/unit-tests.xml -- ./integration -p $(GO_PARALLEL_JOBS) -tags 'integration' -timeout 500s
endif
dev-js:
cd web && yarn install && yarn run start
check-js:
cd web && yarn install
cd web && yarn run check
build-js:
cd web && yarn install
cd web && yarn build
test-js:
cd web && yarn install
cd web && CI=true yarn test
ensure:
dep ensure
verify_gofmt:
bash -c 'diff <(go fmt ./...) <(echo -n)'
benchmark:
go test -run=XXX -bench=. ./...
errcheck:
errcheck -ignoretests -ignoregenerated ./...
timing: install
./scripts/timing.py
wire:
wire ./internal/engine
wire ./internal/cli
wire ./internal/synclet
wire ./internal/sail/client
wire-check:
wire check ./internal/engine
wire check ./internal/cli
wire check ./internal/synclet
wire check ./internal/sail/client
ci-container:
docker build -t gcr.io/windmill-public-containers/tilt-ci -f .circleci/Dockerfile .circleci
docker push gcr.io/windmill-public-containers/tilt-ci
ci-integration-container:
docker build -t gcr.io/windmill-public-containers/tilt-integration-ci -f .circleci/Dockerfile.integration .circleci
docker push gcr.io/windmill-public-containers/tilt-integration-ci
clean:
go clean -cache -testcache -r -i ./...
docker rmi synclet-cache
synclet-cache:
if [ "$(shell docker images synclet-cache -q)" = "" ]; then \
docker build -t synclet-cache -f synclet/Dockerfile --target=go-cache .; \
fi;
synclet-release:
$(eval TAG := $(shell date +v%Y%m%d))
docker build -t $(SYNCLET_IMAGE):$(TAG) -f synclet/Dockerfile .
docker push $(SYNCLET_IMAGE):$(TAG)
sed -i 's/var SyncletTag = ".*"/var SyncletTag = "$(TAG)"/' internal/synclet/sidecar/sidecar.go
release:
goreleaser --rm-dist
deploy-sail:
$(eval TAG := $(shell date +built-%s))
docker build -t gcr.io/windmill-public-containers/sail:$(TAG) -f deployments/sail.dockerfile .
docker push gcr.io/windmill-public-containers/sail:$(TAG)
cat deployments/sail.yaml | sed 's!gcr.io/windmill-public-containers/sail!gcr.io/windmill-public-containers/sail:$(TAG)!g' | kubectl apply -f -
kubectl apply -f deployments/sail-networking.yaml
prettier:
cd web && yarn install
cd web && yarn run prettier --write "src/**/*.ts*"