Newer
Older
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MAKEFILE_DIR := $(dir $(MAKEFILE_PATH))
TOOLS_DIR:= ../build-tools
GOSDN_PRG := $(MAKEFILE_DIR)$(TOOLS_DIR)
GOBIN := $(GOSDN_PRG)
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
BINARY_NAME=gosdn
Fabian Seidl
committed
GOTESTSUM_VERSION=v1.8.1
MOCKERY_VERSION=v2.20.0
GOCOVER_COBERTURA=v1.2.0
all: build
install-tools:
@echo Install development tooling
mkdir -p $(GOSDN_PRG)
Fabian Seidl
committed
go install gotest.tools/gotestsum@$(GOTESTSUM_VERSION)
go install github.com/vektra/mockery/v2@$(MOCKERY_VERSION)
@echo Finished installing development tooling
ci-install-tools:
Fabian Seidl
committed
go install gotest.tools/gotestsum@$(GOTESTSUM_VERSION)
go install github.com/boumenot/gocover-cobertura@$(GOCOVER_COBERTURA)
build:
$(GOBUILD) -o $(BINARY_NAME) ./cmd/gosdn
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
start: clean build
GOSDN_ADMIN_PASSWORD="admin" ENVIRONMENT=development ./$(BINARY_NAME) -l debug
start-insecure: clean build
ENVIRONMENT=development ./$(BINARY_NAME) -l debug -s insecure
unit-test: install-tools
Malte Bauch
committed
ENVIRONMENT=testing ./$(TOOLS_DIR)/gotestsum --junitfile report.xml --format testname -- -short -race $$( go list ./... | grep -v /forks/ | grep -v /mocks ) -v -trimpath -coverprofile=coverage.out
show-unit-test-coverage: unit-test
go tool cover -html=coverage.out
ci-unit-test: ci-install-tools
Malte Bauch
committed
ENVIRONMENT=testing gotestsum --junitfile report.xml --format testname -- -short -race $$( go list ./... | grep -v /forks/ | grep -v /mocks ) -v -trimpath -coverprofile=coverage.out -covermode atomic -timeout 30m
generate-mocks: install-tools
./$(TOOLS_DIR)/mockery --all --dir "./interfaces/"