core/Makefile

57 lines
2.0 KiB
Makefile

GOOS=$(shell go env GOOS)
GOARCH=$(shell go env GOARCH)
GOBIN=$(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN := $(shell go env GOPATH)/bin
endif
OSARCH=$(shell uname -m)
GOLANGCI_LINT_PATH=$(GOBIN)/golangci-lint
.PHONY: install-git-hooks
install-git-hooks:
@echo "Installing git hooks..."
pre-commit install --hook-type pre-commit
pre-commit install --hook-type commit-msg
.PHONY: install-golangci-lint
install-golangci-lint:
@echo "Installing github.com/golangci/golangci-lint..."
@(test -f $(GOLANGCI_LINT_PATH) && echo "github.com/golangci/golangci-lint is already installed. Skipping...") || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.57.2
.PHONY: install-oapi-codegen
install-oapi-codegen:
@echo "Installing github.com/deepmap/oapi-codegen..."
@go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@v2.1.0
.PHONY: install-tools
install-tools: install-golangci-lint install-oapi-codegen
.PHONY: install
install: install-tools install-git-hooks
.PHONY: generate-domain-error-codes
generate-domain-error-codes:
@echo "Generating error codes..."
@go run ./cmd/errorcodes > api/domain-error-code.yml
.PHONY: generate
generate: install-oapi-codegen generate-domain-error-codes
@echo "Running go generate..."
go generate ./...
.PHONY: create-job-sync-data
create-job-sync-data:
@kubectl create job --from=cronjob/twhelp-job-sync-data-dev "twhelp-job-sync-data-$(shell openssl rand -hex 10)"
.PHONY: create-job-sync-ennoblements
create-job-sync-ennoblements:
@kubectl create job --from=cronjob/twhelp-job-sync-ennoblements-dev "twhelp-job-sync-ennoblements-$(shell openssl rand -hex 10)"
.PHONY: create-job-create-snapshots
create-job-create-snapshots:
@kubectl create job --from=cronjob/twhelp-job-create-snapshots-dev "twhelp-job-create-snapshots-$(shell openssl rand -hex 10)"
.PHONY: create-job-cleanup
create-job-cleanup:
@kubectl create job --from=cronjob/twhelp-job-cleanup-dev "twhelp-job-cleanup-$(shell openssl rand -hex 10)"