This repository has been archived on 2023-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
vault-sidekick/Makefile

72 lines
1.7 KiB
Makefile
Raw Normal View History

2015-09-18 05:14:15 -04:00
NAME=vault-sidekick
AUTHOR ?= ukhomeofficedigital
REGISTRY ?= quay.io
2015-09-18 05:14:15 -04:00
HARDWARE=$(shell uname -m)
VERSION=$(shell awk '/Version =/ { print $$3 }' main.go | sed 's/"//g')
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr
2015-09-18 05:14:15 -04:00
.PHONY: test authors changelog build docker static release
2015-09-18 05:14:15 -04:00
default: build
build:
@echo "--> Compiling the project"
mkdir -p bin
go build -o bin/${NAME}
2015-09-18 05:14:15 -04:00
static:
@echo "--> Compiling the static binary"
mkdir -p bin
CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w' -o bin/${NAME}
docker: static
@echo "--> Building the docker image"
docker build -t ${REGISTRY}/${AUTHOR}/${NAME}:${VERSION} .
push: docker
@echo "--> Pushing the image to docker.io"
docker push ${REGISTRY}/${AUTHOR}/${NAME}:${VERSION}
release: static
mkdir -p release
gzip -c bin/${NAME} > release/${NAME}_${VERSION}_linux_${HARDWARE}.gz
rm -f release/${NAME}
clean:
rm -rf ./bin 2>/dev/null
rm -rf ./release 2>/dev/null
2015-09-18 05:14:15 -04:00
authors:
@echo "--> Updating the AUTHORS"
2015-09-18 05:14:15 -04:00
git log --format='%aN <%aE>' | sort -u > AUTHORS
deps:
@echo "--> Installing build dependencies"
go get -d -v ./...
go get github.com/stretchr/testify/assert
vet:
@echo "--> Running go tool vet $(VETARGS) ."
@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
go get golang.org/x/tools/cmd/vet; \
fi
@go tool vet $(VETARGS) .
format:
@echo "--> Running go fmt"
@go fmt $(PACKAGES)
cover:
@echo "--> Running go cover"
go list ./... | xargs -n1 go test --cover
test: deps
@echo "--> Running the tests"
2015-09-18 05:14:15 -04:00
go test -v
@$(MAKE) vet
@$(MAKE) cover
2015-09-18 05:14:15 -04:00
changelog: release
git log $(shell git tag | tail -n1)..HEAD --no-merges --format=%B > changelog