barretthousen/Makefile

53 lines
1.4 KiB
Makefile

K8S_VERSION = v1.26.3
KUBECONFIG = $(PWD)/.kubeconfig
CLUSTER = $(shell kind get clusters | grep 'bh-local')
GOBIN = $(shell go env GOPATH)/bin
.PHONY: dev
dev: .kubeconfig
KUBECONFIG=$(KUBECONFIG) tilt up -f ./src/Tiltfile
.PHONY: clobber
clobber:
KUBECONFIG=$(KUBECONFIG) ctlptl delete registry kind-bh-registry || true
KUBECONFIG=$(KUBECONFIG) ctlptl delete cluster kind-bh-local || true
@rm -f $(KUBECONFIG)
.PHONY: build
build:
docker build --build-arg "SERVICE=runner" -t bh/service-runner -f ./src/runner/Dockerfile .
.PHONY: acceptance-test
acceptance-test:
docker run -it --rm \
-v $(pwd)/src/acceptance-tests.yml:/tests/tests.yml \
-e "TEST_HOST=bh.localhost" \
-e "TEST_ENV=local" \
nytimes/httptest
.PHONY: gen
gen: $(GOBIN)/sqlc buf.lock
@$(GOBIN)/sqlc generate -f ./src/sqlc.yaml
@cd ./src && $(GOBIN)/buf generate
.PHONY: setup
setup: $(GOBIN)/sqlc $(GOBIN)/buf
@asdf install || true
buf.lock: $(GOBIN)/buf
@$(GOBIN)/buf mod update ./src
$(GOBIN)/buf:
@go install github.com/bufbuild/buf/cmd/buf@v1.17.0
$(GOBIN)/sqlc:
@go install github.com/kyleconroy/sqlc/cmd/sqlc@latest
.kubeconfig:
@KUBECONFIG=$(KUBECONFIG) ctlptl create registry kind-bh-registry --port=5005
@KUBECONFIG=$(KUBECONFIG) ctlptl create cluster kind --name=kind-bh-local --registry=kind-bh-registry --kubernetes-version $(K8S_VERSION)
@kind get kubeconfig --name=bh-local > .kubeconfig