appuio/tailscale-service-observer

View on GitHub
Makefile

Summary

Maintainability
Test Coverage
# Set Shell to bash, otherwise some targets fail with dash/zsh etc.
SHELL := /bin/bash

# Disable built-in rules
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables
.SUFFIXES:
.SECONDARY:
.DEFAULT_GOAL := help

# General variables
include Makefile.vars.mk

.PHONY: help
help: ## Show this help
    @grep -E -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

.PHONY: build
build: build-bin build-docker ## All-in-one build

.PHONY: build-bin
build-bin: export CGO_ENABLED = 0
build-bin: fmt vet ## Build binary
    @go build -o $(BIN_FILENAME) .

.PHONY: build-docker
build-docker: build-bin ## Build docker image
    $(DOCKER_CMD) build -t $(CONTAINER_IMG) .

.PHONY: test
test: test-go ## All-in-one test

.PHONY: test-go
test-go: ## Run unit tests against code
    go test -v -race -coverprofile cover.out -covermode atomic ./...

.PHONY: fmt
fmt: ## Run 'go fmt' against code
    go fmt ./...

.PHONY: vet
vet: ## Run 'go vet' against code
    go vet ./...

.PHONY: lint
lint: fmt vet generate ## All-in-one linting
    @echo 'Check for uncommitted changes ...'
    git diff --exit-code

.PHONY: generate
generate: ## Generate additional code and artifacts
    @go generate ./...

.PHONY: clean
clean: kind-clean ## Cleans local build artifacts
    docker rmi $(CONTAINER_IMG) || true
    rm -rf docs/node_modules $(docs_out_dir) dist .cache $(WORK_DIR)