Files
kapow/Makefile
pancho horrillo d81ef278da Update Makefile to make use of -trimpath build option
This option makes go build/install removes the absolute paths
within the produced executable, enabling more reproducible builds.

See ¹ for more details.

¹: https://golang.org/doc/go1.13?ref=hvper.com#go-command
2019-11-20 06:43:40 +01:00

56 lines
1.1 KiB
Makefile

.PHONY: lint build test jaillover race coverage install acceptance deps docker
GOCMD=go
GOBUILD=$(GOCMD) build -trimpath
GOINSTALL=$(GOCMD) install -trimpath
GOGET=$(GOCMD) get
GOTEST=$(GOCMD) test
GOTOOL=$(GOCMD) tool
GOLANGLINT=golangci-lint
PROJECTREPO=github.com/BBVA/kapow
BUILD_DIR=./build
OUTPUT_DIR=./output
TMP_DIR=/tmp
DOCS_DIR=./doc
DOCKER_DIR=./docker
BINARY_NAME=kapow
all: lint test race build
lint:
$(GOLANGLINT) run
build: deps
mkdir -p $(BUILD_DIR)
CGO_ENABLED=0 $(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) -v
test: build jaillover
$(GOTEST) -v -coverprofile=$(TMP_DIR)/c.out ./...
jaillover:
$(GOGET) $(PROJECTREPO)/testutils/$@
race: build
$(GOTEST) -race -v ./...
coverage: test race
mkdir -p $(OUTPUT_DIR)
$(GOTOOL) cover -html=$(TMP_DIR)/c.out -o $(OUTPUT_DIR)/coverage.html
install: build
CGO_ENABLED=0 $(GOINSTALL) ./...
acceptance: install
make -C ./spec/test
deps:
@echo "deps here"
docker: build
cp $(BUILD_DIR)/$(BINARY_NAME) $(DOCKER_DIR)/
cp $(DOCS_DIR)/*.pow $(DOCKER_DIR)/
cd $(DOCKER_DIR) && docker build -t kapow .
cd ..